diff --git a/en/resources/admin/index.md b/en/resources/admin/index.md index 3c3982d..ad4dd58 100644 --- a/en/resources/admin/index.md +++ b/en/resources/admin/index.md @@ -2936,7 +2936,7 @@ Get audio speeches usage details for the organization. - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -3194,6 +3194,70 @@ Get audio speeches usage details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` The aggregated costs details of the specific time bucket. @@ -3393,7 +3457,7 @@ Get audio transcriptions usage details for the organization. - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -3651,6 +3715,70 @@ Get audio transcriptions usage details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` The aggregated costs details of the specific time bucket. @@ -3832,7 +3960,7 @@ Get code interpreter sessions usage details for the organization. - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -4090,6 +4218,70 @@ Get code interpreter sessions usage details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` The aggregated costs details of the specific time bucket. @@ -4293,7 +4485,7 @@ Get completions usage details for the organization. - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -4551,6 +4743,70 @@ Get completions usage details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` The aggregated costs details of the specific time bucket. @@ -4756,7 +5012,7 @@ Get embeddings usage details for the organization. - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -5014,6 +5270,70 @@ Get embeddings usage details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` The aggregated costs details of the specific time bucket. @@ -5241,7 +5561,7 @@ Get images usage details for the organization. - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -5499,35 +5819,99 @@ Get images usage details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` - The aggregated costs details of the specific time bucket. + The aggregated file search calls usage details of the specific time bucket. - - `object: "organization.costs.result"` + - `num_requests: number` - - `"organization.costs.result"` + The count of file search calls. - - `amount: optional object { currency, value }` + - `object: "organization.usage.file_searches.result"` - The monetary value in its associated currency. + - `"organization.usage.file_searches.result"` - - `currency: optional string` + - `api_key_id: optional string` - Lowercase ISO-4217 currency e.g. "usd" + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `value: optional number` + - `project_id: optional string` - The numeric value of the cost. + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `api_key_id: optional string` + - `user_id: optional string` - When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `line_item: optional string` + - `vector_store_id: optional string` - When `group_by=line_item`, this field provides the line item of the grouped costs result. + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. - - `project_id: optional string` + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` + + The aggregated costs details of the specific time bucket. + + - `object: "organization.costs.result"` + + - `"organization.costs.result"` + + - `amount: optional object { currency, value }` + + The monetary value in its associated currency. + + - `currency: optional string` + + Lowercase ISO-4217 currency e.g. "usd" + + - `value: optional number` + + The numeric value of the cost. + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `line_item: optional string` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `project_id: optional string` When `group_by=project_id`, this field provides the project ID of the grouped costs result. @@ -5700,7 +6084,7 @@ Get moderations usage details for the organization. - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -5958,6 +6342,70 @@ Get moderations usage details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` The aggregated costs details of the specific time bucket. @@ -6139,7 +6587,7 @@ Get vector stores usage details for the organization. - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -6397,6 +6845,70 @@ Get vector stores usage details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` The aggregated costs details of the specific time bucket. @@ -6516,11 +7028,11 @@ curl "https://api.openai.com/v1/organization/usage/vector_stores?start_time=1730 } ``` -## Costs +## File search calls -**get** `/organization/costs` +**get** `/organization/usage/file_search_calls` -Get costs details for the organization. +Get file search calls usage details for the organization. ### Query Parameters @@ -6530,11 +7042,15 @@ Get costs details for the organization. - `api_key_ids: optional array of string` - Return only costs for these API keys. + Return only usage for these API keys. -- `bucket_width: optional "1d"` +- `bucket_width: optional "1m" or "1h" or "1d"` - Width of each time bucket in response. Currently only `1d` is supported, default to `1d`. + Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. + + - `"1m"` + + - `"1h"` - `"1d"` @@ -6542,19 +7058,25 @@ Get costs details for the organization. End time (Unix seconds) of the query time range, exclusive. -- `group_by: optional array of "project_id" or "line_item" or "api_key_id"` +- `group_by: optional array of "project_id" or "user_id" or "api_key_id" or "vector_store_id"` - Group the costs by the specified fields. Support fields include `project_id`, `line_item`, `api_key_id` and any combination of them. + Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `vector_store_id` or any combination of them. - `"project_id"` - - `"line_item"` + - `"user_id"` - `"api_key_id"` + - `"vector_store_id"` + - `limit: optional number` - A limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7. + Specifies the number of buckets to return. + + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 - `page: optional string` @@ -6562,7 +7084,15 @@ Get costs details for the organization. - `project_ids: optional array of string` - Return only costs for these projects. + Return only usage for these projects. + +- `user_ids: optional array of string` + + Return only usage for these users. + +- `vector_store_ids: optional array of string` + + Return only usage for these vector stores. ### Returns @@ -6574,7 +7104,7 @@ Get costs details for the organization. - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -6832,6 +7362,70 @@ Get costs details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` The aggregated costs details of the specific time bucket. @@ -6881,7 +7475,7 @@ Get costs details for the organization. ### Example ```http -curl https://api.openai.com/v1/organization/costs \ +curl https://api.openai.com/v1/organization/usage/file_search_calls \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" ``` @@ -6922,7 +7516,7 @@ curl https://api.openai.com/v1/organization/costs \ ### Example ```http -curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1" \ +curl "https://api.openai.com/v1/organization/usage/file_search_calls?start_time=1730419200&limit=1" \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ``` @@ -6939,15 +7533,12 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 "end_time": 1730505600, "results": [ { - "object": "organization.costs.result", - "amount": { - "value": 0.06, - "currency": "usd" - }, - "line_item": null, + "object": "organization.usage.file_searches.result", + "num_requests": 2, "project_id": null, + "user_id": null, "api_key_id": null, - "quantity": null + "vector_store_id": null } ] } @@ -6957,27 +7548,101 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 } ``` -## Domain Types +## Web search calls -### Usage Audio Speeches Response +**get** `/organization/usage/web_search_calls` -- `UsageAudioSpeechesResponse object { data, has_more, next_page, object }` +Get web search calls usage details for the organization. - - `data: array of object { end_time, object, results, start_time }` +### Query Parameters - - `end_time: number` +- `start_time: number` - - `object: "bucket"` + Start time (Unix seconds) of the query time range, inclusive. - - `"bucket"` +- `api_key_ids: optional array of string` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + Return only usage for these API keys. - - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` +- `bucket_width: optional "1m" or "1h" or "1d"` - The aggregated completions usage details of the specific time bucket. + Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. - - `input_tokens: number` + - `"1m"` + + - `"1h"` + + - `"1d"` + +- `context_levels: optional array of "low" or "medium" or "high"` + + Return only web search usage for these context levels. + + - `"low"` + + - `"medium"` + + - `"high"` + +- `end_time: optional number` + + End time (Unix seconds) of the query time range, exclusive. + +- `group_by: optional array of "project_id" or "user_id" or "api_key_id" or 2 more` + + Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model`, `context_level` or any combination of them. + + - `"project_id"` + + - `"user_id"` + + - `"api_key_id"` + + - `"model"` + + - `"context_level"` + +- `limit: optional number` + + Specifies the number of buckets to return. + + - `bucket_width=1d`: default: 7, max: 31 + - `bucket_width=1h`: default: 24, max: 168 + - `bucket_width=1m`: default: 60, max: 1440 + +- `models: optional array of string` + + Return only usage for these models. + +- `page: optional string` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + +- `project_ids: optional array of string` + + Return only usage for these projects. + +- `user_ids: optional array of string` + + Return only usage for these users. + +### Returns + +- `data: array of object { end_time, object, results, start_time }` + + - `end_time: number` + + - `object: "bucket"` + + - `"bucket"` + + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` + + - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` + + The aggregated completions usage details of the specific time bucket. + + - `input_tokens: number` The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. @@ -7229,6 +7894,70 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` The aggregated costs details of the specific time bucket. @@ -7267,19 +7996,143 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 - `start_time: number` - - `has_more: boolean` +- `has_more: boolean` - - `next_page: string` +- `next_page: string` - - `object: "page"` +- `object: "page"` - `"page"` -### Usage Audio Transcriptions Response +### Example -- `UsageAudioTranscriptionsResponse object { data, has_more, next_page, object }` +```http +curl https://api.openai.com/v1/organization/usage/web_search_calls \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" +``` - - `data: array of object { end_time, object, results, start_time }` +#### Response + +```json +{ + "data": [ + { + "end_time": 0, + "object": "bucket", + "results": [ + { + "input_tokens": 0, + "num_model_requests": 0, + "object": "organization.usage.completions.result", + "output_tokens": 0, + "api_key_id": "api_key_id", + "batch": true, + "input_audio_tokens": 0, + "input_cached_tokens": 0, + "model": "model", + "output_audio_tokens": 0, + "project_id": "project_id", + "service_tier": "service_tier", + "user_id": "user_id" + } + ], + "start_time": 0 + } + ], + "has_more": true, + "next_page": "next_page", + "object": "page" +} +``` + +### Example + +```http +curl "https://api.openai.com/v1/organization/usage/web_search_calls?start_time=1730419200&limit=1" \ +-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ +-H "Content-Type: application/json" +``` + +#### Response + +```json +{ + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "organization.usage.web_searches.result", + "num_model_requests": 2, + "num_requests": 2, + "project_id": null, + "user_id": null, + "api_key_id": null, + "model": null, + "context_level": null + } + ] + } + ], + "has_more": false, + "next_page": null +} +``` + +## Costs + +**get** `/organization/costs` + +Get costs details for the organization. + +### Query Parameters + +- `start_time: number` + + Start time (Unix seconds) of the query time range, inclusive. + +- `api_key_ids: optional array of string` + + Return only costs for these API keys. + +- `bucket_width: optional "1d"` + + Width of each time bucket in response. Currently only `1d` is supported, default to `1d`. + + - `"1d"` + +- `end_time: optional number` + + End time (Unix seconds) of the query time range, exclusive. + +- `group_by: optional array of "project_id" or "line_item" or "api_key_id"` + + Group the costs by the specified fields. Support fields include `project_id`, `line_item`, `api_key_id` and any combination of them. + + - `"project_id"` + + - `"line_item"` + + - `"api_key_id"` + +- `limit: optional number` + + A limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7. + +- `page: optional string` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + +- `project_ids: optional array of string` + + Return only costs for these projects. + +### Returns + +- `data: array of object { end_time, object, results, start_time }` - `end_time: number` @@ -7287,7 +8140,7 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -7545,23 +8398,87 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` - The aggregated costs details of the specific time bucket. + The aggregated file search calls usage details of the specific time bucket. - - `object: "organization.costs.result"` + - `num_requests: number` - - `"organization.costs.result"` + The count of file search calls. - - `amount: optional object { currency, value }` + - `object: "organization.usage.file_searches.result"` - The monetary value in its associated currency. + - `"organization.usage.file_searches.result"` - - `currency: optional string` + - `api_key_id: optional string` - Lowercase ISO-4217 currency e.g. "usd" + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `value: optional number` + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` + + The aggregated costs details of the specific time bucket. + + - `object: "organization.costs.result"` + + - `"organization.costs.result"` + + - `amount: optional object { currency, value }` + + The monetary value in its associated currency. + + - `currency: optional string` + + Lowercase ISO-4217 currency e.g. "usd" + + - `value: optional number` The numeric value of the cost. @@ -7583,17 +8500,98 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 - `start_time: number` - - `has_more: boolean` +- `has_more: boolean` - - `next_page: string` +- `next_page: string` - - `object: "page"` +- `object: "page"` - `"page"` -### Usage Code Interpreter Sessions Response +### Example -- `UsageCodeInterpreterSessionsResponse object { data, has_more, next_page, object }` +```http +curl https://api.openai.com/v1/organization/costs \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" +``` + +#### Response + +```json +{ + "data": [ + { + "end_time": 0, + "object": "bucket", + "results": [ + { + "input_tokens": 0, + "num_model_requests": 0, + "object": "organization.usage.completions.result", + "output_tokens": 0, + "api_key_id": "api_key_id", + "batch": true, + "input_audio_tokens": 0, + "input_cached_tokens": 0, + "model": "model", + "output_audio_tokens": 0, + "project_id": "project_id", + "service_tier": "service_tier", + "user_id": "user_id" + } + ], + "start_time": 0 + } + ], + "has_more": true, + "next_page": "next_page", + "object": "page" +} +``` + +### Example + +```http +curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1" \ +-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ +-H "Content-Type: application/json" +``` + +#### Response + +```json +{ + "object": "page", + "data": [ + { + "object": "bucket", + "start_time": 1730419200, + "end_time": 1730505600, + "results": [ + { + "object": "organization.costs.result", + "amount": { + "value": 0.06, + "currency": "usd" + }, + "line_item": null, + "project_id": null, + "api_key_id": null, + "quantity": null + } + ] + } + ], + "has_more": false, + "next_page": null +} +``` + +## Domain Types + +### Usage Audio Speeches Response + +- `UsageAudioSpeechesResponse object { data, has_more, next_page, object }` - `data: array of object { end_time, object, results, start_time }` @@ -7603,7 +8601,7 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -7861,6 +8859,70 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` The aggregated costs details of the specific time bucket. @@ -7907,9 +8969,9 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 - `"page"` -### Usage Completions Response +### Usage Audio Transcriptions Response -- `UsageCompletionsResponse object { data, has_more, next_page, object }` +- `UsageAudioTranscriptionsResponse object { data, has_more, next_page, object }` - `data: array of object { end_time, object, results, start_time }` @@ -7919,7 +8981,7 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -8177,6 +9239,70 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` The aggregated costs details of the specific time bucket. @@ -8223,9 +9349,9 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 - `"page"` -### Usage Embeddings Response +### Usage Code Interpreter Sessions Response -- `UsageEmbeddingsResponse object { data, has_more, next_page, object }` +- `UsageCodeInterpreterSessionsResponse object { data, has_more, next_page, object }` - `data: array of object { end_time, object, results, start_time }` @@ -8235,7 +9361,7 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -8493,21 +9619,85 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` - The aggregated costs details of the specific time bucket. + The aggregated file search calls usage details of the specific time bucket. - - `object: "organization.costs.result"` + - `num_requests: number` - - `"organization.costs.result"` + The count of file search calls. - - `amount: optional object { currency, value }` + - `object: "organization.usage.file_searches.result"` - The monetary value in its associated currency. + - `"organization.usage.file_searches.result"` - - `currency: optional string` + - `api_key_id: optional string` - Lowercase ISO-4217 currency e.g. "usd" + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` + + The aggregated costs details of the specific time bucket. + + - `object: "organization.costs.result"` + + - `"organization.costs.result"` + + - `amount: optional object { currency, value }` + + The monetary value in its associated currency. + + - `currency: optional string` + + Lowercase ISO-4217 currency e.g. "usd" - `value: optional number` @@ -8539,9 +9729,9 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 - `"page"` -### Usage Images Response +### Usage Completions Response -- `UsageImagesResponse object { data, has_more, next_page, object }` +- `UsageCompletionsResponse object { data, has_more, next_page, object }` - `data: array of object { end_time, object, results, start_time }` @@ -8551,7 +9741,7 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -8809,6 +9999,70 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` The aggregated costs details of the specific time bucket. @@ -8855,9 +10109,9 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 - `"page"` -### Usage Moderations Response +### Usage Embeddings Response -- `UsageModerationsResponse object { data, has_more, next_page, object }` +- `UsageEmbeddingsResponse object { data, has_more, next_page, object }` - `data: array of object { end_time, object, results, start_time }` @@ -8867,7 +10121,7 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -9125,6 +10379,70 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` The aggregated costs details of the specific time bucket. @@ -9171,9 +10489,9 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 - `"page"` -### Usage Vector Stores Response +### Usage Images Response -- `UsageVectorStoresResponse object { data, has_more, next_page, object }` +- `UsageImagesResponse object { data, has_more, next_page, object }` - `data: array of object { end_time, object, results, start_time }` @@ -9183,7 +10501,7 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -9441,6 +10759,70 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` The aggregated costs details of the specific time bucket. @@ -9487,9 +10869,9 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 - `"page"` -### Usage Costs Response +### Usage Moderations Response -- `UsageCostsResponse object { data, has_more, next_page, object }` +- `UsageModerationsResponse object { data, has_more, next_page, object }` - `data: array of object { end_time, object, results, start_time }` @@ -9499,7 +10881,7 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 - `"bucket"` - - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 6 more` + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` @@ -9757,327 +11139,1911 @@ curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1 When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` - The aggregated costs details of the specific time bucket. + The aggregated file search calls usage details of the specific time bucket. - - `object: "organization.costs.result"` + - `num_requests: number` - - `"organization.costs.result"` + The count of file search calls. - - `amount: optional object { currency, value }` + - `object: "organization.usage.file_searches.result"` - The monetary value in its associated currency. + - `"organization.usage.file_searches.result"` - - `currency: optional string` + - `api_key_id: optional string` - Lowercase ISO-4217 currency e.g. "usd" + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `value: optional number` + - `project_id: optional string` - The numeric value of the cost. + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `api_key_id: optional string` + - `user_id: optional string` - When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `line_item: optional string` + - `vector_store_id: optional string` - When `group_by=line_item`, this field provides the line item of the grouped costs result. + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. - - `project_id: optional string` + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` - When `group_by=project_id`, this field provides the project ID of the grouped costs result. + The aggregated web search calls usage details of the specific time bucket. - - `quantity: optional number` + - `num_model_requests: number` - When `group_by=line_item`, this field provides the quantity of the grouped costs result. + The count of model requests. - - `start_time: number` + - `num_requests: number` - - `has_more: boolean` + The count of web search calls. - - `next_page: string` + - `object: "organization.usage.web_searches.result"` - - `object: "page"` + - `"organization.usage.web_searches.result"` - - `"page"` + - `api_key_id: optional string` -# Invites + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. -## List invites + - `context_level: optional string` -**get** `/organization/invites` + When `group_by=context_level`, this field provides the search context size of the grouped usage result. -Returns a list of invites in the organization. + - `model: optional string` -### Query Parameters + When `group_by=model`, this field provides the model name of the grouped usage result. -- `after: optional string` + - `project_id: optional string` - A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + When `group_by=project_id`, this field provides the project ID of the grouped usage result. -- `limit: optional number` + - `user_id: optional string` - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + When `group_by=user_id`, this field provides the user ID of the grouped usage result. -### Returns + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` -- `data: array of Invite` + The aggregated costs details of the specific time bucket. - - `id: string` + - `object: "organization.costs.result"` - The identifier, which can be referenced in API endpoints + - `"organization.costs.result"` - - `created_at: number` + - `amount: optional object { currency, value }` - The Unix timestamp (in seconds) of when the invite was sent. + The monetary value in its associated currency. - - `email: string` + - `currency: optional string` - The email address of the individual to whom the invite was sent + Lowercase ISO-4217 currency e.g. "usd" - - `object: "organization.invite"` + - `value: optional number` - The object type, which is always `organization.invite` + The numeric value of the cost. - - `"organization.invite"` + - `api_key_id: optional string` - - `projects: array of object { id, role }` + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. - The projects that were granted membership upon acceptance of the invite. + - `line_item: optional string` - - `id: string` + When `group_by=line_item`, this field provides the line item of the grouped costs result. - Project's public ID + - `project_id: optional string` - - `role: "member" or "owner"` + When `group_by=project_id`, this field provides the project ID of the grouped costs result. - Project membership role + - `quantity: optional number` - - `"member"` + When `group_by=line_item`, this field provides the quantity of the grouped costs result. - - `"owner"` + - `start_time: number` - - `role: "owner" or "reader"` + - `has_more: boolean` - `owner` or `reader` + - `next_page: string` - - `"owner"` + - `object: "page"` - - `"reader"` + - `"page"` - - `status: "accepted" or "expired" or "pending"` +### Usage Vector Stores Response - `accepted`,`expired`, or `pending` +- `UsageVectorStoresResponse object { data, has_more, next_page, object }` - - `"accepted"` + - `data: array of object { end_time, object, results, start_time }` - - `"expired"` + - `end_time: number` - - `"pending"` + - `object: "bucket"` - - `accepted_at: optional number` + - `"bucket"` - The Unix timestamp (in seconds) of when the invite was accepted. + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` - - `expires_at: optional number` + - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` - The Unix timestamp (in seconds) of when the invite expires. + The aggregated completions usage details of the specific time bucket. -- `has_more: boolean` + - `input_tokens: number` - The `has_more` property is used for pagination to indicate there are additional results. + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. -- `object: "list"` + - `num_model_requests: number` - The object type, which is always `list` + The count of requests made to the model. - - `"list"` + - `object: "organization.usage.completions.result"` -- `first_id: optional string` + - `"organization.usage.completions.result"` - The first `invite_id` in the retrieved `list` + - `output_tokens: number` -- `last_id: optional string` + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. - The last `invite_id` in the retrieved `list` + - `api_key_id: optional string` -### Example + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. -```http -curl https://api.openai.com/v1/organization/invites \ - -H "Authorization: Bearer $OPENAI_ADMIN_KEY" -``` + - `batch: optional boolean` -#### Response + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. -```json -{ - "data": [ - { - "id": "id", - "created_at": 0, - "email": "email", - "object": "organization.invite", - "projects": [ - { - "id": "id", - "role": "member" - } - ], - "role": "owner", - "status": "accepted", - "accepted_at": 0, - "expires_at": 0 - } - ], - "has_more": true, - "object": "list", - "first_id": "first_id", - "last_id": "last_id" -} -``` + - `input_audio_tokens: optional number` -### Example + The aggregated number of audio input tokens used, including cached tokens. -```http -curl https://api.openai.com/v1/organization/invites?after=invite-abc&limit=20 \ - -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ - -H "Content-Type: application/json" -``` + - `input_cached_tokens: optional number` -#### Response + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. -```json -{ - "object": "list", - "data": [ - { - "object": "organization.invite", - "id": "invite-abc", - "email": "user@example.com", - "role": "owner", - "status": "accepted", - "created_at": 1711471533, - "expires_at": 1711471533, - "accepted_at": 1711471533 - } - ], - "first_id": "invite-abc", - "last_id": "invite-abc", - "has_more": false -} -``` + - `model: optional string` -## Create invite + When `group_by=model`, this field provides the model name of the grouped usage result. -**post** `/organization/invites` + - `output_audio_tokens: optional number` -Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization. + The aggregated number of audio output tokens used. -### Body Parameters + - `project_id: optional string` -- `email: string` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - Send an email to this address + - `service_tier: optional string` -- `role: "reader" or "owner"` + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. - `owner` or `reader` + - `user_id: optional string` - - `"reader"` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `"owner"` + - `OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }` -- `projects: optional array of object { id, role }` + The aggregated embeddings usage details of the specific time bucket. - An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. + - `input_tokens: number` - - `id: string` + The aggregated number of input tokens used. - Project's public ID + - `num_model_requests: number` - - `role: "member" or "owner"` + The count of requests made to the model. - Project membership role + - `object: "organization.usage.embeddings.result"` - - `"member"` + - `"organization.usage.embeddings.result"` - - `"owner"` + - `api_key_id: optional string` -### Returns + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. -- `Invite object { id, created_at, email, 6 more }` + - `model: optional string` - Represents an individual `invite` to the organization. + When `group_by=model`, this field provides the model name of the grouped usage result. - - `id: string` + - `project_id: optional string` - The identifier, which can be referenced in API endpoints + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `created_at: number` + - `user_id: optional string` - The Unix timestamp (in seconds) of when the invite was sent. + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `email: string` + - `OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }` - The email address of the individual to whom the invite was sent + The aggregated moderations usage details of the specific time bucket. - - `object: "organization.invite"` + - `input_tokens: number` - The object type, which is always `organization.invite` + The aggregated number of input tokens used. - - `"organization.invite"` + - `num_model_requests: number` - - `projects: array of object { id, role }` + The count of requests made to the model. - The projects that were granted membership upon acceptance of the invite. + - `object: "organization.usage.moderations.result"` - - `id: string` + - `"organization.usage.moderations.result"` - Project's public ID + - `api_key_id: optional string` - - `role: "member" or "owner"` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - Project membership role + - `model: optional string` - - `"member"` + When `group_by=model`, this field provides the model name of the grouped usage result. - - `"owner"` + - `project_id: optional string` - - `role: "owner" or "reader"` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - `owner` or `reader` + - `user_id: optional string` - - `"owner"` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `"reader"` + - `OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }` - - `status: "accepted" or "expired" or "pending"` + The aggregated images usage details of the specific time bucket. - `accepted`,`expired`, or `pending` + - `images: number` - - `"accepted"` + The number of images processed. - - `"expired"` + - `num_model_requests: number` - - `"pending"` + The count of requests made to the model. - - `accepted_at: optional number` + - `object: "organization.usage.images.result"` - The Unix timestamp (in seconds) of when the invite was accepted. + - `"organization.usage.images.result"` - - `expires_at: optional number` + - `api_key_id: optional string` - The Unix timestamp (in seconds) of when the invite expires. + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. -### Example + - `model: optional string` -```http -curl https://api.openai.com/v1/organization/invites \ - -H 'Content-Type: application/json' \ - -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `size: optional string` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `source: optional string` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }` + + The aggregated audio speeches usage details of the specific time bucket. + + - `characters: number` + + The number of characters processed. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.audio_speeches.result"` + + - `"organization.usage.audio_speeches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.audio_transcriptions.result"` + + - `"organization.usage.audio_transcriptions.result"` + + - `seconds: number` + + The number of seconds processed. + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }` + + The aggregated vector stores usage details of the specific time bucket. + + - `object: "organization.usage.vector_stores.result"` + + - `"organization.usage.vector_stores.result"` + + - `usage_bytes: number` + + The vector stores usage in bytes. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `num_sessions: number` + + The number of code interpreter sessions. + + - `object: "organization.usage.code_interpreter_sessions.result"` + + - `"organization.usage.code_interpreter_sessions.result"` + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` + + The aggregated costs details of the specific time bucket. + + - `object: "organization.costs.result"` + + - `"organization.costs.result"` + + - `amount: optional object { currency, value }` + + The monetary value in its associated currency. + + - `currency: optional string` + + Lowercase ISO-4217 currency e.g. "usd" + + - `value: optional number` + + The numeric value of the cost. + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `line_item: optional string` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `quantity: optional number` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `start_time: number` + + - `has_more: boolean` + + - `next_page: string` + + - `object: "page"` + + - `"page"` + +### Usage File Search Calls Response + +- `UsageFileSearchCallsResponse object { data, has_more, next_page, object }` + + - `data: array of object { end_time, object, results, start_time }` + + - `end_time: number` + + - `object: "bucket"` + + - `"bucket"` + + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` + + - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` + + The aggregated completions usage details of the specific time bucket. + + - `input_tokens: number` + + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.completions.result"` + + - `"organization.usage.completions.result"` + + - `output_tokens: number` + + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `batch: optional boolean` + + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + + - `input_audio_tokens: optional number` + + The aggregated number of audio input tokens used, including cached tokens. + + - `input_cached_tokens: optional number` + + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `output_audio_tokens: optional number` + + The aggregated number of audio output tokens used. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `service_tier: optional string` + + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }` + + The aggregated embeddings usage details of the specific time bucket. + + - `input_tokens: number` + + The aggregated number of input tokens used. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.embeddings.result"` + + - `"organization.usage.embeddings.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }` + + The aggregated moderations usage details of the specific time bucket. + + - `input_tokens: number` + + The aggregated number of input tokens used. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.moderations.result"` + + - `"organization.usage.moderations.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }` + + The aggregated images usage details of the specific time bucket. + + - `images: number` + + The number of images processed. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.images.result"` + + - `"organization.usage.images.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `size: optional string` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `source: optional string` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }` + + The aggregated audio speeches usage details of the specific time bucket. + + - `characters: number` + + The number of characters processed. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.audio_speeches.result"` + + - `"organization.usage.audio_speeches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.audio_transcriptions.result"` + + - `"organization.usage.audio_transcriptions.result"` + + - `seconds: number` + + The number of seconds processed. + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }` + + The aggregated vector stores usage details of the specific time bucket. + + - `object: "organization.usage.vector_stores.result"` + + - `"organization.usage.vector_stores.result"` + + - `usage_bytes: number` + + The vector stores usage in bytes. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `num_sessions: number` + + The number of code interpreter sessions. + + - `object: "organization.usage.code_interpreter_sessions.result"` + + - `"organization.usage.code_interpreter_sessions.result"` + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` + + The aggregated costs details of the specific time bucket. + + - `object: "organization.costs.result"` + + - `"organization.costs.result"` + + - `amount: optional object { currency, value }` + + The monetary value in its associated currency. + + - `currency: optional string` + + Lowercase ISO-4217 currency e.g. "usd" + + - `value: optional number` + + The numeric value of the cost. + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `line_item: optional string` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `quantity: optional number` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `start_time: number` + + - `has_more: boolean` + + - `next_page: string` + + - `object: "page"` + + - `"page"` + +### Usage Web Search Calls Response + +- `UsageWebSearchCallsResponse object { data, has_more, next_page, object }` + + - `data: array of object { end_time, object, results, start_time }` + + - `end_time: number` + + - `object: "bucket"` + + - `"bucket"` + + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` + + - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` + + The aggregated completions usage details of the specific time bucket. + + - `input_tokens: number` + + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.completions.result"` + + - `"organization.usage.completions.result"` + + - `output_tokens: number` + + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `batch: optional boolean` + + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + + - `input_audio_tokens: optional number` + + The aggregated number of audio input tokens used, including cached tokens. + + - `input_cached_tokens: optional number` + + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `output_audio_tokens: optional number` + + The aggregated number of audio output tokens used. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `service_tier: optional string` + + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }` + + The aggregated embeddings usage details of the specific time bucket. + + - `input_tokens: number` + + The aggregated number of input tokens used. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.embeddings.result"` + + - `"organization.usage.embeddings.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }` + + The aggregated moderations usage details of the specific time bucket. + + - `input_tokens: number` + + The aggregated number of input tokens used. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.moderations.result"` + + - `"organization.usage.moderations.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }` + + The aggregated images usage details of the specific time bucket. + + - `images: number` + + The number of images processed. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.images.result"` + + - `"organization.usage.images.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `size: optional string` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `source: optional string` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }` + + The aggregated audio speeches usage details of the specific time bucket. + + - `characters: number` + + The number of characters processed. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.audio_speeches.result"` + + - `"organization.usage.audio_speeches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.audio_transcriptions.result"` + + - `"organization.usage.audio_transcriptions.result"` + + - `seconds: number` + + The number of seconds processed. + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }` + + The aggregated vector stores usage details of the specific time bucket. + + - `object: "organization.usage.vector_stores.result"` + + - `"organization.usage.vector_stores.result"` + + - `usage_bytes: number` + + The vector stores usage in bytes. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `num_sessions: number` + + The number of code interpreter sessions. + + - `object: "organization.usage.code_interpreter_sessions.result"` + + - `"organization.usage.code_interpreter_sessions.result"` + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` + + The aggregated costs details of the specific time bucket. + + - `object: "organization.costs.result"` + + - `"organization.costs.result"` + + - `amount: optional object { currency, value }` + + The monetary value in its associated currency. + + - `currency: optional string` + + Lowercase ISO-4217 currency e.g. "usd" + + - `value: optional number` + + The numeric value of the cost. + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `line_item: optional string` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `quantity: optional number` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `start_time: number` + + - `has_more: boolean` + + - `next_page: string` + + - `object: "page"` + + - `"page"` + +### Usage Costs Response + +- `UsageCostsResponse object { data, has_more, next_page, object }` + + - `data: array of object { end_time, object, results, start_time }` + + - `end_time: number` + + - `object: "bucket"` + + - `"bucket"` + + - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more` + + - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }` + + The aggregated completions usage details of the specific time bucket. + + - `input_tokens: number` + + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.completions.result"` + + - `"organization.usage.completions.result"` + + - `output_tokens: number` + + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `batch: optional boolean` + + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + + - `input_audio_tokens: optional number` + + The aggregated number of audio input tokens used, including cached tokens. + + - `input_cached_tokens: optional number` + + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `output_audio_tokens: optional number` + + The aggregated number of audio output tokens used. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `service_tier: optional string` + + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }` + + The aggregated embeddings usage details of the specific time bucket. + + - `input_tokens: number` + + The aggregated number of input tokens used. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.embeddings.result"` + + - `"organization.usage.embeddings.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }` + + The aggregated moderations usage details of the specific time bucket. + + - `input_tokens: number` + + The aggregated number of input tokens used. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.moderations.result"` + + - `"organization.usage.moderations.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }` + + The aggregated images usage details of the specific time bucket. + + - `images: number` + + The number of images processed. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.images.result"` + + - `"organization.usage.images.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `size: optional string` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `source: optional string` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }` + + The aggregated audio speeches usage details of the specific time bucket. + + - `characters: number` + + The number of characters processed. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.audio_speeches.result"` + + - `"organization.usage.audio_speeches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of requests made to the model. + + - `object: "organization.usage.audio_transcriptions.result"` + + - `"organization.usage.audio_transcriptions.result"` + + - `seconds: number` + + The number of seconds processed. + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }` + + The aggregated vector stores usage details of the specific time bucket. + + - `object: "organization.usage.vector_stores.result"` + + - `"organization.usage.vector_stores.result"` + + - `usage_bytes: number` + + The vector stores usage in bytes. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `num_sessions: number` + + The number of code interpreter sessions. + + - `object: "organization.usage.code_interpreter_sessions.result"` + + - `"organization.usage.code_interpreter_sessions.result"` + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: number` + + The count of file search calls. + + - `object: "organization.usage.file_searches.result"` + + - `"organization.usage.file_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: optional string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: number` + + The count of model requests. + + - `num_requests: number` + + The count of web search calls. + + - `object: "organization.usage.web_searches.result"` + + - `"organization.usage.web_searches.result"` + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: optional string` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: optional string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: optional string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }` + + The aggregated costs details of the specific time bucket. + + - `object: "organization.costs.result"` + + - `"organization.costs.result"` + + - `amount: optional object { currency, value }` + + The monetary value in its associated currency. + + - `currency: optional string` + + Lowercase ISO-4217 currency e.g. "usd" + + - `value: optional number` + + The numeric value of the cost. + + - `api_key_id: optional string` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `line_item: optional string` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `project_id: optional string` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `quantity: optional number` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `start_time: number` + + - `has_more: boolean` + + - `next_page: string` + + - `object: "page"` + + - `"page"` + +# Invites + +## List invites + +**get** `/organization/invites` + +Returns a list of invites in the organization. + +### Query Parameters + +- `after: optional string` + + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + +- `limit: optional number` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + +### Returns + +- `data: array of Invite` + + - `id: string` + + The identifier, which can be referenced in API endpoints + + - `created_at: number` + + The Unix timestamp (in seconds) of when the invite was sent. + + - `email: string` + + The email address of the individual to whom the invite was sent + + - `object: "organization.invite"` + + The object type, which is always `organization.invite` + + - `"organization.invite"` + + - `projects: array of object { id, role }` + + The projects that were granted membership upon acceptance of the invite. + + - `id: string` + + Project's public ID + + - `role: "member" or "owner"` + + Project membership role + + - `"member"` + + - `"owner"` + + - `role: "owner" or "reader"` + + `owner` or `reader` + + - `"owner"` + + - `"reader"` + + - `status: "accepted" or "expired" or "pending"` + + `accepted`,`expired`, or `pending` + + - `"accepted"` + + - `"expired"` + + - `"pending"` + + - `accepted_at: optional number` + + The Unix timestamp (in seconds) of when the invite was accepted. + + - `expires_at: optional number` + + The Unix timestamp (in seconds) of when the invite expires. + +- `has_more: boolean` + + The `has_more` property is used for pagination to indicate there are additional results. + +- `object: "list"` + + The object type, which is always `list` + + - `"list"` + +- `first_id: optional string` + + The first `invite_id` in the retrieved `list` + +- `last_id: optional string` + + The last `invite_id` in the retrieved `list` + +### Example + +```http +curl https://api.openai.com/v1/organization/invites \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" +``` + +#### Response + +```json +{ + "data": [ + { + "id": "id", + "created_at": 0, + "email": "email", + "object": "organization.invite", + "projects": [ + { + "id": "id", + "role": "member" + } + ], + "role": "owner", + "status": "accepted", + "accepted_at": 0, + "expires_at": 0 + } + ], + "has_more": true, + "object": "list", + "first_id": "first_id", + "last_id": "last_id" +} +``` + +### Example + +```http +curl https://api.openai.com/v1/organization/invites?after=invite-abc&limit=20 \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" +``` + +#### Response + +```json +{ + "object": "list", + "data": [ + { + "object": "organization.invite", + "id": "invite-abc", + "email": "user@example.com", + "role": "owner", + "status": "accepted", + "created_at": 1711471533, + "expires_at": 1711471533, + "accepted_at": 1711471533 + } + ], + "first_id": "invite-abc", + "last_id": "invite-abc", + "has_more": false +} +``` + +## Create invite + +**post** `/organization/invites` + +Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization. + +### Body Parameters + +- `email: string` + + Send an email to this address + +- `role: "reader" or "owner"` + + `owner` or `reader` + + - `"reader"` + + - `"owner"` + +- `projects: optional array of object { id, role }` + + An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one. + + - `id: string` + + Project's public ID + + - `role: "member" or "owner"` + + Project membership role + + - `"member"` + + - `"owner"` + +### Returns + +- `Invite object { id, created_at, email, 6 more }` + + Represents an individual `invite` to the organization. + + - `id: string` + + The identifier, which can be referenced in API endpoints + + - `created_at: number` + + The Unix timestamp (in seconds) of when the invite was sent. + + - `email: string` + + The email address of the individual to whom the invite was sent + + - `object: "organization.invite"` + + The object type, which is always `organization.invite` + + - `"organization.invite"` + + - `projects: array of object { id, role }` + + The projects that were granted membership upon acceptance of the invite. + + - `id: string` + + Project's public ID + + - `role: "member" or "owner"` + + Project membership role + + - `"member"` + + - `"owner"` + + - `role: "owner" or "reader"` + + `owner` or `reader` + + - `"owner"` + + - `"reader"` + + - `status: "accepted" or "expired" or "pending"` + + `accepted`,`expired`, or `pending` + + - `"accepted"` + + - `"expired"` + + - `"pending"` + + - `accepted_at: optional number` + + The Unix timestamp (in seconds) of when the invite was accepted. + + - `expires_at: optional number` + + The Unix timestamp (in seconds) of when the invite expires. + +### Example + +```http +curl https://api.openai.com/v1/organization/invites \ + -H 'Content-Type: application/json' \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -d '{ "email": "email", "role": "reader" @@ -15676,197 +18642,558 @@ Lists the project roles assigned to a user within a project. ### Path Parameters -- `project_id: string` +- `project_id: string` + +- `user_id: string` + +### Query Parameters + +- `after: optional string` + + Cursor for pagination. Provide the value from the previous response's `next` field to continue listing project roles. + +- `limit: optional number` + + A limit on the number of project role assignments to return. + +- `order: optional "asc" or "desc"` + + Sort order for the returned project roles. + + - `"asc"` + + - `"desc"` + +### Returns + +- `data: array of object { id, created_at, created_by, 8 more }` + + Role assignments returned in the current page. + + - `id: string` + + Identifier for the role. + + - `created_at: number` + + When the role was created. + + - `created_by: string` + + Identifier of the actor who created the role. + + - `created_by_user_obj: map[unknown]` + + User details for the actor that created the role, when available. + + - `description: string` + + Description of the role. + + - `metadata: map[unknown]` + + Arbitrary metadata stored on the role. + + - `name: string` + + Name of the role. + + - `permissions: array of string` + + Permissions associated with the role. + + - `predefined_role: boolean` + + Whether the role is predefined by OpenAI. + + - `resource_type: string` + + Resource type the role applies to. + + - `updated_at: number` + + When the role was last updated. + +- `has_more: boolean` + + Whether additional assignments are available when paginating. + +- `next: string` + + Cursor to fetch the next page of results, or `null` when there are no more assignments. + +- `object: "list"` + + Always `list`. + + - `"list"` + +### Example + +```http +curl https://api.openai.com/v1/projects/$PROJECT_ID/users/$USER_ID/roles \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" +``` + +#### Response + +```json +{ + "data": [ + { + "id": "id", + "created_at": 0, + "created_by": "created_by", + "created_by_user_obj": { + "foo": "bar" + }, + "description": "description", + "metadata": { + "foo": "bar" + }, + "name": "name", + "permissions": [ + "string" + ], + "predefined_role": true, + "resource_type": "resource_type", + "updated_at": 0 + } + ], + "has_more": true, + "next": "next", + "object": "list" +} +``` + +### Example + +```http +curl https://api.openai.com/v1/projects/proj_abc123/users/user_abc123/roles \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" +``` + +#### Response + +```json +{ + "object": "list", + "data": [ + { + "id": "role_01J1F8PROJ", + "name": "API Project Key Manager", + "permissions": [ + "api.organization.projects.api_keys.read", + "api.organization.projects.api_keys.write" + ], + "resource_type": "api.project", + "predefined_role": false, + "description": "Allows managing API keys for the project", + "created_at": 1711471533, + "updated_at": 1711472599, + "created_by": "user_abc123", + "created_by_user_obj": { + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com" + }, + "metadata": {} + } + ], + "has_more": false, + "next": null +} +``` + +## Assign project role to user + +**post** `/projects/{project_id}/users/{user_id}/roles` + +Assigns a project role to a user within a project. + +### Path Parameters + +- `project_id: string` + +- `user_id: string` + +### Body Parameters + +- `role_id: string` + + Identifier of the role to assign. + +### Returns + +- `object: "user.role"` + + Always `user.role`. + + - `"user.role"` + +- `role: Role` + + Details about a role that can be assigned through the public Roles API. + + - `id: string` + + Identifier for the role. + + - `description: string` + + Optional description of the role. + + - `name: string` + + Unique name for the role. + + - `object: "role"` + + Always `role`. + + - `"role"` + + - `permissions: array of string` + + Permissions granted by the role. + + - `predefined_role: boolean` + + Whether the role is predefined and managed by OpenAI. + + - `resource_type: string` + + Resource type the role is bound to (for example `api.organization` or `api.project`). + +- `user: OrganizationUser` + + Represents an individual `user` within an organization. + + - `id: string` + + The identifier, which can be referenced in API endpoints + + - `added_at: number` + + The Unix timestamp (in seconds) of when the user was added. + + - `object: "organization.user"` + + The object type, which is always `organization.user` -- `user_id: string` + - `"organization.user"` -### Query Parameters + - `api_key_last_used_at: optional number` -- `after: optional string` + The Unix timestamp (in seconds) of the user's last API key usage. - Cursor for pagination. Provide the value from the previous response's `next` field to continue listing project roles. + - `created: optional number` -- `limit: optional number` + The Unix timestamp (in seconds) of when the user was created. - A limit on the number of project role assignments to return. + - `developer_persona: optional string` -- `order: optional "asc" or "desc"` + The developer persona metadata for the user. - Sort order for the returned project roles. + - `email: optional string` - - `"asc"` + The email address of the user - - `"desc"` + - `is_default: optional boolean` -### Returns + Whether this is the organization's default user. -- `data: array of object { id, created_at, created_by, 8 more }` + - `is_scale_tier_authorized_purchaser: optional boolean` - Role assignments returned in the current page. + Whether the user is an authorized purchaser for Scale Tier. - - `id: string` + - `is_scim_managed: optional boolean` - Identifier for the role. + Whether the user is managed through SCIM. - - `created_at: number` + - `is_service_account: optional boolean` - When the role was created. + Whether the user is a service account. - - `created_by: string` + - `name: optional string` - Identifier of the actor who created the role. + The name of the user - - `created_by_user_obj: map[unknown]` + - `projects: optional object { data, object }` - User details for the actor that created the role, when available. + Projects associated with the user, if included. - - `description: string` + - `data: array of object { id, name, role }` - Description of the role. + - `id: optional string` - - `metadata: map[unknown]` + - `name: optional string` - Arbitrary metadata stored on the role. + - `role: optional string` - - `name: string` + - `object: "list"` - Name of the role. + - `"list"` - - `permissions: array of string` + - `role: optional string` - Permissions associated with the role. + `owner` or `reader` - - `predefined_role: boolean` + - `technical_level: optional string` - Whether the role is predefined by OpenAI. + The technical level metadata for the user. - - `resource_type: string` + - `user: optional object { id, object, banned, 5 more }` - Resource type the role applies to. + Nested user details. - - `updated_at: number` + - `id: string` - When the role was last updated. + - `object: "user"` -- `has_more: boolean` + - `"user"` - Whether additional assignments are available when paginating. + - `banned: optional boolean` -- `next: string` + - `banned_at: optional number` - Cursor to fetch the next page of results, or `null` when there are no more assignments. + - `email: optional string` -- `object: "list"` + - `enabled: optional boolean` - Always `list`. + - `name: optional string` - - `"list"` + - `picture: optional string` ### Example ```http curl https://api.openai.com/v1/projects/$PROJECT_ID/users/$USER_ID/roles \ - -H "Authorization: Bearer $OPENAI_ADMIN_KEY" + -H 'Content-Type: application/json' \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -d '{ + "role_id": "role_id" + }' ``` #### Response ```json { - "data": [ - { + "object": "user.role", + "role": { "id": "id", - "created_at": 0, - "created_by": "created_by", - "created_by_user_obj": { - "foo": "bar" - }, "description": "description", - "metadata": { - "foo": "bar" - }, "name": "name", + "object": "role", "permissions": [ "string" ], "predefined_role": true, - "resource_type": "resource_type", - "updated_at": 0 + "resource_type": "resource_type" + }, + "user": { + "id": "id", + "added_at": 0, + "object": "organization.user", + "api_key_last_used_at": 0, + "created": 0, + "developer_persona": "developer_persona", + "email": "email", + "is_default": true, + "is_scale_tier_authorized_purchaser": true, + "is_scim_managed": true, + "is_service_account": true, + "name": "name", + "projects": { + "data": [ + { + "id": "id", + "name": "name", + "role": "role" } ], - "has_more": true, - "next": "next", "object": "list" + }, + "role": "role", + "technical_level": "technical_level", + "user": { + "id": "id", + "object": "user", + "banned": true, + "banned_at": 0, + "email": "email", + "enabled": true, + "name": "name", + "picture": "picture" + } + } } ``` ### Example ```http -curl https://api.openai.com/v1/projects/proj_abc123/users/user_abc123/roles \ +curl -X POST https://api.openai.com/v1/projects/proj_abc123/users/user_abc123/roles \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ - -H "Content-Type: application/json" + -H "Content-Type: application/json" \ + -d '{ + "role_id": "role_01J1F8PROJ" + }' ``` #### Response ```json { - "object": "list", - "data": [ - { + "object": "user.role", + "user": { + "object": "organization.user", + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com", + "role": "owner", + "added_at": 1711470000 + }, + "role": { + "object": "role", "id": "role_01J1F8PROJ", "name": "API Project Key Manager", + "description": "Allows managing API keys for the project", "permissions": [ "api.organization.projects.api_keys.read", "api.organization.projects.api_keys.write" ], "resource_type": "api.project", - "predefined_role": false, - "description": "Allows managing API keys for the project", - "created_at": 1711471533, - "updated_at": 1711472599, - "created_by": "user_abc123", - "created_by_user_obj": { - "id": "user_abc123", - "name": "Ada Lovelace", - "email": "ada@example.com" - }, - "metadata": {} + "predefined_role": false } - ], - "has_more": false, - "next": null } ``` -## Assign project role to user +## Unassign project role from user + +**delete** `/projects/{project_id}/users/{user_id}/roles/{role_id}` + +Unassigns a project role from a user within a project. + +### Path Parameters + +- `project_id: string` + +- `user_id: string` + +- `role_id: string` + +### Returns + +- `deleted: boolean` + + Whether the assignment was removed. + +- `object: string` + + Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + +### Example + +```http +curl https://api.openai.com/v1/projects/$PROJECT_ID/users/$USER_ID/roles/$ROLE_ID \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" +``` + +#### Response + +```json +{ + "deleted": true, + "object": "object" +} +``` + +### Example + +```http +curl -X DELETE https://api.openai.com/v1/projects/proj_abc123/users/user_abc123/roles/role_01J1F8PROJ \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" +``` + +#### Response + +```json +{ + "object": "user.role.deleted", + "deleted": true +} +``` + +## Domain Types + +### Role List Response + +- `RoleListResponse object { id, created_at, created_by, 8 more }` + + Detailed information about a role assignment entry returned when listing assignments. + + - `id: string` + + Identifier for the role. + + - `created_at: number` + + When the role was created. + + - `created_by: string` -**post** `/projects/{project_id}/users/{user_id}/roles` + Identifier of the actor who created the role. -Assigns a project role to a user within a project. + - `created_by_user_obj: map[unknown]` -### Path Parameters + User details for the actor that created the role, when available. -- `project_id: string` + - `description: string` -- `user_id: string` + Description of the role. -### Body Parameters + - `metadata: map[unknown]` -- `role_id: string` + Arbitrary metadata stored on the role. - Identifier of the role to assign. + - `name: string` -### Returns + Name of the role. -- `object: "user.role"` + - `permissions: array of string` + + Permissions associated with the role. + + - `predefined_role: boolean` + + Whether the role is predefined by OpenAI. + + - `resource_type: string` + + Resource type the role applies to. + + - `updated_at: number` + + When the role was last updated. + +### Role Create Response + +- `RoleCreateResponse object { object, role, user }` + + Role assignment linking a user to a role. + + - `object: "user.role"` Always `user.role`. - `"user.role"` -- `role: Role` + - `role: Role` Details about a role that can be assigned through the public Roles API. @@ -15900,7 +19227,7 @@ Assigns a project role to a user within a project. Resource type the role is bound to (for example `api.organization` or `api.project`). -- `user: OrganizationUser` + - `user: OrganizationUser` Represents an individual `user` within an organization. @@ -16000,388 +19327,480 @@ Assigns a project role to a user within a project. - `picture: optional string` +### Role Delete Response + +- `RoleDeleteResponse object { deleted, object }` + + Confirmation payload returned after unassigning a role. + + - `deleted: boolean` + + Whether the assignment was removed. + + - `object: string` + + Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + +# Service Accounts + +## List project service accounts + +**get** `/organization/projects/{project_id}/service_accounts` + +Returns a list of service accounts in the project. + +### Path Parameters + +- `project_id: string` + +### Query Parameters + +- `after: optional string` + + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + +- `limit: optional number` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + +### Returns + +- `data: array of ProjectServiceAccount` + + - `id: string` + + The identifier, which can be referenced in API endpoints + + - `created_at: number` + + The Unix timestamp (in seconds) of when the service account was created + + - `name: string` + + The name of the service account + + - `object: "organization.project.service_account"` + + The object type, which is always `organization.project.service_account` + + - `"organization.project.service_account"` + + - `role: "owner" or "member"` + + `owner` or `member` + + - `"owner"` + + - `"member"` + +- `has_more: boolean` + +- `object: "list"` + + - `"list"` + +- `first_id: optional string` + +- `last_id: optional string` + ### Example ```http -curl https://api.openai.com/v1/projects/$PROJECT_ID/users/$USER_ID/roles \ - -H 'Content-Type: application/json' \ - -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ - -d '{ - "role_id": "role_id" - }' +curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/service_accounts \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" ``` #### Response ```json { - "object": "user.role", - "role": { - "id": "id", - "description": "description", - "name": "name", - "object": "role", - "permissions": [ - "string" - ], - "predefined_role": true, - "resource_type": "resource_type" - }, - "user": { - "id": "id", - "added_at": 0, - "object": "organization.user", - "api_key_last_used_at": 0, - "created": 0, - "developer_persona": "developer_persona", - "email": "email", - "is_default": true, - "is_scale_tier_authorized_purchaser": true, - "is_scim_managed": true, - "is_service_account": true, - "name": "name", - "projects": { "data": [ { "id": "id", + "created_at": 0, "name": "name", - "role": "role" + "object": "organization.project.service_account", + "role": "owner" } ], - "object": "list" - }, - "role": "role", - "technical_level": "technical_level", - "user": { - "id": "id", - "object": "user", - "banned": true, - "banned_at": 0, - "email": "email", - "enabled": true, - "name": "name", - "picture": "picture" - } - } + "has_more": true, + "object": "list", + "first_id": "first_id", + "last_id": "last_id" } ``` ### Example ```http -curl -X POST https://api.openai.com/v1/projects/proj_abc123/users/user_abc123/roles \ +curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts?after=custom_id&limit=20 \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "role_id": "role_01J1F8PROJ" - }' + -H "Content-Type: application/json" ``` #### Response ```json { - "object": "user.role", - "user": { - "object": "organization.user", - "id": "user_abc123", - "name": "Ada Lovelace", - "email": "ada@example.com", + "object": "list", + "data": [ + { + "object": "organization.project.service_account", + "id": "svc_acct_abc", + "name": "Service Account", "role": "owner", - "added_at": 1711470000 - }, - "role": { - "object": "role", - "id": "role_01J1F8PROJ", - "name": "API Project Key Manager", - "description": "Allows managing API keys for the project", - "permissions": [ - "api.organization.projects.api_keys.read", - "api.organization.projects.api_keys.write" - ], - "resource_type": "api.project", - "predefined_role": false + "created_at": 1711471533 } + ], + "first_id": "svc_acct_abc", + "last_id": "svc_acct_xyz", + "has_more": false } ``` -## Unassign project role from user +## Create project service account -**delete** `/projects/{project_id}/users/{user_id}/roles/{role_id}` +**post** `/organization/projects/{project_id}/service_accounts` -Unassigns a project role from a user within a project. +Creates a new service account in the project. This also returns an unredacted API key for the service account. ### Path Parameters - `project_id: string` -- `user_id: string` +### Body Parameters -- `role_id: string` +- `name: string` + + The name of the service account being created. ### Returns -- `deleted: boolean` +- `id: string` + +- `api_key: object { id, created_at, name, 2 more }` + + - `id: string` + + - `created_at: number` + + - `name: string` + + - `object: "organization.project.service_account.api_key"` + + The object type, which is always `organization.project.service_account.api_key` + + - `"organization.project.service_account.api_key"` + + - `value: string` + +- `created_at: number` + +- `name: string` + +- `object: "organization.project.service_account"` + + - `"organization.project.service_account"` - Whether the assignment was removed. +- `role: "member"` -- `object: string` + Service accounts can only have one role of type `member` - Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + - `"member"` ### Example ```http -curl https://api.openai.com/v1/projects/$PROJECT_ID/users/$USER_ID/roles/$ROLE_ID \ - -X DELETE \ - -H "Authorization: Bearer $OPENAI_ADMIN_KEY" +curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/service_accounts \ + -H 'Content-Type: application/json' \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -d '{ + "name": "name" + }' ``` #### Response ```json { - "deleted": true, - "object": "object" + "id": "id", + "api_key": { + "id": "id", + "created_at": 0, + "name": "name", + "object": "organization.project.service_account.api_key", + "value": "value" + }, + "created_at": 0, + "name": "name", + "object": "organization.project.service_account", + "role": "member" } ``` ### Example ```http -curl -X DELETE https://api.openai.com/v1/projects/proj_abc123/users/user_abc123/roles/role_01J1F8PROJ \ +curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/service_accounts \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ - -H "Content-Type: application/json" + -H "Content-Type: application/json" \ + -d '{ + "name": "Production App" + }' ``` #### Response ```json { - "object": "user.role.deleted", - "deleted": true + "object": "organization.project.service_account", + "id": "svc_acct_abc", + "name": "Production App", + "role": "member", + "created_at": 1711471533, + "api_key": { + "object": "organization.project.service_account.api_key", + "value": "sk-abcdefghijklmnop123", + "name": "Secret Key", + "created_at": 1711471533, + "id": "key_abc" + } } ``` -## Domain Types - -### Role List Response - -- `RoleListResponse object { id, created_at, created_by, 8 more }` - - Detailed information about a role assignment entry returned when listing assignments. +## Retrieve project service account - - `id: string` +**get** `/organization/projects/{project_id}/service_accounts/{service_account_id}` - Identifier for the role. +Retrieves a service account in the project. - - `created_at: number` +### Path Parameters - When the role was created. +- `project_id: string` - - `created_by: string` +- `service_account_id: string` - Identifier of the actor who created the role. +### Returns - - `created_by_user_obj: map[unknown]` +- `ProjectServiceAccount object { id, created_at, name, 2 more }` - User details for the actor that created the role, when available. + Represents an individual service account in a project. - - `description: string` + - `id: string` - Description of the role. + The identifier, which can be referenced in API endpoints - - `metadata: map[unknown]` + - `created_at: number` - Arbitrary metadata stored on the role. + The Unix timestamp (in seconds) of when the service account was created - `name: string` - Name of the role. - - - `permissions: array of string` - - Permissions associated with the role. - - - `predefined_role: boolean` - - Whether the role is predefined by OpenAI. - - - `resource_type: string` - - Resource type the role applies to. - - - `updated_at: number` - - When the role was last updated. - -### Role Create Response - -- `RoleCreateResponse object { object, role, user }` - - Role assignment linking a user to a role. + The name of the service account - - `object: "user.role"` + - `object: "organization.project.service_account"` - Always `user.role`. + The object type, which is always `organization.project.service_account` - - `"user.role"` + - `"organization.project.service_account"` - - `role: Role` + - `role: "owner" or "member"` - Details about a role that can be assigned through the public Roles API. + `owner` or `member` - - `id: string` + - `"owner"` - Identifier for the role. + - `"member"` - - `description: string` +### Example - Optional description of the role. +```http +curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/service_accounts/$SERVICE_ACCOUNT_ID \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" +``` - - `name: string` +#### Response - Unique name for the role. +```json +{ + "id": "id", + "created_at": 0, + "name": "name", + "object": "organization.project.service_account", + "role": "owner" +} +``` - - `object: "role"` +### Example - Always `role`. +```http +curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" +``` - - `"role"` +#### Response - - `permissions: array of string` +```json +{ + "object": "organization.project.service_account", + "id": "svc_acct_abc", + "name": "Service Account", + "role": "owner", + "created_at": 1711471533 +} +``` - Permissions granted by the role. +## Delete project service account - - `predefined_role: boolean` +**delete** `/organization/projects/{project_id}/service_accounts/{service_account_id}` - Whether the role is predefined and managed by OpenAI. +Deletes a service account from the project. - - `resource_type: string` +Returns confirmation of service account deletion, or an error if the project +is archived (archived projects have no service accounts). - Resource type the role is bound to (for example `api.organization` or `api.project`). +### Path Parameters - - `user: OrganizationUser` +- `project_id: string` - Represents an individual `user` within an organization. +- `service_account_id: string` - - `id: string` +### Returns - The identifier, which can be referenced in API endpoints +- `id: string` - - `added_at: number` +- `deleted: boolean` - The Unix timestamp (in seconds) of when the user was added. +- `object: "organization.project.service_account.deleted"` - - `object: "organization.user"` + - `"organization.project.service_account.deleted"` - The object type, which is always `organization.user` +### Example - - `"organization.user"` +```http +curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/service_accounts/$SERVICE_ACCOUNT_ID \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" +``` - - `api_key_last_used_at: optional number` +#### Response - The Unix timestamp (in seconds) of the user's last API key usage. +```json +{ + "id": "id", + "deleted": true, + "object": "organization.project.service_account.deleted" +} +``` - - `created: optional number` +### Example - The Unix timestamp (in seconds) of when the user was created. +```http +curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" +``` - - `developer_persona: optional string` +#### Response - The developer persona metadata for the user. +```json +{ + "object": "organization.project.service_account.deleted", + "id": "svc_acct_abc", + "deleted": true +} +``` - - `email: optional string` +## Domain Types - The email address of the user +### Project Service Account - - `is_default: optional boolean` +- `ProjectServiceAccount object { id, created_at, name, 2 more }` - Whether this is the organization's default user. + Represents an individual service account in a project. - - `is_scale_tier_authorized_purchaser: optional boolean` + - `id: string` - Whether the user is an authorized purchaser for Scale Tier. + The identifier, which can be referenced in API endpoints - - `is_scim_managed: optional boolean` + - `created_at: number` - Whether the user is managed through SCIM. + The Unix timestamp (in seconds) of when the service account was created - - `is_service_account: optional boolean` + - `name: string` - Whether the user is a service account. + The name of the service account - - `name: optional string` + - `object: "organization.project.service_account"` - The name of the user + The object type, which is always `organization.project.service_account` - - `projects: optional object { data, object }` + - `"organization.project.service_account"` - Projects associated with the user, if included. + - `role: "owner" or "member"` - - `data: array of object { id, name, role }` + `owner` or `member` - - `id: optional string` + - `"owner"` - - `name: optional string` + - `"member"` - - `role: optional string` +### Service Account Create Response - - `object: "list"` +- `ServiceAccountCreateResponse object { id, api_key, created_at, 3 more }` - - `"list"` + - `id: string` - - `role: optional string` + - `api_key: object { id, created_at, name, 2 more }` - `owner` or `reader` + - `id: string` - - `technical_level: optional string` + - `created_at: number` - The technical level metadata for the user. + - `name: string` - - `user: optional object { id, object, banned, 5 more }` + - `object: "organization.project.service_account.api_key"` - Nested user details. + The object type, which is always `organization.project.service_account.api_key` - - `id: string` + - `"organization.project.service_account.api_key"` - - `object: "user"` + - `value: string` - - `"user"` + - `created_at: number` - - `banned: optional boolean` + - `name: string` - - `banned_at: optional number` + - `object: "organization.project.service_account"` - - `email: optional string` + - `"organization.project.service_account"` - - `enabled: optional boolean` + - `role: "member"` - - `name: optional string` + Service accounts can only have one role of type `member` - - `picture: optional string` + - `"member"` -### Role Delete Response +### Service Account Delete Response -- `RoleDeleteResponse object { deleted, object }` +- `ServiceAccountDeleteResponse object { id, deleted, object }` - Confirmation payload returned after unassigning a role. + - `id: string` - `deleted: boolean` - Whether the assignment was removed. - - - `object: string` + - `object: "organization.project.service_account.deleted"` - Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + - `"organization.project.service_account.deleted"` -# Service Accounts +# API Keys -## List project service accounts +## List project API keys -**get** `/organization/projects/{project_id}/service_accounts` +**get** `/organization/projects/{project_id}/api_keys` -Returns a list of service accounts in the project. +Returns a list of API keys in the project. ### Path Parameters @@ -16399,7 +19818,7 @@ Returns a list of service accounts in the project. ### Returns -- `data: array of ProjectServiceAccount` +- `data: array of ProjectAPIKey` - `id: string` @@ -16407,218 +19826,190 @@ Returns a list of service accounts in the project. - `created_at: number` - The Unix timestamp (in seconds) of when the service account was created - - - `name: string` - - The name of the service account - - - `object: "organization.project.service_account"` - - The object type, which is always `organization.project.service_account` - - - `"organization.project.service_account"` + The Unix timestamp (in seconds) of when the API key was created - - `role: "owner" or "member"` + - `last_used_at: number` - `owner` or `member` + The Unix timestamp (in seconds) of when the API key was last used. - - `"owner"` + - `name: string` - - `"member"` + The name of the API key -- `has_more: boolean` + - `object: "organization.project.api_key"` -- `object: "list"` + The object type, which is always `organization.project.api_key` - - `"list"` + - `"organization.project.api_key"` -- `first_id: optional string` + - `owner: object { service_account, type, user }` -- `last_id: optional string` + - `service_account: optional object { id, created_at, name, role }` -### Example + The service account that owns a project API key. -```http -curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/service_accounts \ - -H "Authorization: Bearer $OPENAI_ADMIN_KEY" -``` + - `id: string` -#### Response + The identifier, which can be referenced in API endpoints -```json -{ - "data": [ - { - "id": "id", - "created_at": 0, - "name": "name", - "object": "organization.project.service_account", - "role": "owner" - } - ], - "has_more": true, - "object": "list", - "first_id": "first_id", - "last_id": "last_id" -} -``` + - `created_at: number` -### Example + The Unix timestamp (in seconds) of when the service account was created. -```http -curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts?after=custom_id&limit=20 \ - -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ - -H "Content-Type: application/json" -``` + - `name: string` -#### Response + The name of the service account. -```json -{ - "object": "list", - "data": [ - { - "object": "organization.project.service_account", - "id": "svc_acct_abc", - "name": "Service Account", - "role": "owner", - "created_at": 1711471533 - } - ], - "first_id": "svc_acct_abc", - "last_id": "svc_acct_xyz", - "has_more": false -} -``` + - `role: string` -## Create project service account + The service account's project role. -**post** `/organization/projects/{project_id}/service_accounts` + - `type: optional "user" or "service_account"` -Creates a new service account in the project. This also returns an unredacted API key for the service account. + `user` or `service_account` -### Path Parameters + - `"user"` -- `project_id: string` + - `"service_account"` -### Body Parameters + - `user: optional object { id, created_at, email, 2 more }` -- `name: string` + The user that owns a project API key. - The name of the service account being created. + - `id: string` -### Returns + The identifier, which can be referenced in API endpoints -- `id: string` + - `created_at: number` -- `api_key: object { id, created_at, name, 2 more }` + The Unix timestamp (in seconds) of when the user was created. - - `id: string` + - `email: string` - - `created_at: number` + The email address of the user. - `name: string` - - `object: "organization.project.service_account.api_key"` - - The object type, which is always `organization.project.service_account.api_key` + The name of the user. - - `"organization.project.service_account.api_key"` + - `role: string` - - `value: string` + The user's project role. -- `created_at: number` + - `redacted_value: string` -- `name: string` + The redacted value of the API key -- `object: "organization.project.service_account"` +- `has_more: boolean` - - `"organization.project.service_account"` +- `object: "list"` -- `role: "member"` + - `"list"` - Service accounts can only have one role of type `member` +- `first_id: optional string` - - `"member"` +- `last_id: optional string` ### Example ```http -curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/service_accounts \ - -H 'Content-Type: application/json' \ - -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ - -d '{ - "name": "name" - }' +curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/api_keys \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" ``` #### Response ```json { + "data": [ + { "id": "id", - "api_key": { + "created_at": 0, + "last_used_at": 0, + "name": "name", + "object": "organization.project.api_key", + "owner": { + "service_account": { "id": "id", "created_at": 0, "name": "name", - "object": "organization.project.service_account.api_key", - "value": "value" + "role": "role" }, + "type": "user", + "user": { + "id": "id", "created_at": 0, + "email": "email", "name": "name", - "object": "organization.project.service_account", - "role": "member" + "role": "role" + } + }, + "redacted_value": "redacted_value" + } + ], + "has_more": true, + "object": "list", + "first_id": "first_id", + "last_id": "last_id" } ``` ### Example ```http -curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/service_accounts \ +curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys?after=key_abc&limit=20 \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "name": "Production App" - }' + -H "Content-Type: application/json" ``` #### Response ```json { - "object": "organization.project.service_account", - "id": "svc_acct_abc", - "name": "Production App", - "role": "member", - "created_at": 1711471533, - "api_key": { - "object": "organization.project.service_account.api_key", - "value": "sk-abcdefghijklmnop123", - "name": "Secret Key", + "object": "list", + "data": [ + { + "object": "organization.project.api_key", + "redacted_value": "sk-abc...def", + "name": "My API Key", "created_at": 1711471533, - "id": "key_abc" + "last_used_at": 1711471534, + "id": "key_abc", + "owner": { + "type": "user", + "user": { + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "created_at": 1711471533 + } + } } + ], + "first_id": "key_abc", + "last_id": "key_xyz", + "has_more": false } ``` -## Retrieve project service account +## Retrieve project API key -**get** `/organization/projects/{project_id}/service_accounts/{service_account_id}` +**get** `/organization/projects/{project_id}/api_keys/{api_key_id}` -Retrieves a service account in the project. +Retrieves an API key in the project. ### Path Parameters - `project_id: string` -- `service_account_id: string` +- `api_key_id: string` ### Returns -- `ProjectServiceAccount object { id, created_at, name, 2 more }` +- `ProjectAPIKey object { id, created_at, last_used_at, 4 more }` - Represents an individual service account in a project. + Represents an individual API key in a project. - `id: string` @@ -16626,95 +20017,84 @@ Retrieves a service account in the project. - `created_at: number` - The Unix timestamp (in seconds) of when the service account was created + The Unix timestamp (in seconds) of when the API key was created + + - `last_used_at: number` + + The Unix timestamp (in seconds) of when the API key was last used. - `name: string` - The name of the service account + The name of the API key - - `object: "organization.project.service_account"` + - `object: "organization.project.api_key"` - The object type, which is always `organization.project.service_account` + The object type, which is always `organization.project.api_key` - - `"organization.project.service_account"` + - `"organization.project.api_key"` - - `role: "owner" or "member"` + - `owner: object { service_account, type, user }` - `owner` or `member` + - `service_account: optional object { id, created_at, name, role }` - - `"owner"` + The service account that owns a project API key. - - `"member"` + - `id: string` -### Example + The identifier, which can be referenced in API endpoints -```http -curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/service_accounts/$SERVICE_ACCOUNT_ID \ - -H "Authorization: Bearer $OPENAI_ADMIN_KEY" -``` + - `created_at: number` -#### Response + The Unix timestamp (in seconds) of when the service account was created. -```json -{ - "id": "id", - "created_at": 0, - "name": "name", - "object": "organization.project.service_account", - "role": "owner" -} -``` + - `name: string` -### Example + The name of the service account. -```http -curl https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \ - -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ - -H "Content-Type: application/json" -``` + - `role: string` -#### Response + The service account's project role. -```json -{ - "object": "organization.project.service_account", - "id": "svc_acct_abc", - "name": "Service Account", - "role": "owner", - "created_at": 1711471533 -} -``` + - `type: optional "user" or "service_account"` -## Delete project service account + `user` or `service_account` -**delete** `/organization/projects/{project_id}/service_accounts/{service_account_id}` + - `"user"` -Deletes a service account from the project. + - `"service_account"` -Returns confirmation of service account deletion, or an error if the project -is archived (archived projects have no service accounts). + - `user: optional object { id, created_at, email, 2 more }` -### Path Parameters + The user that owns a project API key. -- `project_id: string` + - `id: string` -- `service_account_id: string` + The identifier, which can be referenced in API endpoints -### Returns + - `created_at: number` -- `id: string` + The Unix timestamp (in seconds) of when the user was created. -- `deleted: boolean` + - `email: string` -- `object: "organization.project.service_account.deleted"` + The email address of the user. - - `"organization.project.service_account.deleted"` + - `name: string` + + The name of the user. + + - `role: string` + + The user's project role. + + - `redacted_value: string` + + The redacted value of the API key ### Example ```http -curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/service_accounts/$SERVICE_ACCOUNT_ID \ - -X DELETE \ +curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/api_keys/$API_KEY_ID \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" ``` @@ -16723,15 +20103,34 @@ curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/service_account ```json { "id": "id", - "deleted": true, - "object": "organization.project.service_account.deleted" + "created_at": 0, + "last_used_at": 0, + "name": "name", + "object": "organization.project.api_key", + "owner": { + "service_account": { + "id": "id", + "created_at": 0, + "name": "name", + "role": "role" + }, + "type": "user", + "user": { + "id": "id", + "created_at": 0, + "email": "email", + "name": "name", + "role": "role" + } + }, + "redacted_value": "redacted_value" } ``` ### Example ```http -curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc \ +curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ``` @@ -16740,119 +20139,93 @@ curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/service_ ```json { - "object": "organization.project.service_account.deleted", - "id": "svc_acct_abc", - "deleted": true + "object": "organization.project.api_key", + "redacted_value": "sk-abc...def", + "name": "My API Key", + "created_at": 1711471533, + "last_used_at": 1711471534, + "id": "key_abc", + "owner": { + "type": "user", + "user": { + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "created_at": 1711471533 + } + } } ``` -## Domain Types - -### Project Service Account - -- `ProjectServiceAccount object { id, created_at, name, 2 more }` - - Represents an individual service account in a project. - - - `id: string` - - The identifier, which can be referenced in API endpoints - - - `created_at: number` - - The Unix timestamp (in seconds) of when the service account was created - - - `name: string` - - The name of the service account - - - `object: "organization.project.service_account"` - - The object type, which is always `organization.project.service_account` - - - `"organization.project.service_account"` - - - `role: "owner" or "member"` - - `owner` or `member` - - - `"owner"` - - - `"member"` - -### Service Account Create Response - -- `ServiceAccountCreateResponse object { id, api_key, created_at, 3 more }` - - - `id: string` - - - `api_key: object { id, created_at, name, 2 more }` - - - `id: string` - - - `created_at: number` - - - `name: string` - - - `object: "organization.project.service_account.api_key"` - - The object type, which is always `organization.project.service_account.api_key` - - - `"organization.project.service_account.api_key"` - - - `value: string` - - - `created_at: number` - - - `name: string` - - - `object: "organization.project.service_account"` +## Delete project API key - - `"organization.project.service_account"` +**delete** `/organization/projects/{project_id}/api_keys/{api_key_id}` - - `role: "member"` +Deletes an API key from the project. - Service accounts can only have one role of type `member` +Returns confirmation of the key deletion, or an error if the key belonged to +a service account. - - `"member"` +### Path Parameters -### Service Account Delete Response +- `project_id: string` -- `ServiceAccountDeleteResponse object { id, deleted, object }` +- `api_key_id: string` - - `id: string` +### Returns - - `deleted: boolean` +- `id: string` - - `object: "organization.project.service_account.deleted"` +- `deleted: boolean` - - `"organization.project.service_account.deleted"` +- `object: "organization.project.api_key.deleted"` -# API Keys + - `"organization.project.api_key.deleted"` -## List project API keys +### Example -**get** `/organization/projects/{project_id}/api_keys` +```http +curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/api_keys/$API_KEY_ID \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" +``` -Returns a list of API keys in the project. +#### Response -### Path Parameters +```json +{ + "id": "id", + "deleted": true, + "object": "organization.project.api_key.deleted" +} +``` -- `project_id: string` +### Example -### Query Parameters +```http +curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" +``` -- `after: optional string` +#### Response - A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. +```json +{ + "object": "organization.project.api_key.deleted", + "id": "key_abc", + "deleted": true +} +``` -- `limit: optional number` +## Domain Types - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. +### Project API Key -### Returns +- `ProjectAPIKey object { id, created_at, last_used_at, 4 more }` -- `data: array of ProjectAPIKey` + Represents an individual API key in a project. - `id: string` @@ -16934,6 +20307,86 @@ Returns a list of API keys in the project. The redacted value of the API key +### API Key Delete Response + +- `APIKeyDeleteResponse object { id, deleted, object }` + + - `id: string` + + - `deleted: boolean` + + - `object: "organization.project.api_key.deleted"` + + - `"organization.project.api_key.deleted"` + +# Rate Limits + +## List project rate limits + +**get** `/organization/projects/{project_id}/rate_limits` + +Returns the rate limits per model for a project. + +### Path Parameters + +- `project_id: string` + +### Query Parameters + +- `after: optional string` + + A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + +- `before: optional string` + + A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, beginning with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + +- `limit: optional number` + + A limit on the number of objects to be returned. The default is 100. + +### Returns + +- `data: array of ProjectRateLimit` + + - `id: string` + + The identifier, which can be referenced in API endpoints. + + - `max_requests_per_1_minute: number` + + The maximum requests per minute. + + - `max_tokens_per_1_minute: number` + + The maximum tokens per minute. + + - `model: string` + + The model this rate limit applies to. + + - `object: "project.rate_limit"` + + The object type, which is always `project.rate_limit` + + - `"project.rate_limit"` + + - `batch_1_day_max_input_tokens: optional number` + + The maximum batch input tokens per day. Only present for relevant models. + + - `max_audio_megabytes_per_1_minute: optional number` + + The maximum audio megabytes per minute. Only present for relevant models. + + - `max_images_per_1_minute: optional number` + + The maximum images per minute. Only present for relevant models. + + - `max_requests_per_1_day: optional number` + + The maximum requests per day. Only present for relevant models. + - `has_more: boolean` - `object: "list"` @@ -16947,7 +20400,7 @@ Returns a list of API keys in the project. ### Example ```http -curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/api_keys \ +curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/rate_limits \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" ``` @@ -16958,27 +20411,14 @@ curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/api_keys \ "data": [ { "id": "id", - "created_at": 0, - "last_used_at": 0, - "name": "name", - "object": "organization.project.api_key", - "owner": { - "service_account": { - "id": "id", - "created_at": 0, - "name": "name", - "role": "role" - }, - "type": "user", - "user": { - "id": "id", - "created_at": 0, - "email": "email", - "name": "name", - "role": "role" - } - }, - "redacted_value": "redacted_value" + "max_requests_per_1_minute": 0, + "max_tokens_per_1_minute": 0, + "model": "model", + "object": "project.rate_limit", + "batch_1_day_max_input_tokens": 0, + "max_audio_megabytes_per_1_minute": 0, + "max_images_per_1_minute": 0, + "max_requests_per_1_day": 0 } ], "has_more": true, @@ -16991,144 +20431,249 @@ curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/api_keys \ ### Example ```http -curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys?after=key_abc&limit=20 \ +curl https://api.openai.com/v1/organization/projects/proj_abc/rate_limits?after=rl_xxx&limit=20 \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" +``` + +#### Response + +```json +{ + "object": "list", + "data": [ + { + "object": "project.rate_limit", + "id": "rl-ada", + "model": "ada", + "max_requests_per_1_minute": 600, + "max_tokens_per_1_minute": 150000, + "max_images_per_1_minute": 10 + } + ], + "first_id": "rl-ada", + "last_id": "rl-ada", + "has_more": false +} +``` + +## Modify project rate limit + +**post** `/organization/projects/{project_id}/rate_limits/{rate_limit_id}` + +Updates a project rate limit. + +### Path Parameters + +- `project_id: string` + +- `rate_limit_id: string` + +### Body Parameters + +- `batch_1_day_max_input_tokens: optional number` + + The maximum batch input tokens per day. Only relevant for certain models. + +- `max_audio_megabytes_per_1_minute: optional number` + + The maximum audio megabytes per minute. Only relevant for certain models. + +- `max_images_per_1_minute: optional number` + + The maximum images per minute. Only relevant for certain models. + +- `max_requests_per_1_day: optional number` + + The maximum requests per day. Only relevant for certain models. + +- `max_requests_per_1_minute: optional number` + + The maximum requests per minute. + +- `max_tokens_per_1_minute: optional number` + + The maximum tokens per minute. + +### Returns + +- `ProjectRateLimit object { id, max_requests_per_1_minute, max_tokens_per_1_minute, 6 more }` + + Represents a project rate limit config. + + - `id: string` + + The identifier, which can be referenced in API endpoints. + + - `max_requests_per_1_minute: number` + + The maximum requests per minute. + + - `max_tokens_per_1_minute: number` + + The maximum tokens per minute. + + - `model: string` + + The model this rate limit applies to. + + - `object: "project.rate_limit"` + + The object type, which is always `project.rate_limit` + + - `"project.rate_limit"` + + - `batch_1_day_max_input_tokens: optional number` + + The maximum batch input tokens per day. Only present for relevant models. + + - `max_audio_megabytes_per_1_minute: optional number` + + The maximum audio megabytes per minute. Only present for relevant models. + + - `max_images_per_1_minute: optional number` + + The maximum images per minute. Only present for relevant models. + + - `max_requests_per_1_day: optional number` + + The maximum requests per day. Only present for relevant models. + +### Example + +```http +curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/rate_limits/$RATE_LIMIT_ID \ + -H 'Content-Type: application/json' \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ - -H "Content-Type: application/json" + -d '{}' ``` #### Response ```json { - "object": "list", - "data": [ - { - "object": "organization.project.api_key", - "redacted_value": "sk-abc...def", - "name": "My API Key", - "created_at": 1711471533, - "last_used_at": 1711471534, - "id": "key_abc", - "owner": { - "type": "user", - "user": { - "id": "user_abc", - "name": "First Last", - "email": "user@example.com", - "role": "owner", - "created_at": 1711471533 - } - } - } - ], - "first_id": "key_abc", - "last_id": "key_xyz", - "has_more": false + "id": "id", + "max_requests_per_1_minute": 0, + "max_tokens_per_1_minute": 0, + "model": "model", + "object": "project.rate_limit", + "batch_1_day_max_input_tokens": 0, + "max_audio_megabytes_per_1_minute": 0, + "max_images_per_1_minute": 0, + "max_requests_per_1_day": 0 } ``` -## Retrieve project API key - -**get** `/organization/projects/{project_id}/api_keys/{api_key_id}` +### Example -Retrieves an API key in the project. +```http +curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/rate_limits/rl_xxx \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "max_requests_per_1_minute": 500 + }' +``` -### Path Parameters +#### Response -- `project_id: string` +```json +{ + "object": "project.rate_limit", + "id": "rl-ada", + "model": "ada", + "max_requests_per_1_minute": 600, + "max_tokens_per_1_minute": 150000, + "max_images_per_1_minute": 10 + } +``` -- `api_key_id: string` +## Domain Types -### Returns +### Project Rate Limit -- `ProjectAPIKey object { id, created_at, last_used_at, 4 more }` +- `ProjectRateLimit object { id, max_requests_per_1_minute, max_tokens_per_1_minute, 6 more }` - Represents an individual API key in a project. + Represents a project rate limit config. - `id: string` - The identifier, which can be referenced in API endpoints - - - `created_at: number` - - The Unix timestamp (in seconds) of when the API key was created - - - `last_used_at: number` + The identifier, which can be referenced in API endpoints. - The Unix timestamp (in seconds) of when the API key was last used. + - `max_requests_per_1_minute: number` - - `name: string` + The maximum requests per minute. - The name of the API key + - `max_tokens_per_1_minute: number` - - `object: "organization.project.api_key"` + The maximum tokens per minute. - The object type, which is always `organization.project.api_key` + - `model: string` - - `"organization.project.api_key"` + The model this rate limit applies to. - - `owner: object { service_account, type, user }` + - `object: "project.rate_limit"` - - `service_account: optional object { id, created_at, name, role }` + The object type, which is always `project.rate_limit` - The service account that owns a project API key. + - `"project.rate_limit"` - - `id: string` + - `batch_1_day_max_input_tokens: optional number` - The identifier, which can be referenced in API endpoints + The maximum batch input tokens per day. Only present for relevant models. - - `created_at: number` + - `max_audio_megabytes_per_1_minute: optional number` - The Unix timestamp (in seconds) of when the service account was created. + The maximum audio megabytes per minute. Only present for relevant models. - - `name: string` + - `max_images_per_1_minute: optional number` - The name of the service account. + The maximum images per minute. Only present for relevant models. - - `role: string` + - `max_requests_per_1_day: optional number` - The service account's project role. + The maximum requests per day. Only present for relevant models. - - `type: optional "user" or "service_account"` +# Model Permissions - `user` or `service_account` +## Retrieve project model permissions - - `"user"` +**get** `/organization/projects/{project_id}/model_permissions` - - `"service_account"` +Returns model permissions for a project. - - `user: optional object { id, created_at, email, 2 more }` +### Path Parameters - The user that owns a project API key. +- `project_id: string` - - `id: string` +### Returns - The identifier, which can be referenced in API endpoints +- `ProjectModelPermissions object { mode, model_ids, object }` - - `created_at: number` + Represents the model allowlist or denylist policy for a project. - The Unix timestamp (in seconds) of when the user was created. + - `mode: "allow_list" or "deny_list"` - - `email: string` + Whether the project uses an allowlist or a denylist. - The email address of the user. + - `"allow_list"` - - `name: string` + - `"deny_list"` - The name of the user. + - `model_ids: array of string` - - `role: string` + The model IDs included in the model permissions policy. - The user's project role. + - `object: "project.model_permissions"` - - `redacted_value: string` + The object type, which is always `project.model_permissions`. - The redacted value of the API key + - `"project.model_permissions"` ### Example ```http -curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/api_keys/$API_KEY_ID \ +curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/model_permissions \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" ``` @@ -17136,35 +20681,18 @@ curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/api_keys/$API_K ```json { - "id": "id", - "created_at": 0, - "last_used_at": 0, - "name": "name", - "object": "organization.project.api_key", - "owner": { - "service_account": { - "id": "id", - "created_at": 0, - "name": "name", - "role": "role" - }, - "type": "user", - "user": { - "id": "id", - "created_at": 0, - "email": "email", - "name": "name", - "role": "role" - } - }, - "redacted_value": "redacted_value" + "mode": "allow_list", + "model_ids": [ + "string" + ], + "object": "project.model_permissions" } ``` ### Example ```http -curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \ +curl https://api.openai.com/v1/organization/projects/proj_abc/model_permissions \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ``` @@ -17173,268 +20701,279 @@ curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \ ```json { - "object": "organization.project.api_key", - "redacted_value": "sk-abc...def", - "name": "My API Key", - "created_at": 1711471533, - "last_used_at": 1711471534, - "id": "key_abc", - "owner": { - "type": "user", - "user": { - "id": "user_abc", - "name": "First Last", - "email": "user@example.com", - "role": "owner", - "created_at": 1711471533 - } - } + "object": "project.model_permissions", + "mode": "allow_list", + "model_ids": [ + "gpt-4.1", + "o3" + ] } ``` -## Delete project API key - -**delete** `/organization/projects/{project_id}/api_keys/{api_key_id}` +## Modify project model permissions -Deletes an API key from the project. +**post** `/organization/projects/{project_id}/model_permissions` -Returns confirmation of the key deletion, or an error if the key belonged to -a service account. +Updates model permissions for a project. ### Path Parameters - `project_id: string` -- `api_key_id: string` +### Body Parameters + +- `mode: "allow_list" or "deny_list"` + + The model permissions mode to apply. + + - `"allow_list"` + + - `"deny_list"` + +- `model_ids: array of string` + + The model IDs included in this permissions policy. ### Returns -- `id: string` +- `ProjectModelPermissions object { mode, model_ids, object }` -- `deleted: boolean` + Represents the model allowlist or denylist policy for a project. -- `object: "organization.project.api_key.deleted"` + - `mode: "allow_list" or "deny_list"` - - `"organization.project.api_key.deleted"` + Whether the project uses an allowlist or a denylist. -### Example + - `"allow_list"` -```http -curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/api_keys/$API_KEY_ID \ - -X DELETE \ - -H "Authorization: Bearer $OPENAI_ADMIN_KEY" -``` + - `"deny_list"` -#### Response + - `model_ids: array of string` -```json -{ - "id": "id", - "deleted": true, - "object": "organization.project.api_key.deleted" -} -``` + The model IDs included in the model permissions policy. + + - `object: "project.model_permissions"` + + The object type, which is always `project.model_permissions`. + + - `"project.model_permissions"` ### Example ```http -curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \ +curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/model_permissions \ + -H 'Content-Type: application/json' \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ - -H "Content-Type: application/json" + -d '{ + "mode": "allow_list", + "model_ids": [ + "string" + ] + }' ``` #### Response ```json { - "object": "organization.project.api_key.deleted", - "id": "key_abc", - "deleted": true + "mode": "allow_list", + "model_ids": [ + "string" + ], + "object": "project.model_permissions" } ``` -## Domain Types - -### Project API Key - -- `ProjectAPIKey object { id, created_at, last_used_at, 4 more }` - - Represents an individual API key in a project. - - - `id: string` - - The identifier, which can be referenced in API endpoints - - - `created_at: number` - - The Unix timestamp (in seconds) of when the API key was created - - - `last_used_at: number` - - The Unix timestamp (in seconds) of when the API key was last used. - - - `name: string` - - The name of the API key +### Example - - `object: "organization.project.api_key"` +```http +curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/model_permissions \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "mode": "deny_list", + "model_ids": [ + "o3" + ] + }' +``` - The object type, which is always `organization.project.api_key` +#### Response - - `"organization.project.api_key"` +```json +{ + "object": "project.model_permissions", + "mode": "deny_list", + "model_ids": [ + "o3" + ] +} +``` - - `owner: object { service_account, type, user }` +## Delete project model permissions - - `service_account: optional object { id, created_at, name, role }` +**delete** `/organization/projects/{project_id}/model_permissions` - The service account that owns a project API key. +Deletes model permissions for a project. - - `id: string` +### Path Parameters - The identifier, which can be referenced in API endpoints +- `project_id: string` - - `created_at: number` +### Returns - The Unix timestamp (in seconds) of when the service account was created. +- `ProjectModelPermissionsDeleted object { deleted, object }` - - `name: string` + Confirmation payload returned after deleting project model permissions. - The name of the service account. + - `deleted: boolean` - - `role: string` + Whether the project model permissions were deleted. - The service account's project role. + - `object: "project.model_permissions.deleted"` - - `type: optional "user" or "service_account"` + The object type, which is always `project.model_permissions.deleted`. - `user` or `service_account` + - `"project.model_permissions.deleted"` - - `"user"` +### Example - - `"service_account"` +```http +curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/model_permissions \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" +``` - - `user: optional object { id, created_at, email, 2 more }` +#### Response - The user that owns a project API key. +```json +{ + "deleted": true, + "object": "project.model_permissions.deleted" +} +``` - - `id: string` +### Example - The identifier, which can be referenced in API endpoints +```http +curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/model_permissions \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" +``` - - `created_at: number` +#### Response - The Unix timestamp (in seconds) of when the user was created. +```json +{ + "object": "project.model_permissions.deleted", + "deleted": true +} +``` - - `email: string` +## Domain Types - The email address of the user. +### Project Model Permissions - - `name: string` +- `ProjectModelPermissions object { mode, model_ids, object }` - The name of the user. + Represents the model allowlist or denylist policy for a project. - - `role: string` + - `mode: "allow_list" or "deny_list"` - The user's project role. + Whether the project uses an allowlist or a denylist. - - `redacted_value: string` + - `"allow_list"` - The redacted value of the API key + - `"deny_list"` -### API Key Delete Response + - `model_ids: array of string` -- `APIKeyDeleteResponse object { id, deleted, object }` + The model IDs included in the model permissions policy. - - `id: string` + - `object: "project.model_permissions"` - - `deleted: boolean` + The object type, which is always `project.model_permissions`. - - `object: "organization.project.api_key.deleted"` + - `"project.model_permissions"` - - `"organization.project.api_key.deleted"` +### Project Model Permissions Deleted -# Rate Limits +- `ProjectModelPermissionsDeleted object { deleted, object }` -## List project rate limits + Confirmation payload returned after deleting project model permissions. -**get** `/organization/projects/{project_id}/rate_limits` + - `deleted: boolean` -Returns the rate limits per model for a project. + Whether the project model permissions were deleted. -### Path Parameters + - `object: "project.model_permissions.deleted"` -- `project_id: string` + The object type, which is always `project.model_permissions.deleted`. -### Query Parameters + - `"project.model_permissions.deleted"` -- `after: optional string` +# Hosted Tool Permissions - A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. +## Retrieve project hosted tool permissions -- `before: optional string` +**get** `/organization/projects/{project_id}/hosted_tool_permissions` - A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, beginning with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. +Returns hosted tool permissions for a project. -- `limit: optional number` +### Path Parameters - A limit on the number of objects to be returned. The default is 100. +- `project_id: string` ### Returns -- `data: array of ProjectRateLimit` - - - `id: string` - - The identifier, which can be referenced in API endpoints. - - - `max_requests_per_1_minute: number` +- `ProjectHostedToolPermissions object { code_interpreter, file_search, image_generation, 2 more }` - The maximum requests per minute. + Represents hosted tool permissions for a project. - - `max_tokens_per_1_minute: number` + - `code_interpreter: object { enabled }` - The maximum tokens per minute. + Permission state for a single hosted tool on a project. - - `model: string` + - `enabled: boolean` - The model this rate limit applies to. + Whether the hosted tool is enabled for the project. - - `object: "project.rate_limit"` + - `file_search: object { enabled }` - The object type, which is always `project.rate_limit` + Permission state for a single hosted tool on a project. - - `"project.rate_limit"` + - `enabled: boolean` - - `batch_1_day_max_input_tokens: optional number` + Whether the hosted tool is enabled for the project. - The maximum batch input tokens per day. Only present for relevant models. + - `image_generation: object { enabled }` - - `max_audio_megabytes_per_1_minute: optional number` + Permission state for a single hosted tool on a project. - The maximum audio megabytes per minute. Only present for relevant models. + - `enabled: boolean` - - `max_images_per_1_minute: optional number` + Whether the hosted tool is enabled for the project. - The maximum images per minute. Only present for relevant models. + - `mcp: object { enabled }` - - `max_requests_per_1_day: optional number` + Permission state for a single hosted tool on a project. - The maximum requests per day. Only present for relevant models. + - `enabled: boolean` -- `has_more: boolean` + Whether the hosted tool is enabled for the project. -- `object: "list"` + - `web_search: object { enabled }` - - `"list"` + Permission state for a single hosted tool on a project. -- `first_id: optional string` + - `enabled: boolean` -- `last_id: optional string` + Whether the hosted tool is enabled for the project. ### Example ```http -curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/rate_limits \ +curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/hosted_tool_permissions \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" ``` @@ -17442,30 +20981,28 @@ curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/rate_limits \ ```json { - "data": [ - { - "id": "id", - "max_requests_per_1_minute": 0, - "max_tokens_per_1_minute": 0, - "model": "model", - "object": "project.rate_limit", - "batch_1_day_max_input_tokens": 0, - "max_audio_megabytes_per_1_minute": 0, - "max_images_per_1_minute": 0, - "max_requests_per_1_day": 0 + "code_interpreter": { + "enabled": true + }, + "file_search": { + "enabled": true + }, + "image_generation": { + "enabled": true + }, + "mcp": { + "enabled": true + }, + "web_search": { + "enabled": true } - ], - "has_more": true, - "object": "list", - "first_id": "first_id", - "last_id": "last_id" } ``` ### Example ```http -curl https://api.openai.com/v1/organization/projects/proj_abc/rate_limits?after=rl_xxx&limit=20 \ +curl https://api.openai.com/v1/organization/projects/proj_abc/hosted_tool_permissions \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ``` @@ -17474,109 +21011,126 @@ curl https://api.openai.com/v1/organization/projects/proj_abc/rate_limits?after= ```json { - "object": "list", - "data": [ - { - "object": "project.rate_limit", - "id": "rl-ada", - "model": "ada", - "max_requests_per_1_minute": 600, - "max_tokens_per_1_minute": 150000, - "max_images_per_1_minute": 10 + "file_search": { + "enabled": true + }, + "web_search": { + "enabled": true + }, + "image_generation": { + "enabled": true + }, + "mcp": { + "enabled": true + }, + "code_interpreter": { + "enabled": true } - ], - "first_id": "rl-ada", - "last_id": "rl-ada", - "has_more": false } ``` -## Modify project rate limit +## Modify project hosted tool permissions -**post** `/organization/projects/{project_id}/rate_limits/{rate_limit_id}` +**post** `/organization/projects/{project_id}/hosted_tool_permissions` -Updates a project rate limit. +Updates hosted tool permissions for a project. ### Path Parameters - `project_id: string` -- `rate_limit_id: string` - ### Body Parameters -- `batch_1_day_max_input_tokens: optional number` +- `code_interpreter: optional object { enabled }` - The maximum batch input tokens per day. Only relevant for certain models. + The code interpreter permission update. -- `max_audio_megabytes_per_1_minute: optional number` + - `enabled: boolean` - The maximum audio megabytes per minute. Only relevant for certain models. + Whether to enable the hosted tool for the project. -- `max_images_per_1_minute: optional number` +- `file_search: optional object { enabled }` - The maximum images per minute. Only relevant for certain models. + The file search permission update. -- `max_requests_per_1_day: optional number` + - `enabled: boolean` - The maximum requests per day. Only relevant for certain models. + Whether to enable the hosted tool for the project. -- `max_requests_per_1_minute: optional number` +- `image_generation: optional object { enabled }` - The maximum requests per minute. + The image generation permission update. -- `max_tokens_per_1_minute: optional number` + - `enabled: boolean` - The maximum tokens per minute. + Whether to enable the hosted tool for the project. + +- `mcp: optional object { enabled }` + + The MCP permission update. + + - `enabled: boolean` + + Whether to enable the hosted tool for the project. + +- `web_search: optional object { enabled }` + + The web search permission update. + + - `enabled: boolean` + + Whether to enable the hosted tool for the project. ### Returns -- `ProjectRateLimit object { id, max_requests_per_1_minute, max_tokens_per_1_minute, 6 more }` +- `ProjectHostedToolPermissions object { code_interpreter, file_search, image_generation, 2 more }` - Represents a project rate limit config. + Represents hosted tool permissions for a project. - - `id: string` + - `code_interpreter: object { enabled }` - The identifier, which can be referenced in API endpoints. + Permission state for a single hosted tool on a project. - - `max_requests_per_1_minute: number` + - `enabled: boolean` - The maximum requests per minute. + Whether the hosted tool is enabled for the project. - - `max_tokens_per_1_minute: number` + - `file_search: object { enabled }` - The maximum tokens per minute. + Permission state for a single hosted tool on a project. - - `model: string` + - `enabled: boolean` - The model this rate limit applies to. + Whether the hosted tool is enabled for the project. - - `object: "project.rate_limit"` + - `image_generation: object { enabled }` - The object type, which is always `project.rate_limit` + Permission state for a single hosted tool on a project. - - `"project.rate_limit"` + - `enabled: boolean` - - `batch_1_day_max_input_tokens: optional number` + Whether the hosted tool is enabled for the project. - The maximum batch input tokens per day. Only present for relevant models. + - `mcp: object { enabled }` - - `max_audio_megabytes_per_1_minute: optional number` + Permission state for a single hosted tool on a project. - The maximum audio megabytes per minute. Only present for relevant models. + - `enabled: boolean` - - `max_images_per_1_minute: optional number` + Whether the hosted tool is enabled for the project. - The maximum images per minute. Only present for relevant models. + - `web_search: object { enabled }` - - `max_requests_per_1_day: optional number` + Permission state for a single hosted tool on a project. - The maximum requests per day. Only present for relevant models. + - `enabled: boolean` + + Whether the hosted tool is enabled for the project. ### Example ```http -curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/rate_limits/$RATE_LIMIT_ID \ +curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/hosted_tool_permissions \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -d '{}' @@ -17586,26 +21140,37 @@ curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/rate_limits/$RA ```json { - "id": "id", - "max_requests_per_1_minute": 0, - "max_tokens_per_1_minute": 0, - "model": "model", - "object": "project.rate_limit", - "batch_1_day_max_input_tokens": 0, - "max_audio_megabytes_per_1_minute": 0, - "max_images_per_1_minute": 0, - "max_requests_per_1_day": 0 + "code_interpreter": { + "enabled": true + }, + "file_search": { + "enabled": true + }, + "image_generation": { + "enabled": true + }, + "mcp": { + "enabled": true + }, + "web_search": { + "enabled": true + } } ``` ### Example ```http -curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/rate_limits/rl_xxx \ +curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/hosted_tool_permissions \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" \ -d '{ - "max_requests_per_1_minute": 500 + "file_search": { + "enabled": true + }, + "image_generation": { + "enabled": false + } }' ``` @@ -17613,60 +21178,71 @@ curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/rate_limit ```json { - "object": "project.rate_limit", - "id": "rl-ada", - "model": "ada", - "max_requests_per_1_minute": 600, - "max_tokens_per_1_minute": 150000, - "max_images_per_1_minute": 10 + "file_search": { + "enabled": true + }, + "web_search": { + "enabled": true + }, + "image_generation": { + "enabled": false + }, + "mcp": { + "enabled": true + }, + "code_interpreter": { + "enabled": true } +} ``` ## Domain Types -### Project Rate Limit +### Project Hosted Tool Permissions -- `ProjectRateLimit object { id, max_requests_per_1_minute, max_tokens_per_1_minute, 6 more }` +- `ProjectHostedToolPermissions object { code_interpreter, file_search, image_generation, 2 more }` - Represents a project rate limit config. + Represents hosted tool permissions for a project. - - `id: string` + - `code_interpreter: object { enabled }` - The identifier, which can be referenced in API endpoints. + Permission state for a single hosted tool on a project. - - `max_requests_per_1_minute: number` + - `enabled: boolean` - The maximum requests per minute. + Whether the hosted tool is enabled for the project. - - `max_tokens_per_1_minute: number` + - `file_search: object { enabled }` - The maximum tokens per minute. + Permission state for a single hosted tool on a project. - - `model: string` + - `enabled: boolean` - The model this rate limit applies to. + Whether the hosted tool is enabled for the project. - - `object: "project.rate_limit"` + - `image_generation: object { enabled }` - The object type, which is always `project.rate_limit` + Permission state for a single hosted tool on a project. - - `"project.rate_limit"` + - `enabled: boolean` - - `batch_1_day_max_input_tokens: optional number` + Whether the hosted tool is enabled for the project. - The maximum batch input tokens per day. Only present for relevant models. + - `mcp: object { enabled }` - - `max_audio_megabytes_per_1_minute: optional number` + Permission state for a single hosted tool on a project. - The maximum audio megabytes per minute. Only present for relevant models. + - `enabled: boolean` - - `max_images_per_1_minute: optional number` + Whether the hosted tool is enabled for the project. - The maximum images per minute. Only present for relevant models. + - `web_search: object { enabled }` - - `max_requests_per_1_day: optional number` + Permission state for a single hosted tool on a project. - The maximum requests per day. Only present for relevant models. + - `enabled: boolean` + + Whether the hosted tool is enabled for the project. # Groups