diff --git a/en/ruby/resources/admin/index.md b/en/ruby/resources/admin/index.md index 6a5ff34..b7582e1 100644 --- a/en/ruby/resources/admin/index.md +++ b/en/ruby/resources/admin/index.md @@ -2771,7 +2771,7 @@ Get audio speeches usage details for the organization. - `:bucket` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -3029,6 +3029,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. + - `class OrganizationUsageFileSearchesResult` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: Integer` + + The count of file search calls. + + - `object: :"organization.usage.file_searches.result"` + + - `:"organization.usage.file_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: String` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: Integer` + + The count of model requests. + + - `num_requests: Integer` + + The count of web search calls. + + - `object: :"organization.usage.web_searches.result"` + + - `:"organization.usage.web_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: String` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: String` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `class OrganizationCostsResult` The aggregated costs details of the specific time bucket. @@ -3201,7 +3265,7 @@ Get audio transcriptions usage details for the organization. - `:bucket` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -3459,6 +3523,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. + - `class OrganizationUsageFileSearchesResult` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: Integer` + + The count of file search calls. + + - `object: :"organization.usage.file_searches.result"` + + - `:"organization.usage.file_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: String` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: Integer` + + The count of model requests. + + - `num_requests: Integer` + + The count of web search calls. + + - `object: :"organization.usage.web_searches.result"` + + - `:"organization.usage.web_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: String` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: String` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `class OrganizationCostsResult` The aggregated costs details of the specific time bucket. @@ -3613,7 +3741,7 @@ Get code interpreter sessions usage details for the organization. - `:bucket` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -3871,6 +3999,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. + - `class OrganizationUsageFileSearchesResult` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: Integer` + + The count of file search calls. + + - `object: :"organization.usage.file_searches.result"` + + - `:"organization.usage.file_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: String` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: Integer` + + The count of model requests. + + - `num_requests: Integer` + + The count of web search calls. + + - `object: :"organization.usage.web_searches.result"` + + - `:"organization.usage.web_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: String` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: String` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `class OrganizationCostsResult` The aggregated costs details of the specific time bucket. @@ -4051,7 +4243,7 @@ Get completions usage details for the organization. - `:bucket` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -4309,6 +4501,70 @@ Get completions usage details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `class OrganizationUsageFileSearchesResult` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: Integer` + + The count of file search calls. + + - `object: :"organization.usage.file_searches.result"` + + - `:"organization.usage.file_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: String` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: Integer` + + The count of model requests. + + - `num_requests: Integer` + + The count of web search calls. + + - `object: :"organization.usage.web_searches.result"` + + - `:"organization.usage.web_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: String` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: String` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `class OrganizationCostsResult` The aggregated costs details of the specific time bucket. @@ -4481,7 +4737,7 @@ Get embeddings usage details for the organization. - `:bucket` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -4739,6 +4995,70 @@ Get embeddings usage details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `class OrganizationUsageFileSearchesResult` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: Integer` + + The count of file search calls. + + - `object: :"organization.usage.file_searches.result"` + + - `:"organization.usage.file_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: String` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: Integer` + + The count of model requests. + + - `num_requests: Integer` + + The count of web search calls. + + - `object: :"organization.usage.web_searches.result"` + + - `:"organization.usage.web_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: String` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: String` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `class OrganizationCostsResult` The aggregated costs details of the specific time bucket. @@ -4939,7 +5259,7 @@ Get images usage details for the organization. - `:bucket` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -5197,35 +5517,99 @@ Get images usage details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `class OrganizationCostsResult` + - `class OrganizationUsageFileSearchesResult` - 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: Integer` - - `:"organization.costs.result"` + The count of file search calls. - - `amount: Amount{ currency, value}` + - `object: :"organization.usage.file_searches.result"` - The monetary value in its associated currency. + - `:"organization.usage.file_searches.result"` - - `currency: String` + - `api_key_id: 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: Float` + - `project_id: 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: String` + - `user_id: 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: String` + - `vector_store_id: 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: String` + - `class OrganizationUsageWebSearchesResult` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: Integer` + + The count of model requests. + + - `num_requests: Integer` + + The count of web search calls. + + - `object: :"organization.usage.web_searches.result"` + + - `:"organization.usage.web_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: String` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: String` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationCostsResult` + + The aggregated costs details of the specific time bucket. + + - `object: :"organization.costs.result"` + + - `:"organization.costs.result"` + + - `amount: Amount{ currency, value}` + + The monetary value in its associated currency. + + - `currency: String` + + Lowercase ISO-4217 currency e.g. "usd" + + - `value: Float` + + The numeric value of the cost. + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `line_item: String` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `project_id: String` When `group_by=project_id`, this field provides the project ID of the grouped costs result. @@ -5369,7 +5753,7 @@ Get moderations usage details for the organization. - `:bucket` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -5627,6 +6011,70 @@ Get moderations usage details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `class OrganizationUsageFileSearchesResult` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: Integer` + + The count of file search calls. + + - `object: :"organization.usage.file_searches.result"` + + - `:"organization.usage.file_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: String` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: Integer` + + The count of model requests. + + - `num_requests: Integer` + + The count of web search calls. + + - `object: :"organization.usage.web_searches.result"` + + - `:"organization.usage.web_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: String` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: String` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `class OrganizationCostsResult` The aggregated costs details of the specific time bucket. @@ -5781,7 +6229,7 @@ Get vector stores usage details for the organization. - `:bucket` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -6039,6 +6487,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. + - `class OrganizationUsageFileSearchesResult` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: Integer` + + The count of file search calls. + + - `object: :"organization.usage.file_searches.result"` + + - `:"organization.usage.file_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: String` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: Integer` + + The count of model requests. + + - `num_requests: Integer` + + The count of web search calls. + + - `object: :"organization.usage.web_searches.result"` + + - `:"organization.usage.web_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: String` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: String` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `class OrganizationCostsResult` The aggregated costs details of the specific time bucket. @@ -6131,13 +6643,13 @@ puts(response) } ``` -## Costs +## File search calls -`admin.organization.usage.costs(**kwargs) -> UsageCostsResponse` +`admin.organization.usage.file_search_calls(**kwargs) -> UsageFileSearchCallsResponse` -**get** `/organization/costs` +**get** `/organization/usage/file_search_calls` -Get costs details for the organization. +Get file search calls usage details for the organization. ### Parameters @@ -6147,11 +6659,15 @@ Get costs details for the organization. - `api_key_ids: Array[String]` - Return only costs for these API keys. + Return only usage for these API keys. -- `bucket_width: :"1d"` +- `bucket_width: :"1m" | :"1h" | :"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"` @@ -6159,19 +6675,25 @@ Get costs details for the organization. End time (Unix seconds) of the query time range, exclusive. -- `group_by: Array[:project_id | :line_item | :api_key_id]` +- `group_by: Array[:project_id | :user_id | :api_key_id | :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: Integer` - 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: String` @@ -6179,11 +6701,19 @@ Get costs details for the organization. - `project_ids: Array[String]` - Return only costs for these projects. + Return only usage for these projects. + +- `user_ids: Array[String]` + + Return only usage for these users. + +- `vector_store_ids: Array[String]` + + Return only usage for these vector stores. ### Returns -- `class UsageCostsResponse` +- `class UsageFileSearchCallsResponse` - `data: Array[Data{ end_time, object, results, start_time}]` @@ -6193,7 +6723,7 @@ Get costs details for the organization. - `:bucket` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -6451,6 +6981,70 @@ Get costs details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `class OrganizationUsageFileSearchesResult` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: Integer` + + The count of file search calls. + + - `object: :"organization.usage.file_searches.result"` + + - `:"organization.usage.file_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: String` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: Integer` + + The count of model requests. + + - `num_requests: Integer` + + The count of web search calls. + + - `object: :"organization.usage.web_searches.result"` + + - `:"organization.usage.web_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: String` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: String` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `class OrganizationCostsResult` The aggregated costs details of the specific time bucket. @@ -6504,7 +7098,7 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -response = openai.admin.organization.usage.costs(start_time: 0) +response = openai.admin.organization.usage.file_search_calls(start_time: 0) puts(response) ``` @@ -6543,35 +7137,113 @@ puts(response) } ``` -## Domain Types +## Web search calls -### Usage Audio Speeches Response +`admin.organization.usage.web_search_calls(**kwargs) -> UsageWebSearchCallsResponse` -- `class UsageAudioSpeechesResponse` +**get** `/organization/usage/web_search_calls` - - `data: Array[Data{ end_time, object, results, start_time}]` +Get web search calls usage details for the organization. - - `end_time: Integer` +### Parameters - - `object: :bucket` +- `start_time: Integer` - - `:bucket` + Start time (Unix seconds) of the query time range, inclusive. - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` +- `api_key_ids: Array[String]` - - `class OrganizationUsageCompletionsResult` + Return only usage for these API keys. - The aggregated completions usage details of the specific time bucket. +- `bucket_width: :"1m" | :"1h" | :"1d"` - - `input_tokens: Integer` + Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. - The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + - `:"1m"` - - `num_model_requests: Integer` + - `:"1h"` - The count of requests made to the model. + - `:"1d"` - - `object: :"organization.usage.completions.result"` +- `context_levels: Array[:low | :medium | :high]` + + Return only web search usage for these context levels. + + - `:low` + + - `:medium` + + - `:high` + +- `end_time: Integer` + + End time (Unix seconds) of the query time range, exclusive. + +- `group_by: Array[:project_id | :user_id | :api_key_id | 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: Integer` + + 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: Array[String]` + + Return only usage for these models. + +- `page: String` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + +- `project_ids: Array[String]` + + Return only usage for these projects. + +- `user_ids: Array[String]` + + Return only usage for these users. + +### Returns + +- `class UsageWebSearchCallsResponse` + + - `data: Array[Data{ end_time, object, results, start_time}]` + + - `end_time: Integer` + + - `object: :bucket` + + - `:bucket` + + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` + + - `class OrganizationUsageCompletionsResult` + + The aggregated completions usage details of the specific time bucket. + + - `input_tokens: Integer` + + 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: Integer` + + The count of requests made to the model. + + - `object: :"organization.usage.completions.result"` - `:"organization.usage.completions.result"` @@ -6815,6 +7487,70 @@ puts(response) When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `class OrganizationUsageFileSearchesResult` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: Integer` + + The count of file search calls. + + - `object: :"organization.usage.file_searches.result"` + + - `:"organization.usage.file_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: String` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: Integer` + + The count of model requests. + + - `num_requests: Integer` + + The count of web search calls. + + - `object: :"organization.usage.web_searches.result"` + + - `:"organization.usage.web_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: String` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: String` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `class OrganizationCostsResult` The aggregated costs details of the specific time bucket. @@ -6861,9 +7597,105 @@ puts(response) - `:page` -### Usage Audio Transcriptions Response +### Example -- `class UsageAudioTranscriptionsResponse` +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +response = openai.admin.organization.usage.web_search_calls(start_time: 0) + +puts(response) +``` + +#### 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" +} +``` + +## Costs + +`admin.organization.usage.costs(**kwargs) -> UsageCostsResponse` + +**get** `/organization/costs` + +Get costs details for the organization. + +### Parameters + +- `start_time: Integer` + + Start time (Unix seconds) of the query time range, inclusive. + +- `api_key_ids: Array[String]` + + Return only costs for these API keys. + +- `bucket_width: :"1d"` + + Width of each time bucket in response. Currently only `1d` is supported, default to `1d`. + + - `:"1d"` + +- `end_time: Integer` + + End time (Unix seconds) of the query time range, exclusive. + +- `group_by: Array[:project_id | :line_item | :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: Integer` + + A limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7. + +- `page: String` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + +- `project_ids: Array[String]` + + Return only costs for these projects. + +### Returns + +- `class UsageCostsResponse` - `data: Array[Data{ end_time, object, results, start_time}]` @@ -6873,7 +7705,7 @@ puts(response) - `:bucket` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -7131,65 +7963,177 @@ puts(response) When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `class OrganizationCostsResult` + - `class OrganizationUsageFileSearchesResult` - 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: Integer` - - `:"organization.costs.result"` + The count of file search calls. - - `amount: Amount{ currency, value}` + - `object: :"organization.usage.file_searches.result"` - The monetary value in its associated currency. + - `:"organization.usage.file_searches.result"` - - `currency: String` + - `api_key_id: 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: Float` + - `project_id: 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: String` + - `user_id: 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: String` + - `vector_store_id: 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: String` + - `class OrganizationUsageWebSearchesResult` - 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: Float` + - `num_model_requests: Integer` - When `group_by=line_item`, this field provides the quantity of the grouped costs result. + The count of model requests. - - `start_time: Integer` + - `num_requests: Integer` - - `has_more: bool` + 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: String` -### Usage Code Interpreter Sessions Response + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. -- `class UsageCodeInterpreterSessionsResponse` + - `context_level: String` - - `data: Array[Data{ end_time, object, results, start_time}]` + When `group_by=context_level`, this field provides the search context size of the grouped usage result. - - `end_time: Integer` + - `model: String` - - `object: :bucket` + When `group_by=model`, this field provides the model name of the grouped usage result. - - `:bucket` + - `project_id: String` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationCostsResult` + + The aggregated costs details of the specific time bucket. + + - `object: :"organization.costs.result"` + + - `:"organization.costs.result"` + + - `amount: Amount{ currency, value}` + + The monetary value in its associated currency. + + - `currency: String` + + Lowercase ISO-4217 currency e.g. "usd" + + - `value: Float` + + The numeric value of the cost. + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `line_item: String` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `quantity: Float` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `start_time: Integer` + + - `has_more: bool` + + - `next_page: String` + + - `object: :page` + + - `:page` + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +response = openai.admin.organization.usage.costs(start_time: 0) + +puts(response) +``` + +#### 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" +} +``` + +## Domain Types + +### Usage Audio Speeches Response + +- `class UsageAudioSpeechesResponse` + + - `data: Array[Data{ end_time, object, results, start_time}]` + + - `end_time: Integer` + + - `object: :bucket` + + - `:bucket` + + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -7447,6 +8391,70 @@ puts(response) When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `class OrganizationUsageFileSearchesResult` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: Integer` + + The count of file search calls. + + - `object: :"organization.usage.file_searches.result"` + + - `:"organization.usage.file_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: String` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: Integer` + + The count of model requests. + + - `num_requests: Integer` + + The count of web search calls. + + - `object: :"organization.usage.web_searches.result"` + + - `:"organization.usage.web_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: String` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: String` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `class OrganizationCostsResult` The aggregated costs details of the specific time bucket. @@ -7493,9 +8501,9 @@ puts(response) - `:page` -### Usage Completions Response +### Usage Audio Transcriptions Response -- `class UsageCompletionsResponse` +- `class UsageAudioTranscriptionsResponse` - `data: Array[Data{ end_time, object, results, start_time}]` @@ -7505,7 +8513,7 @@ puts(response) - `:bucket` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -7763,6 +8771,70 @@ puts(response) When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `class OrganizationUsageFileSearchesResult` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: Integer` + + The count of file search calls. + + - `object: :"organization.usage.file_searches.result"` + + - `:"organization.usage.file_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: String` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: Integer` + + The count of model requests. + + - `num_requests: Integer` + + The count of web search calls. + + - `object: :"organization.usage.web_searches.result"` + + - `:"organization.usage.web_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: String` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: String` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `class OrganizationCostsResult` The aggregated costs details of the specific time bucket. @@ -7809,9 +8881,9 @@ puts(response) - `:page` -### Usage Embeddings Response +### Usage Code Interpreter Sessions Response -- `class UsageEmbeddingsResponse` +- `class UsageCodeInterpreterSessionsResponse` - `data: Array[Data{ end_time, object, results, start_time}]` @@ -7821,7 +8893,7 @@ puts(response) - `:bucket` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -8079,65 +9151,129 @@ puts(response) When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `class OrganizationCostsResult` + - `class OrganizationUsageFileSearchesResult` - 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: Integer` - - `:"organization.costs.result"` + The count of file search calls. - - `amount: Amount{ currency, value}` + - `object: :"organization.usage.file_searches.result"` - The monetary value in its associated currency. + - `:"organization.usage.file_searches.result"` - - `currency: String` + - `api_key_id: 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: Float` + - `project_id: 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: String` + - `user_id: 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: String` + - `vector_store_id: 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: String` + - `class OrganizationUsageWebSearchesResult` - 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: Float` + - `num_model_requests: Integer` - When `group_by=line_item`, this field provides the quantity of the grouped costs result. + The count of model requests. - - `start_time: Integer` + - `num_requests: Integer` - - `has_more: bool` + 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: String` -### Usage Images Response + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. -- `class UsageImagesResponse` + - `context_level: String` - - `data: Array[Data{ end_time, object, results, start_time}]` + When `group_by=context_level`, this field provides the search context size of the grouped usage result. - - `end_time: Integer` + - `model: String` - - `object: :bucket` + When `group_by=model`, this field provides the model name of the grouped usage result. - - `:bucket` + - `project_id: String` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `class OrganizationCostsResult` + + The aggregated costs details of the specific time bucket. + + - `object: :"organization.costs.result"` + + - `:"organization.costs.result"` + + - `amount: Amount{ currency, value}` + + The monetary value in its associated currency. + + - `currency: String` + + Lowercase ISO-4217 currency e.g. "usd" + + - `value: Float` + + The numeric value of the cost. + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `line_item: String` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `quantity: Float` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `start_time: Integer` + + - `has_more: bool` + + - `next_page: String` + + - `object: :page` + + - `:page` + +### Usage Completions Response + +- `class UsageCompletionsResponse` + + - `data: Array[Data{ end_time, object, results, start_time}]` + + - `end_time: Integer` + + - `object: :bucket` + + - `:bucket` + + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -8395,6 +9531,70 @@ puts(response) When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `class OrganizationUsageFileSearchesResult` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: Integer` + + The count of file search calls. + + - `object: :"organization.usage.file_searches.result"` + + - `:"organization.usage.file_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: String` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: Integer` + + The count of model requests. + + - `num_requests: Integer` + + The count of web search calls. + + - `object: :"organization.usage.web_searches.result"` + + - `:"organization.usage.web_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: String` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: String` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `class OrganizationCostsResult` The aggregated costs details of the specific time bucket. @@ -8441,9 +9641,9 @@ puts(response) - `:page` -### Usage Moderations Response +### Usage Embeddings Response -- `class UsageModerationsResponse` +- `class UsageEmbeddingsResponse` - `data: Array[Data{ end_time, object, results, start_time}]` @@ -8453,7 +9653,7 @@ puts(response) - `:bucket` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -8711,6 +9911,70 @@ puts(response) When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `class OrganizationUsageFileSearchesResult` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: Integer` + + The count of file search calls. + + - `object: :"organization.usage.file_searches.result"` + + - `:"organization.usage.file_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: String` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: Integer` + + The count of model requests. + + - `num_requests: Integer` + + The count of web search calls. + + - `object: :"organization.usage.web_searches.result"` + + - `:"organization.usage.web_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: String` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: String` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `class OrganizationCostsResult` The aggregated costs details of the specific time bucket. @@ -8757,9 +10021,9 @@ puts(response) - `:page` -### Usage Vector Stores Response +### Usage Images Response -- `class UsageVectorStoresResponse` +- `class UsageImagesResponse` - `data: Array[Data{ end_time, object, results, start_time}]` @@ -8769,7 +10033,7 @@ puts(response) - `:bucket` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -9027,6 +10291,70 @@ puts(response) When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `class OrganizationUsageFileSearchesResult` + + The aggregated file search calls usage details of the specific time bucket. + + - `num_requests: Integer` + + The count of file search calls. + + - `object: :"organization.usage.file_searches.result"` + + - `:"organization.usage.file_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `vector_store_id: String` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `class OrganizationUsageWebSearchesResult` + + The aggregated web search calls usage details of the specific time bucket. + + - `num_model_requests: Integer` + + The count of model requests. + + - `num_requests: Integer` + + The count of web search calls. + + - `object: :"organization.usage.web_searches.result"` + + - `:"organization.usage.web_searches.result"` + + - `api_key_id: String` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `context_level: String` + + When `group_by=context_level`, this field provides the search context size of the grouped usage result. + + - `model: String` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `project_id: String` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `user_id: String` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `class OrganizationCostsResult` The aggregated costs details of the specific time bucket. @@ -9073,9 +10401,9 @@ puts(response) - `:page` -### Usage Costs Response +### Usage Moderations Response -- `class UsageCostsResponse` +- `class UsageModerationsResponse` - `data: Array[Data{ end_time, object, results, start_time}]` @@ -9085,7 +10413,7 @@ puts(response) - `:bucket` - - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - `class OrganizationUsageCompletionsResult` @@ -9343,2055 +10671,1721 @@ puts(response) When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `class OrganizationCostsResult` + - `class OrganizationUsageFileSearchesResult` - 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: Integer` - - `:"organization.costs.result"` + The count of file search calls. - - `amount: Amount{ currency, value}` + - `object: :"organization.usage.file_searches.result"` - The monetary value in its associated currency. + - `:"organization.usage.file_searches.result"` - - `currency: String` + - `api_key_id: 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: Float` + - `project_id: 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: String` + - `user_id: 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: String` + - `vector_store_id: 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: String` + - `class OrganizationUsageWebSearchesResult` - 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: Float` + - `num_model_requests: Integer` - When `group_by=line_item`, this field provides the quantity of the grouped costs result. + The count of model requests. - - `start_time: Integer` + - `num_requests: Integer` - - `has_more: bool` + 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: String` -# Invites + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. -## List invites + - `context_level: String` -`admin.organization.invites.list(**kwargs) -> ConversationCursorPage` + When `group_by=context_level`, this field provides the search context size of the grouped usage result. -**get** `/organization/invites` + - `model: String` -Returns a list of invites in the organization. + When `group_by=model`, this field provides the model name of the grouped usage result. -### Parameters + - `project_id: String` -- `after: String` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - 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. + - `user_id: String` -- `limit: Integer` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + - `class OrganizationCostsResult` -### Returns + The aggregated costs details of the specific time bucket. -- `class Invite` + - `object: :"organization.costs.result"` - Represents an individual `invite` to the organization. + - `:"organization.costs.result"` - - `id: String` + - `amount: Amount{ currency, value}` - The identifier, which can be referenced in API endpoints + The monetary value in its associated currency. - - `created_at: Integer` + - `currency: String` - The Unix timestamp (in seconds) of when the invite was sent. + Lowercase ISO-4217 currency e.g. "usd" - - `email: String` + - `value: Float` - The email address of the individual to whom the invite was sent + The numeric value of the cost. - - `object: :"organization.invite"` + - `api_key_id: String` - The object type, which is always `organization.invite` + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. - - `:"organization.invite"` + - `line_item: String` - - `projects: Array[Project{ id, role}]` + When `group_by=line_item`, this field provides the line item of the grouped costs result. - The projects that were granted membership upon acceptance of the invite. + - `project_id: String` - - `id: String` + When `group_by=project_id`, this field provides the project ID of the grouped costs result. - Project's public ID + - `quantity: Float` - - `role: :member | :owner` + When `group_by=line_item`, this field provides the quantity of the grouped costs result. - Project membership role + - `start_time: Integer` - - `:member` + - `has_more: bool` - - `:owner` + - `next_page: String` - - `role: :owner | :reader` + - `object: :page` - `owner` or `reader` + - `:page` - - `:owner` +### Usage Vector Stores Response - - `:reader` +- `class UsageVectorStoresResponse` - - `status: :accepted | :expired | :pending` + - `data: Array[Data{ end_time, object, results, start_time}]` - `accepted`,`expired`, or `pending` + - `end_time: Integer` - - `:accepted` + - `object: :bucket` - - `:expired` + - `:bucket` - - `:pending` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - - `accepted_at: Integer` + - `class OrganizationUsageCompletionsResult` - The Unix timestamp (in seconds) of when the invite was accepted. + The aggregated completions usage details of the specific time bucket. - - `expires_at: Integer` + - `input_tokens: Integer` - The Unix timestamp (in seconds) of when the invite expires. + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. -### Example + - `num_model_requests: Integer` -```ruby -require "openai" + The count of requests made to the model. -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + - `object: :"organization.usage.completions.result"` -page = openai.admin.organization.invites.list + - `:"organization.usage.completions.result"` -puts(page) -``` + - `output_tokens: Integer` -#### Response + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. -```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" -} -``` + - `api_key_id: String` -## Create invite + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. -`admin.organization.invites.create(**kwargs) -> Invite` + - `batch: bool` -**post** `/organization/invites` + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. -Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization. + - `input_audio_tokens: Integer` -### Parameters + The aggregated number of audio input tokens used, including cached tokens. -- `email: String` + - `input_cached_tokens: Integer` - Send an email to this address + 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. -- `role: :reader | :owner` + - `model: String` - `owner` or `reader` + When `group_by=model`, this field provides the model name of the grouped usage result. - - `:reader` + - `output_audio_tokens: Integer` - - `:owner` + The aggregated number of audio output tokens used. -- `projects: Array[Project{ id, role}]` + - `project_id: String` - 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. + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `id: String` + - `service_tier: String` - Project's public ID + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. - - `role: :member | :owner` + - `user_id: String` - Project membership role + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `:member` + - `class OrganizationUsageEmbeddingsResult` - - `:owner` + The aggregated embeddings usage details of the specific time bucket. -### Returns + - `input_tokens: Integer` -- `class Invite` + The aggregated number of input tokens used. - Represents an individual `invite` to the organization. + - `num_model_requests: Integer` - - `id: String` + The count of requests made to the model. - The identifier, which can be referenced in API endpoints + - `object: :"organization.usage.embeddings.result"` - - `created_at: Integer` + - `:"organization.usage.embeddings.result"` - The Unix timestamp (in seconds) of when the invite was sent. + - `api_key_id: String` - - `email: String` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - The email address of the individual to whom the invite was sent + - `model: String` - - `object: :"organization.invite"` + When `group_by=model`, this field provides the model name of the grouped usage result. - The object type, which is always `organization.invite` + - `project_id: String` - - `:"organization.invite"` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `projects: Array[Project{ id, role}]` + - `user_id: String` - The projects that were granted membership upon acceptance of the invite. + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `id: String` + - `class OrganizationUsageModerationsResult` - Project's public ID + The aggregated moderations usage details of the specific time bucket. - - `role: :member | :owner` + - `input_tokens: Integer` - Project membership role + The aggregated number of input tokens used. - - `:member` + - `num_model_requests: Integer` - - `:owner` + The count of requests made to the model. - - `role: :owner | :reader` + - `object: :"organization.usage.moderations.result"` - `owner` or `reader` + - `:"organization.usage.moderations.result"` - - `:owner` + - `api_key_id: String` - - `:reader` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `status: :accepted | :expired | :pending` + - `model: String` - `accepted`,`expired`, or `pending` + When `group_by=model`, this field provides the model name of the grouped usage result. - - `:accepted` + - `project_id: String` - - `:expired` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `:pending` + - `user_id: String` - - `accepted_at: Integer` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - The Unix timestamp (in seconds) of when the invite was accepted. + - `class OrganizationUsageImagesResult` - - `expires_at: Integer` + The aggregated images usage details of the specific time bucket. - The Unix timestamp (in seconds) of when the invite expires. + - `images: Integer` -### Example + The number of images processed. -```ruby -require "openai" + - `num_model_requests: Integer` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + The count of requests made to the model. -invite = openai.admin.organization.invites.create(email: "email", role: :reader) + - `object: :"organization.usage.images.result"` -puts(invite) -``` + - `:"organization.usage.images.result"` -#### Response + - `api_key_id: String` -```json -{ - "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 -} -``` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. -## Retrieve invite + - `model: String` -`admin.organization.invites.retrieve(invite_id) -> Invite` + When `group_by=model`, this field provides the model name of the grouped usage result. -**get** `/organization/invites/{invite_id}` + - `project_id: String` -Retrieves an invite. + When `group_by=project_id`, this field provides the project ID of the grouped usage result. -### Parameters + - `size: String` -- `invite_id: String` + When `group_by=size`, this field provides the image size of the grouped usage result. -### Returns + - `source: String` -- `class Invite` + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. - Represents an individual `invite` to the organization. + - `user_id: String` - - `id: String` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - The identifier, which can be referenced in API endpoints + - `class OrganizationUsageAudioSpeechesResult` - - `created_at: Integer` + The aggregated audio speeches usage details of the specific time bucket. - The Unix timestamp (in seconds) of when the invite was sent. + - `characters: Integer` - - `email: String` + The number of characters processed. - The email address of the individual to whom the invite was sent + - `num_model_requests: Integer` - - `object: :"organization.invite"` + The count of requests made to the model. - The object type, which is always `organization.invite` + - `object: :"organization.usage.audio_speeches.result"` - - `:"organization.invite"` + - `:"organization.usage.audio_speeches.result"` - - `projects: Array[Project{ id, role}]` + - `api_key_id: String` - The projects that were granted membership upon acceptance of the invite. + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `id: String` + - `model: String` - Project's public ID + When `group_by=model`, this field provides the model name of the grouped usage result. - - `role: :member | :owner` + - `project_id: String` - Project membership role + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `:member` + - `user_id: String` - - `:owner` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `role: :owner | :reader` + - `class OrganizationUsageAudioTranscriptionsResult` - `owner` or `reader` + The aggregated audio transcriptions usage details of the specific time bucket. - - `:owner` + - `num_model_requests: Integer` - - `:reader` + The count of requests made to the model. - - `status: :accepted | :expired | :pending` + - `object: :"organization.usage.audio_transcriptions.result"` - `accepted`,`expired`, or `pending` + - `:"organization.usage.audio_transcriptions.result"` - - `:accepted` + - `seconds: Integer` - - `:expired` + The number of seconds processed. - - `:pending` + - `api_key_id: String` - - `accepted_at: Integer` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - The Unix timestamp (in seconds) of when the invite was accepted. + - `model: String` - - `expires_at: Integer` + When `group_by=model`, this field provides the model name of the grouped usage result. - The Unix timestamp (in seconds) of when the invite expires. + - `project_id: String` -### Example + When `group_by=project_id`, this field provides the project ID of the grouped usage result. -```ruby -require "openai" + - `user_id: String` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + When `group_by=user_id`, this field provides the user ID of the grouped usage result. -invite = openai.admin.organization.invites.retrieve("invite_id") + - `class OrganizationUsageVectorStoresResult` -puts(invite) -``` + The aggregated vector stores usage details of the specific time bucket. -#### Response + - `object: :"organization.usage.vector_stores.result"` -```json -{ - "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 -} -``` + - `:"organization.usage.vector_stores.result"` -## Delete invite + - `usage_bytes: Integer` -`admin.organization.invites.delete(invite_id) -> InviteDeleteResponse` + The vector stores usage in bytes. -**delete** `/organization/invites/{invite_id}` + - `project_id: String` -Delete an invite. If the invite has already been accepted, it cannot be deleted. + When `group_by=project_id`, this field provides the project ID of the grouped usage result. -### Parameters + - `class OrganizationUsageCodeInterpreterSessionsResult` -- `invite_id: String` + The aggregated code interpreter sessions usage details of the specific time bucket. -### Returns + - `num_sessions: Integer` -- `class InviteDeleteResponse` + The number of code interpreter sessions. - - `id: String` + - `object: :"organization.usage.code_interpreter_sessions.result"` - - `deleted: bool` + - `:"organization.usage.code_interpreter_sessions.result"` - - `object: :"organization.invite.deleted"` + - `project_id: String` - The object type, which is always `organization.invite.deleted` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `:"organization.invite.deleted"` + - `class OrganizationUsageFileSearchesResult` -### Example + The aggregated file search calls usage details of the specific time bucket. -```ruby -require "openai" + - `num_requests: Integer` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + The count of file search calls. -invite = openai.admin.organization.invites.delete("invite_id") + - `object: :"organization.usage.file_searches.result"` -puts(invite) -``` + - `:"organization.usage.file_searches.result"` -#### Response + - `api_key_id: String` -```json -{ - "id": "id", - "deleted": true, - "object": "organization.invite.deleted" -} -``` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. -## Domain Types + - `project_id: String` -### Invite + When `group_by=project_id`, this field provides the project ID of the grouped usage result. -- `class Invite` + - `user_id: String` - Represents an individual `invite` to the organization. + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `id: String` + - `vector_store_id: String` - The identifier, which can be referenced in API endpoints + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. - - `created_at: Integer` + - `class OrganizationUsageWebSearchesResult` - The Unix timestamp (in seconds) of when the invite was sent. + The aggregated web search calls usage details of the specific time bucket. - - `email: String` + - `num_model_requests: Integer` - The email address of the individual to whom the invite was sent + The count of model requests. - - `object: :"organization.invite"` + - `num_requests: Integer` - The object type, which is always `organization.invite` + The count of web search calls. - - `:"organization.invite"` + - `object: :"organization.usage.web_searches.result"` - - `projects: Array[Project{ id, role}]` + - `:"organization.usage.web_searches.result"` - The projects that were granted membership upon acceptance of the invite. + - `api_key_id: String` - - `id: String` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - Project's public ID + - `context_level: String` - - `role: :member | :owner` + When `group_by=context_level`, this field provides the search context size of the grouped usage result. - Project membership role + - `model: String` - - `:member` + When `group_by=model`, this field provides the model name of the grouped usage result. - - `:owner` + - `project_id: String` - - `role: :owner | :reader` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - `owner` or `reader` + - `user_id: String` - - `:owner` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `:reader` + - `class OrganizationCostsResult` - - `status: :accepted | :expired | :pending` + The aggregated costs details of the specific time bucket. - `accepted`,`expired`, or `pending` + - `object: :"organization.costs.result"` - - `:accepted` + - `:"organization.costs.result"` - - `:expired` + - `amount: Amount{ currency, value}` - - `:pending` + The monetary value in its associated currency. - - `accepted_at: Integer` + - `currency: String` - The Unix timestamp (in seconds) of when the invite was accepted. + Lowercase ISO-4217 currency e.g. "usd" - - `expires_at: Integer` + - `value: Float` - The Unix timestamp (in seconds) of when the invite expires. + The numeric value of the cost. -### Invite Delete Response + - `api_key_id: String` -- `class InviteDeleteResponse` + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. - - `id: String` + - `line_item: String` - - `deleted: bool` + When `group_by=line_item`, this field provides the line item of the grouped costs result. - - `object: :"organization.invite.deleted"` + - `project_id: String` - The object type, which is always `organization.invite.deleted` + When `group_by=project_id`, this field provides the project ID of the grouped costs result. - - `:"organization.invite.deleted"` + - `quantity: Float` -# Users + When `group_by=line_item`, this field provides the quantity of the grouped costs result. -## List users + - `start_time: Integer` -`admin.organization.users.list(**kwargs) -> ConversationCursorPage` + - `has_more: bool` -**get** `/organization/users` + - `next_page: String` -Lists all of the users in the organization. + - `object: :page` -### Parameters + - `:page` -- `after: String` +### Usage File Search Calls 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. +- `class UsageFileSearchCallsResponse` -- `emails: Array[String]` + - `data: Array[Data{ end_time, object, results, start_time}]` - Filter by the email address of users. + - `end_time: Integer` -- `limit: Integer` + - `object: :bucket` - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + - `:bucket` -### Returns + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` -- `class OrganizationUser` + - `class OrganizationUsageCompletionsResult` - Represents an individual `user` within an organization. + The aggregated completions usage details of the specific time bucket. - - `id: String` + - `input_tokens: Integer` - The identifier, which can be referenced in API endpoints + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. - - `added_at: Integer` + - `num_model_requests: Integer` - The Unix timestamp (in seconds) of when the user was added. + The count of requests made to the model. - - `object: :"organization.user"` + - `object: :"organization.usage.completions.result"` - The object type, which is always `organization.user` + - `:"organization.usage.completions.result"` - - `:"organization.user"` + - `output_tokens: Integer` - - `api_key_last_used_at: Integer` + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. - The Unix timestamp (in seconds) of the user's last API key usage. + - `api_key_id: String` - - `created: Integer` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - The Unix timestamp (in seconds) of when the user was created. + - `batch: bool` - - `developer_persona: String` + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. - The developer persona metadata for the user. + - `input_audio_tokens: Integer` - - `email: String` + The aggregated number of audio input tokens used, including cached tokens. - The email address of the user + - `input_cached_tokens: Integer` - - `is_default: bool` + 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. - Whether this is the organization's default user. + - `model: String` - - `is_scale_tier_authorized_purchaser: bool` + When `group_by=model`, this field provides the model name of the grouped usage result. - Whether the user is an authorized purchaser for Scale Tier. + - `output_audio_tokens: Integer` - - `is_scim_managed: bool` + The aggregated number of audio output tokens used. - Whether the user is managed through SCIM. + - `project_id: String` - - `is_service_account: bool` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - Whether the user is a service account. + - `service_tier: String` - - `name: String` + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. - The name of the user + - `user_id: String` - - `projects: Projects{ data, object}` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - Projects associated with the user, if included. + - `class OrganizationUsageEmbeddingsResult` - - `data: Array[Data{ id, name, role}]` + The aggregated embeddings usage details of the specific time bucket. - - `id: String` + - `input_tokens: Integer` - - `name: String` + The aggregated number of input tokens used. - - `role: String` + - `num_model_requests: Integer` - - `object: :list` + The count of requests made to the model. - - `:list` + - `object: :"organization.usage.embeddings.result"` - - `role: String` + - `:"organization.usage.embeddings.result"` - `owner` or `reader` + - `api_key_id: String` - - `technical_level: String` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - The technical level metadata for the user. + - `model: String` - - `user: User{ id, object, banned, 5 more}` + When `group_by=model`, this field provides the model name of the grouped usage result. - Nested user details. + - `project_id: String` - - `id: String` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `object: :user` + - `user_id: String` - - `:user` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `banned: bool` + - `class OrganizationUsageModerationsResult` - - `banned_at: Integer` + The aggregated moderations usage details of the specific time bucket. - - `email: String` + - `input_tokens: Integer` - - `enabled: bool` + The aggregated number of input tokens used. - - `name: String` + - `num_model_requests: Integer` - - `picture: String` + The count of requests made to the model. -### Example + - `object: :"organization.usage.moderations.result"` -```ruby -require "openai" + - `:"organization.usage.moderations.result"` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + - `api_key_id: String` -page = openai.admin.organization.users.list + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. -puts(page) -``` + - `model: String` -#### Response + When `group_by=model`, this field provides the model name of the grouped usage result. -```json -{ - "data": [ - { - "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" - } - ], - "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" -} -``` + - `project_id: String` -## Retrieve user + When `group_by=project_id`, this field provides the project ID of the grouped usage result. -`admin.organization.users.retrieve(user_id) -> OrganizationUser` + - `user_id: String` -**get** `/organization/users/{user_id}` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. -Retrieves a user by their identifier. + - `class OrganizationUsageImagesResult` -### Parameters + The aggregated images usage details of the specific time bucket. -- `user_id: String` + - `images: Integer` -### Returns + The number of images processed. -- `class OrganizationUser` + - `num_model_requests: Integer` - Represents an individual `user` within an organization. + The count of requests made to the model. - - `id: String` + - `object: :"organization.usage.images.result"` - The identifier, which can be referenced in API endpoints + - `:"organization.usage.images.result"` - - `added_at: Integer` + - `api_key_id: String` - The Unix timestamp (in seconds) of when the user was added. + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `object: :"organization.user"` + - `model: String` - The object type, which is always `organization.user` + When `group_by=model`, this field provides the model name of the grouped usage result. - - `:"organization.user"` + - `project_id: String` - - `api_key_last_used_at: Integer` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - The Unix timestamp (in seconds) of the user's last API key usage. + - `size: String` - - `created: Integer` + When `group_by=size`, this field provides the image size of the grouped usage result. - The Unix timestamp (in seconds) of when the user was created. + - `source: String` - - `developer_persona: String` + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. - The developer persona metadata for the user. + - `user_id: String` - - `email: String` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - The email address of the user + - `class OrganizationUsageAudioSpeechesResult` - - `is_default: bool` + The aggregated audio speeches usage details of the specific time bucket. - Whether this is the organization's default user. + - `characters: Integer` - - `is_scale_tier_authorized_purchaser: bool` + The number of characters processed. - Whether the user is an authorized purchaser for Scale Tier. + - `num_model_requests: Integer` - - `is_scim_managed: bool` + The count of requests made to the model. - Whether the user is managed through SCIM. + - `object: :"organization.usage.audio_speeches.result"` - - `is_service_account: bool` + - `:"organization.usage.audio_speeches.result"` - Whether the user is a service account. + - `api_key_id: String` - - `name: String` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - The name of the user + - `model: String` - - `projects: Projects{ data, object}` + When `group_by=model`, this field provides the model name of the grouped usage result. - Projects associated with the user, if included. + - `project_id: String` - - `data: Array[Data{ id, name, role}]` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `id: String` + - `user_id: String` - - `name: String` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `role: String` + - `class OrganizationUsageAudioTranscriptionsResult` - - `object: :list` + The aggregated audio transcriptions usage details of the specific time bucket. - - `:list` + - `num_model_requests: Integer` - - `role: String` + The count of requests made to the model. - `owner` or `reader` + - `object: :"organization.usage.audio_transcriptions.result"` - - `technical_level: String` + - `:"organization.usage.audio_transcriptions.result"` - The technical level metadata for the user. + - `seconds: Integer` - - `user: User{ id, object, banned, 5 more}` + The number of seconds processed. - Nested user details. + - `api_key_id: String` - - `id: String` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `object: :user` + - `model: String` - - `:user` + When `group_by=model`, this field provides the model name of the grouped usage result. - - `banned: bool` + - `project_id: String` - - `banned_at: Integer` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `email: String` + - `user_id: String` - - `enabled: bool` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `name: String` + - `class OrganizationUsageVectorStoresResult` - - `picture: String` + The aggregated vector stores usage details of the specific time bucket. -### Example + - `object: :"organization.usage.vector_stores.result"` -```ruby -require "openai" + - `:"organization.usage.vector_stores.result"` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + - `usage_bytes: Integer` -organization_user = openai.admin.organization.users.retrieve("user_id") + The vector stores usage in bytes. -puts(organization_user) -``` + - `project_id: String` -#### Response + When `group_by=project_id`, this field provides the project ID of the grouped usage result. -```json -{ - "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" - } - ], - "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" - } -} -``` + - `class OrganizationUsageCodeInterpreterSessionsResult` -## Modify user + The aggregated code interpreter sessions usage details of the specific time bucket. -`admin.organization.users.update(user_id, **kwargs) -> OrganizationUser` + - `num_sessions: Integer` -**post** `/organization/users/{user_id}` + The number of code interpreter sessions. -Modifies a user's role in the organization. + - `object: :"organization.usage.code_interpreter_sessions.result"` -### Parameters + - `:"organization.usage.code_interpreter_sessions.result"` -- `user_id: String` + - `project_id: String` -- `developer_persona: String` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - Developer persona metadata. + - `class OrganizationUsageFileSearchesResult` -- `role: String` + The aggregated file search calls usage details of the specific time bucket. - `owner` or `reader` + - `num_requests: Integer` -- `role_id: String` + The count of file search calls. - Role ID to assign to the user. + - `object: :"organization.usage.file_searches.result"` -- `technical_level: String` + - `:"organization.usage.file_searches.result"` - Technical level metadata. + - `api_key_id: String` -### Returns + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. -- `class OrganizationUser` + - `project_id: String` - Represents an individual `user` within an organization. + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `id: String` + - `user_id: String` - The identifier, which can be referenced in API endpoints + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `added_at: Integer` + - `vector_store_id: String` - The Unix timestamp (in seconds) of when the user was added. + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. - - `object: :"organization.user"` + - `class OrganizationUsageWebSearchesResult` - The object type, which is always `organization.user` + The aggregated web search calls usage details of the specific time bucket. - - `:"organization.user"` + - `num_model_requests: Integer` - - `api_key_last_used_at: Integer` + The count of model requests. - The Unix timestamp (in seconds) of the user's last API key usage. + - `num_requests: Integer` - - `created: Integer` + The count of web search calls. - The Unix timestamp (in seconds) of when the user was created. + - `object: :"organization.usage.web_searches.result"` - - `developer_persona: String` + - `:"organization.usage.web_searches.result"` - The developer persona metadata for the user. + - `api_key_id: String` - - `email: String` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - The email address of the user + - `context_level: String` - - `is_default: bool` + When `group_by=context_level`, this field provides the search context size of the grouped usage result. - Whether this is the organization's default user. + - `model: String` - - `is_scale_tier_authorized_purchaser: bool` + When `group_by=model`, this field provides the model name of the grouped usage result. - Whether the user is an authorized purchaser for Scale Tier. + - `project_id: String` - - `is_scim_managed: bool` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - Whether the user is managed through SCIM. + - `user_id: String` - - `is_service_account: bool` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - Whether the user is a service account. + - `class OrganizationCostsResult` - - `name: String` + The aggregated costs details of the specific time bucket. - The name of the user + - `object: :"organization.costs.result"` - - `projects: Projects{ data, object}` + - `:"organization.costs.result"` - Projects associated with the user, if included. + - `amount: Amount{ currency, value}` - - `data: Array[Data{ id, name, role}]` + The monetary value in its associated currency. - - `id: String` + - `currency: String` - - `name: String` + Lowercase ISO-4217 currency e.g. "usd" - - `role: String` + - `value: Float` - - `object: :list` + The numeric value of the cost. - - `:list` + - `api_key_id: String` - - `role: String` + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. - `owner` or `reader` + - `line_item: String` - - `technical_level: String` + When `group_by=line_item`, this field provides the line item of the grouped costs result. - The technical level metadata for the user. + - `project_id: String` - - `user: User{ id, object, banned, 5 more}` + When `group_by=project_id`, this field provides the project ID of the grouped costs result. - Nested user details. + - `quantity: Float` - - `id: String` + When `group_by=line_item`, this field provides the quantity of the grouped costs result. - - `object: :user` + - `start_time: Integer` - - `:user` + - `has_more: bool` - - `banned: bool` + - `next_page: String` - - `banned_at: Integer` + - `object: :page` - - `email: String` + - `:page` - - `enabled: bool` +### Usage Web Search Calls Response - - `name: String` +- `class UsageWebSearchCallsResponse` - - `picture: String` + - `data: Array[Data{ end_time, object, results, start_time}]` -### Example + - `end_time: Integer` -```ruby -require "openai" + - `object: :bucket` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + - `:bucket` -organization_user = openai.admin.organization.users.update("user_id") + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` -puts(organization_user) -``` + - `class OrganizationUsageCompletionsResult` -#### Response + The aggregated completions usage details of the specific time bucket. -```json -{ - "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" - } - ], - "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" - } -} -``` + - `input_tokens: Integer` -## Delete user + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. -`admin.organization.users.delete(user_id) -> UserDeleteResponse` + - `num_model_requests: Integer` -**delete** `/organization/users/{user_id}` + The count of requests made to the model. -Deletes a user from the organization. + - `object: :"organization.usage.completions.result"` -### Parameters + - `:"organization.usage.completions.result"` -- `user_id: String` + - `output_tokens: Integer` -### Returns + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. -- `class UserDeleteResponse` + - `api_key_id: String` - - `id: String` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `deleted: bool` + - `batch: bool` - - `object: :"organization.user.deleted"` + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. - - `:"organization.user.deleted"` + - `input_audio_tokens: Integer` -### Example + The aggregated number of audio input tokens used, including cached tokens. -```ruby -require "openai" + - `input_cached_tokens: Integer` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + 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. -user = openai.admin.organization.users.delete("user_id") + - `model: String` -puts(user) -``` + When `group_by=model`, this field provides the model name of the grouped usage result. -#### Response + - `output_audio_tokens: Integer` -```json -{ - "id": "id", - "deleted": true, - "object": "organization.user.deleted" -} -``` + The aggregated number of audio output tokens used. -## Domain Types + - `project_id: String` -### Organization User + When `group_by=project_id`, this field provides the project ID of the grouped usage result. -- `class OrganizationUser` + - `service_tier: String` - Represents an individual `user` within an organization. + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. - - `id: String` + - `user_id: String` - The identifier, which can be referenced in API endpoints + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `added_at: Integer` + - `class OrganizationUsageEmbeddingsResult` - The Unix timestamp (in seconds) of when the user was added. + The aggregated embeddings usage details of the specific time bucket. - - `object: :"organization.user"` + - `input_tokens: Integer` - The object type, which is always `organization.user` + The aggregated number of input tokens used. - - `:"organization.user"` + - `num_model_requests: Integer` - - `api_key_last_used_at: Integer` + The count of requests made to the model. - The Unix timestamp (in seconds) of the user's last API key usage. + - `object: :"organization.usage.embeddings.result"` - - `created: Integer` + - `:"organization.usage.embeddings.result"` - The Unix timestamp (in seconds) of when the user was created. + - `api_key_id: String` - - `developer_persona: String` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - The developer persona metadata for the user. + - `model: String` - - `email: String` + When `group_by=model`, this field provides the model name of the grouped usage result. - The email address of the user + - `project_id: String` - - `is_default: bool` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - Whether this is the organization's default user. + - `user_id: String` - - `is_scale_tier_authorized_purchaser: bool` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - Whether the user is an authorized purchaser for Scale Tier. + - `class OrganizationUsageModerationsResult` - - `is_scim_managed: bool` + The aggregated moderations usage details of the specific time bucket. - Whether the user is managed through SCIM. + - `input_tokens: Integer` - - `is_service_account: bool` + The aggregated number of input tokens used. - Whether the user is a service account. + - `num_model_requests: Integer` - - `name: String` + The count of requests made to the model. - The name of the user + - `object: :"organization.usage.moderations.result"` - - `projects: Projects{ data, object}` + - `:"organization.usage.moderations.result"` - Projects associated with the user, if included. + - `api_key_id: String` - - `data: Array[Data{ id, name, role}]` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `id: String` + - `model: String` - - `name: String` + When `group_by=model`, this field provides the model name of the grouped usage result. - - `role: String` + - `project_id: String` - - `object: :list` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `:list` + - `user_id: String` - - `role: String` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - `owner` or `reader` + - `class OrganizationUsageImagesResult` - - `technical_level: String` + The aggregated images usage details of the specific time bucket. - The technical level metadata for the user. + - `images: Integer` - - `user: User{ id, object, banned, 5 more}` + The number of images processed. - Nested user details. + - `num_model_requests: Integer` - - `id: String` + The count of requests made to the model. - - `object: :user` + - `object: :"organization.usage.images.result"` - - `:user` + - `:"organization.usage.images.result"` - - `banned: bool` + - `api_key_id: String` - - `banned_at: Integer` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `email: String` + - `model: String` - - `enabled: bool` + When `group_by=model`, this field provides the model name of the grouped usage result. - - `name: String` + - `project_id: String` - - `picture: String` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. -### User Delete Response + - `size: String` -- `class UserDeleteResponse` + When `group_by=size`, this field provides the image size of the grouped usage result. - - `id: String` + - `source: String` - - `deleted: bool` + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. - - `object: :"organization.user.deleted"` + - `user_id: String` - - `:"organization.user.deleted"` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. -# Roles + - `class OrganizationUsageAudioSpeechesResult` -## List user organization role assignments + The aggregated audio speeches usage details of the specific time bucket. -`admin.organization.users.roles.list(user_id, **kwargs) -> NextCursorPage` + - `characters: Integer` -**get** `/organization/users/{user_id}/roles` + The number of characters processed. -Lists the organization roles assigned to a user within the organization. + - `num_model_requests: Integer` -### Parameters + The count of requests made to the model. -- `user_id: String` + - `object: :"organization.usage.audio_speeches.result"` -- `after: String` + - `:"organization.usage.audio_speeches.result"` - Cursor for pagination. Provide the value from the previous response's `next` field to continue listing organization roles. + - `api_key_id: String` -- `limit: Integer` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - A limit on the number of organization role assignments to return. + - `model: String` -- `order: :asc | :desc` + When `group_by=model`, this field provides the model name of the grouped usage result. - Sort order for the returned organization roles. + - `project_id: String` - - `:asc` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `:desc` + - `user_id: String` -### Returns + When `group_by=user_id`, this field provides the user ID of the grouped usage result. -- `class RoleListResponse` + - `class OrganizationUsageAudioTranscriptionsResult` - Detailed information about a role assignment entry returned when listing assignments. + The aggregated audio transcriptions usage details of the specific time bucket. - - `id: String` + - `num_model_requests: Integer` - Identifier for the role. + The count of requests made to the model. - - `created_at: Integer` + - `object: :"organization.usage.audio_transcriptions.result"` - When the role was created. + - `:"organization.usage.audio_transcriptions.result"` - - `created_by: String` + - `seconds: Integer` - Identifier of the actor who created the role. + The number of seconds processed. - - `created_by_user_obj: Hash[Symbol, untyped]` + - `api_key_id: String` - User details for the actor that created the role, when available. + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `description: String` + - `model: String` - Description of the role. + When `group_by=model`, this field provides the model name of the grouped usage result. - - `metadata: Hash[Symbol, untyped]` + - `project_id: String` - Arbitrary metadata stored on the role. + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `name: String` + - `user_id: String` - Name of the role. + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `permissions: Array[String]` + - `class OrganizationUsageVectorStoresResult` - Permissions associated with the role. + The aggregated vector stores usage details of the specific time bucket. - - `predefined_role: bool` + - `object: :"organization.usage.vector_stores.result"` - Whether the role is predefined by OpenAI. + - `:"organization.usage.vector_stores.result"` - - `resource_type: String` + - `usage_bytes: Integer` - Resource type the role applies to. + The vector stores usage in bytes. - - `updated_at: Integer` + - `project_id: String` - When the role was last updated. + When `group_by=project_id`, this field provides the project ID of the grouped usage result. -### Example + - `class OrganizationUsageCodeInterpreterSessionsResult` -```ruby -require "openai" + The aggregated code interpreter sessions usage details of the specific time bucket. -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + - `num_sessions: Integer` -page = openai.admin.organization.users.roles.list("user_id") + The number of code interpreter sessions. -puts(page) -``` + - `object: :"organization.usage.code_interpreter_sessions.result"` -#### Response + - `:"organization.usage.code_interpreter_sessions.result"` -```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" -} -``` + - `project_id: String` -## Assign organization role to user + When `group_by=project_id`, this field provides the project ID of the grouped usage result. -`admin.organization.users.roles.create(user_id, **kwargs) -> RoleCreateResponse` + - `class OrganizationUsageFileSearchesResult` -**post** `/organization/users/{user_id}/roles` + The aggregated file search calls usage details of the specific time bucket. -Assigns an organization role to a user within the organization. + - `num_requests: Integer` -### Parameters + The count of file search calls. -- `user_id: String` + - `object: :"organization.usage.file_searches.result"` -- `role_id: String` + - `:"organization.usage.file_searches.result"` - Identifier of the role to assign. + - `api_key_id: String` -### Returns + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. -- `class RoleCreateResponse` + - `project_id: String` - Role assignment linking a user to a role. + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `object: :"user.role"` + - `user_id: String` - Always `user.role`. + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `:"user.role"` + - `vector_store_id: String` - - `role: Role` + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. - Details about a role that can be assigned through the public Roles API. + - `class OrganizationUsageWebSearchesResult` - - `id: String` + The aggregated web search calls usage details of the specific time bucket. - Identifier for the role. + - `num_model_requests: Integer` - - `description: String` + The count of model requests. - Optional description of the role. + - `num_requests: Integer` - - `name: String` + The count of web search calls. - Unique name for the role. + - `object: :"organization.usage.web_searches.result"` - - `object: :role` + - `:"organization.usage.web_searches.result"` - Always `role`. + - `api_key_id: String` - - `:role` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `permissions: Array[String]` + - `context_level: String` - Permissions granted by the role. + When `group_by=context_level`, this field provides the search context size of the grouped usage result. - - `predefined_role: bool` + - `model: String` - Whether the role is predefined and managed by OpenAI. + When `group_by=model`, this field provides the model name of the grouped usage result. - - `resource_type: String` + - `project_id: String` - Resource type the role is bound to (for example `api.organization` or `api.project`). + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `user: OrganizationUser` + - `user_id: String` - Represents an individual `user` within an organization. + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `id: String` + - `class OrganizationCostsResult` - The identifier, which can be referenced in API endpoints + The aggregated costs details of the specific time bucket. - - `added_at: Integer` + - `object: :"organization.costs.result"` - The Unix timestamp (in seconds) of when the user was added. + - `:"organization.costs.result"` - - `object: :"organization.user"` + - `amount: Amount{ currency, value}` - The object type, which is always `organization.user` + The monetary value in its associated currency. - - `:"organization.user"` + - `currency: String` - - `api_key_last_used_at: Integer` + Lowercase ISO-4217 currency e.g. "usd" - The Unix timestamp (in seconds) of the user's last API key usage. + - `value: Float` - - `created: Integer` + The numeric value of the cost. - The Unix timestamp (in seconds) of when the user was created. + - `api_key_id: String` - - `developer_persona: String` + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. - The developer persona metadata for the user. + - `line_item: String` - - `email: String` + When `group_by=line_item`, this field provides the line item of the grouped costs result. - The email address of the user + - `project_id: String` - - `is_default: bool` + When `group_by=project_id`, this field provides the project ID of the grouped costs result. - Whether this is the organization's default user. + - `quantity: Float` - - `is_scale_tier_authorized_purchaser: bool` + When `group_by=line_item`, this field provides the quantity of the grouped costs result. - Whether the user is an authorized purchaser for Scale Tier. + - `start_time: Integer` - - `is_scim_managed: bool` + - `has_more: bool` - Whether the user is managed through SCIM. + - `next_page: String` - - `is_service_account: bool` + - `object: :page` - Whether the user is a service account. + - `:page` - - `name: String` +### Usage Costs Response - The name of the user +- `class UsageCostsResponse` - - `projects: Projects{ data, object}` + - `data: Array[Data{ end_time, object, results, start_time}]` - Projects associated with the user, if included. + - `end_time: Integer` - - `data: Array[Data{ id, name, role}]` + - `object: :bucket` - - `id: String` + - `:bucket` - - `name: String` + - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]` - - `role: String` + - `class OrganizationUsageCompletionsResult` - - `object: :list` + The aggregated completions usage details of the specific time bucket. - - `:list` + - `input_tokens: Integer` - - `role: String` + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. - `owner` or `reader` + - `num_model_requests: Integer` - - `technical_level: String` + The count of requests made to the model. - The technical level metadata for the user. + - `object: :"organization.usage.completions.result"` - - `user: User{ id, object, banned, 5 more}` + - `:"organization.usage.completions.result"` - Nested user details. + - `output_tokens: Integer` - - `id: String` + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. - - `object: :user` + - `api_key_id: String` - - `:user` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `banned: bool` + - `batch: bool` - - `banned_at: Integer` + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. - - `email: String` + - `input_audio_tokens: Integer` - - `enabled: bool` + The aggregated number of audio input tokens used, including cached tokens. - - `name: String` + - `input_cached_tokens: Integer` - - `picture: String` + 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. -### Example + - `model: String` -```ruby -require "openai" + When `group_by=model`, this field provides the model name of the grouped usage result. -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + - `output_audio_tokens: Integer` -role = openai.admin.organization.users.roles.create("user_id", role_id: "role_id") + The aggregated number of audio output tokens used. -puts(role) -``` + - `project_id: String` -#### Response + When `group_by=project_id`, this field provides the project ID of the grouped usage result. -```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", - "name": "name", - "role": "role" - } - ], - "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" - } - } -} -``` + - `service_tier: String` -## Unassign organization role from user + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. -`admin.organization.users.roles.delete(role_id, **kwargs) -> RoleDeleteResponse` + - `user_id: String` -**delete** `/organization/users/{user_id}/roles/{role_id}` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. -Unassigns an organization role from a user within the organization. + - `class OrganizationUsageEmbeddingsResult` -### Parameters + The aggregated embeddings usage details of the specific time bucket. -- `user_id: String` + - `input_tokens: Integer` -- `role_id: String` + The aggregated number of input tokens used. -### Returns + - `num_model_requests: Integer` -- `class RoleDeleteResponse` + The count of requests made to the model. - Confirmation payload returned after unassigning a role. + - `object: :"organization.usage.embeddings.result"` - - `deleted: bool` + - `:"organization.usage.embeddings.result"` - Whether the assignment was removed. + - `api_key_id: String` - - `object: String` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + - `model: String` -### Example + When `group_by=model`, this field provides the model name of the grouped usage result. -```ruby -require "openai" + - `project_id: String` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + When `group_by=project_id`, this field provides the project ID of the grouped usage result. -role = openai.admin.organization.users.roles.delete("role_id", user_id: "user_id") + - `user_id: String` -puts(role) -``` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. -#### Response + - `class OrganizationUsageModerationsResult` -```json -{ - "deleted": true, - "object": "object" -} -``` + The aggregated moderations usage details of the specific time bucket. -## Domain Types + - `input_tokens: Integer` -### Role List Response + The aggregated number of input tokens used. -- `class RoleListResponse` + - `num_model_requests: Integer` - Detailed information about a role assignment entry returned when listing assignments. + The count of requests made to the model. - - `id: String` + - `object: :"organization.usage.moderations.result"` - Identifier for the role. + - `:"organization.usage.moderations.result"` - - `created_at: Integer` + - `api_key_id: String` - When the role was created. + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `created_by: String` + - `model: String` - Identifier of the actor who created the role. + When `group_by=model`, this field provides the model name of the grouped usage result. - - `created_by_user_obj: Hash[Symbol, untyped]` + - `project_id: String` - User details for the actor that created the role, when available. + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `description: String` + - `user_id: String` - Description of the role. + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `metadata: Hash[Symbol, untyped]` + - `class OrganizationUsageImagesResult` - Arbitrary metadata stored on the role. + The aggregated images usage details of the specific time bucket. - - `name: String` + - `images: Integer` - Name of the role. + The number of images processed. - - `permissions: Array[String]` + - `num_model_requests: Integer` - Permissions associated with the role. + The count of requests made to the model. - - `predefined_role: bool` + - `object: :"organization.usage.images.result"` - Whether the role is predefined by OpenAI. + - `:"organization.usage.images.result"` - - `resource_type: String` + - `api_key_id: String` - Resource type the role applies to. + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `updated_at: Integer` + - `model: String` - When the role was last updated. + When `group_by=model`, this field provides the model name of the grouped usage result. -### Role Create Response + - `project_id: String` -- `class RoleCreateResponse` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - Role assignment linking a user to a role. + - `size: String` - - `object: :"user.role"` + When `group_by=size`, this field provides the image size of the grouped usage result. - Always `user.role`. + - `source: String` - - `:"user.role"` + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. - - `role: Role` + - `user_id: String` - Details about a role that can be assigned through the public Roles API. + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `id: String` + - `class OrganizationUsageAudioSpeechesResult` - Identifier for the role. + The aggregated audio speeches usage details of the specific time bucket. - - `description: String` + - `characters: Integer` - Optional description of the role. + The number of characters processed. - - `name: String` + - `num_model_requests: Integer` - Unique name for the role. + The count of requests made to the model. - - `object: :role` + - `object: :"organization.usage.audio_speeches.result"` - Always `role`. + - `:"organization.usage.audio_speeches.result"` - - `:role` + - `api_key_id: String` - - `permissions: Array[String]` + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - Permissions granted by the role. + - `model: String` - - `predefined_role: bool` + When `group_by=model`, this field provides the model name of the grouped usage result. - Whether the role is predefined and managed by OpenAI. + - `project_id: String` - - `resource_type: String` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - Resource type the role is bound to (for example `api.organization` or `api.project`). + - `user_id: String` - - `user: OrganizationUser` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - Represents an individual `user` within an organization. + - `class OrganizationUsageAudioTranscriptionsResult` - - `id: String` + The aggregated audio transcriptions usage details of the specific time bucket. - The identifier, which can be referenced in API endpoints + - `num_model_requests: Integer` - - `added_at: Integer` + The count of requests made to the model. - The Unix timestamp (in seconds) of when the user was added. + - `object: :"organization.usage.audio_transcriptions.result"` - - `object: :"organization.user"` + - `:"organization.usage.audio_transcriptions.result"` - The object type, which is always `organization.user` + - `seconds: Integer` - - `:"organization.user"` + The number of seconds processed. - - `api_key_last_used_at: Integer` + - `api_key_id: String` - The Unix timestamp (in seconds) of the user's last API key usage. + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `created: Integer` + - `model: String` - The Unix timestamp (in seconds) of when the user was created. + When `group_by=model`, this field provides the model name of the grouped usage result. - - `developer_persona: String` + - `project_id: String` - The developer persona metadata for the user. + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `email: String` + - `user_id: String` - The email address of the user + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `is_default: bool` + - `class OrganizationUsageVectorStoresResult` - Whether this is the organization's default user. + The aggregated vector stores usage details of the specific time bucket. - - `is_scale_tier_authorized_purchaser: bool` + - `object: :"organization.usage.vector_stores.result"` - Whether the user is an authorized purchaser for Scale Tier. + - `:"organization.usage.vector_stores.result"` - - `is_scim_managed: bool` + - `usage_bytes: Integer` - Whether the user is managed through SCIM. + The vector stores usage in bytes. - - `is_service_account: bool` + - `project_id: String` - Whether the user is a service account. + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `name: String` + - `class OrganizationUsageCodeInterpreterSessionsResult` - The name of the user + The aggregated code interpreter sessions usage details of the specific time bucket. - - `projects: Projects{ data, object}` + - `num_sessions: Integer` - Projects associated with the user, if included. + The number of code interpreter sessions. - - `data: Array[Data{ id, name, role}]` + - `object: :"organization.usage.code_interpreter_sessions.result"` - - `id: String` + - `:"organization.usage.code_interpreter_sessions.result"` - - `name: String` + - `project_id: String` - - `role: String` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `object: :list` + - `class OrganizationUsageFileSearchesResult` - - `:list` + The aggregated file search calls usage details of the specific time bucket. - - `role: String` + - `num_requests: Integer` - `owner` or `reader` + The count of file search calls. - - `technical_level: String` + - `object: :"organization.usage.file_searches.result"` - The technical level metadata for the user. + - `:"organization.usage.file_searches.result"` - - `user: User{ id, object, banned, 5 more}` + - `api_key_id: String` - Nested user details. + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - `id: String` + - `project_id: String` - - `object: :user` + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `:user` + - `user_id: String` - - `banned: bool` + When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `banned_at: Integer` + - `vector_store_id: String` - - `email: String` + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. - - `enabled: bool` + - `class OrganizationUsageWebSearchesResult` - - `name: String` + The aggregated web search calls usage details of the specific time bucket. - - `picture: String` + - `num_model_requests: Integer` -### Role Delete Response + The count of model requests. -- `class RoleDeleteResponse` + - `num_requests: Integer` - Confirmation payload returned after unassigning a role. + The count of web search calls. - - `deleted: bool` + - `object: :"organization.usage.web_searches.result"` - Whether the assignment was removed. + - `:"organization.usage.web_searches.result"` - - `object: String` + - `api_key_id: String` - Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. -# Groups + - `context_level: String` -## List groups + When `group_by=context_level`, this field provides the search context size of the grouped usage result. -`admin.organization.groups.list(**kwargs) -> NextCursorPage` + - `model: String` -**get** `/organization/groups` + When `group_by=model`, this field provides the model name of the grouped usage result. -Lists all groups in the organization. + - `project_id: String` -### Parameters + When `group_by=project_id`, this field provides the project ID of the grouped usage result. -- `after: String` + - `user_id: String` - A cursor for use in pagination. `after` is a group ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with group_abc, your subsequent call can include `after=group_abc` in order to fetch the next page of the list. + When `group_by=user_id`, this field provides the user ID of the grouped usage result. -- `limit: Integer` + - `class OrganizationCostsResult` - A limit on the number of groups to be returned. Limit can range between 0 and 1000, and the default is 100. + The aggregated costs details of the specific time bucket. -- `order: :asc | :desc` + - `object: :"organization.costs.result"` - Specifies the sort order of the returned groups. + - `:"organization.costs.result"` - - `:asc` + - `amount: Amount{ currency, value}` - - `:desc` + The monetary value in its associated currency. -### Returns + - `currency: String` -- `class Group` + Lowercase ISO-4217 currency e.g. "usd" - Details about an organization group. + - `value: Float` - - `id: String` + The numeric value of the cost. - Identifier for the group. + - `api_key_id: String` - - `created_at: Integer` + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. - Unix timestamp (in seconds) when the group was created. + - `line_item: String` - - `group_type: String` + When `group_by=line_item`, this field provides the line item of the grouped costs result. - The type of the group. + - `project_id: String` - - `is_scim_managed: bool` + When `group_by=project_id`, this field provides the project ID of the grouped costs result. - Whether the group is managed through SCIM and controlled by your identity provider. + - `quantity: Float` - - `name: String` + When `group_by=line_item`, this field provides the quantity of the grouped costs result. - Display name of the group. + - `start_time: Integer` -### Example + - `has_more: bool` -```ruby -require "openai" + - `next_page: String` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + - `object: :page` -page = openai.admin.organization.groups.list + - `:page` -puts(page) -``` +# Invites -#### Response +## List invites -```json -{ - "data": [ - { - "id": "id", - "created_at": 0, - "group_type": "group_type", - "is_scim_managed": true, - "name": "name" - } - ], - "has_more": true, - "next": "next", - "object": "list" -} -``` +`admin.organization.invites.list(**kwargs) -> ConversationCursorPage` -## Create group +**get** `/organization/invites` -`admin.organization.groups.create(**kwargs) -> Group` +Returns a list of invites in the organization. -**post** `/organization/groups` +### Parameters -Creates a new group in the organization. +- `after: String` -### Parameters + 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. -- `name: String` +- `limit: Integer` - Human readable name for the group. + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. ### Returns -- `class Group` +- `class Invite` - Details about an organization group. + Represents an individual `invite` to the organization. - `id: String` - Identifier for the group. + The identifier, which can be referenced in API endpoints - `created_at: Integer` - Unix timestamp (in seconds) when the group was created. - - - `group_type: String` - - The type of the group. - - - `is_scim_managed: bool` - - Whether the group is managed through SCIM and controlled by your identity provider. - - - `name: String` - - Display name of the group. + The Unix timestamp (in seconds) of when the invite was sent. -### Example + - `email: String` -```ruby -require "openai" + The email address of the individual to whom the invite was sent -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + - `object: :"organization.invite"` -group = openai.admin.organization.groups.create(name: "x") + The object type, which is always `organization.invite` -puts(group) -``` + - `:"organization.invite"` -#### Response + - `projects: Array[Project{ id, role}]` -```json -{ - "id": "id", - "created_at": 0, - "group_type": "group_type", - "is_scim_managed": true, - "name": "name" -} -``` + The projects that were granted membership upon acceptance of the invite. -## Update group + - `id: String` -`admin.organization.groups.update(group_id, **kwargs) -> GroupUpdateResponse` + Project's public ID -**post** `/organization/groups/{group_id}` + - `role: :member | :owner` -Updates a group's information. + Project membership role -### Parameters + - `:member` -- `group_id: String` + - `:owner` -- `name: String` + - `role: :owner | :reader` - New display name for the group. + `owner` or `reader` -### Returns + - `:owner` -- `class GroupUpdateResponse` + - `:reader` - Response returned after updating a group. + - `status: :accepted | :expired | :pending` - - `id: String` + `accepted`,`expired`, or `pending` - Identifier for the group. + - `:accepted` - - `created_at: Integer` + - `:expired` - Unix timestamp (in seconds) when the group was created. + - `:pending` - - `is_scim_managed: bool` + - `accepted_at: Integer` - Whether the group is managed through SCIM and controlled by your identity provider. + The Unix timestamp (in seconds) of when the invite was accepted. - - `name: String` + - `expires_at: Integer` - Updated display name for the group. + The Unix timestamp (in seconds) of when the invite expires. ### Example @@ -11400,258 +12394,254 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -group = openai.admin.organization.groups.update("group_id", name: "x") +page = openai.admin.organization.invites.list -puts(group) +puts(page) ``` #### Response ```json { + "data": [ + { "id": "id", "created_at": 0, - "is_scim_managed": true, - "name": "name" + "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" } ``` -## Delete group +## Create invite -`admin.organization.groups.delete(group_id) -> GroupDeleteResponse` +`admin.organization.invites.create(**kwargs) -> Invite` -**delete** `/organization/groups/{group_id}` +**post** `/organization/invites` -Deletes a group from the organization. +Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization. ### Parameters -- `group_id: String` +- `email: String` -### Returns + Send an email to this address -- `class GroupDeleteResponse` +- `role: :reader | :owner` - Confirmation payload returned after deleting a group. + `owner` or `reader` - - `id: String` + - `:reader` - Identifier of the deleted group. + - `:owner` - - `deleted: bool` +- `projects: Array[Project{ id, role}]` - Whether the group was deleted. + 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. - - `object: :"group.deleted"` + - `id: String` - Always `group.deleted`. + Project's public ID - - `:"group.deleted"` + - `role: :member | :owner` -### Example + Project membership role -```ruby -require "openai" + - `:member` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + - `:owner` -group = openai.admin.organization.groups.delete("group_id") +### Returns -puts(group) -``` +- `class Invite` -#### Response + Represents an individual `invite` to the organization. -```json -{ - "id": "id", - "deleted": true, - "object": "group.deleted" -} -``` + - `id: String` -## Domain Types + The identifier, which can be referenced in API endpoints -### Group + - `created_at: Integer` -- `class Group` + The Unix timestamp (in seconds) of when the invite was sent. - Details about an organization group. + - `email: String` - - `id: String` + The email address of the individual to whom the invite was sent - Identifier for the group. + - `object: :"organization.invite"` - - `created_at: Integer` + The object type, which is always `organization.invite` - Unix timestamp (in seconds) when the group was created. + - `:"organization.invite"` - - `group_type: String` + - `projects: Array[Project{ id, role}]` - The type of the group. + The projects that were granted membership upon acceptance of the invite. - - `is_scim_managed: bool` + - `id: String` - Whether the group is managed through SCIM and controlled by your identity provider. + Project's public ID - - `name: String` + - `role: :member | :owner` - Display name of the group. + Project membership role -### Group Update Response + - `:member` -- `class GroupUpdateResponse` + - `:owner` - Response returned after updating a group. + - `role: :owner | :reader` - - `id: String` + `owner` or `reader` - Identifier for the group. + - `:owner` - - `created_at: Integer` + - `:reader` - Unix timestamp (in seconds) when the group was created. + - `status: :accepted | :expired | :pending` - - `is_scim_managed: bool` + `accepted`,`expired`, or `pending` - Whether the group is managed through SCIM and controlled by your identity provider. + - `:accepted` - - `name: String` + - `:expired` - Updated display name for the group. + - `:pending` -### Group Delete Response + - `accepted_at: Integer` -- `class GroupDeleteResponse` + The Unix timestamp (in seconds) of when the invite was accepted. - Confirmation payload returned after deleting a group. + - `expires_at: Integer` - - `id: String` + The Unix timestamp (in seconds) of when the invite expires. - Identifier of the deleted group. +### Example - - `deleted: bool` +```ruby +require "openai" - Whether the group was deleted. +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") - - `object: :"group.deleted"` +invite = openai.admin.organization.invites.create(email: "email", role: :reader) - Always `group.deleted`. +puts(invite) +``` - - `:"group.deleted"` +#### Response -# Users +```json +{ + "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 +} +``` -## List group users +## Retrieve invite -`admin.organization.groups.users.list(group_id, **kwargs) -> NextCursorPage` +`admin.organization.invites.retrieve(invite_id) -> Invite` -**get** `/organization/groups/{group_id}/users` +**get** `/organization/invites/{invite_id}` -Lists the users assigned to a group. +Retrieves an invite. ### Parameters -- `group_id: String` - -- `after: String` - - A cursor for use in pagination. Provide the ID of the last user from the previous list response to retrieve the next page. - -- `limit: Integer` - - A limit on the number of users to be returned. Limit can range between 0 and 1000, and the default is 100. - -- `order: :asc | :desc` - - Specifies the sort order of users in the list. - - - `:asc` - - - `:desc` +- `invite_id: String` ### Returns -- `class OrganizationGroupUser` +- `class Invite` - Represents an individual user returned when inspecting group membership. + Represents an individual `invite` to the organization. - `id: String` The identifier, which can be referenced in API endpoints - - `email: String` - - The email address of the user. + - `created_at: Integer` - - `name: String` + The Unix timestamp (in seconds) of when the invite was sent. - The name of the user. + - `email: String` -### Example + The email address of the individual to whom the invite was sent -```ruby -require "openai" + - `object: :"organization.invite"` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + The object type, which is always `organization.invite` -page = openai.admin.organization.groups.users.list("group_id") + - `:"organization.invite"` -puts(page) -``` + - `projects: Array[Project{ id, role}]` -#### Response + The projects that were granted membership upon acceptance of the invite. -```json -{ - "data": [ - { - "id": "id", - "email": "email", - "name": "name" - } - ], - "has_more": true, - "next": "next", - "object": "list" -} -``` + - `id: String` -## Add group user + Project's public ID -`admin.organization.groups.users.create(group_id, **kwargs) -> UserCreateResponse` + - `role: :member | :owner` -**post** `/organization/groups/{group_id}/users` + Project membership role -Adds a user to a group. + - `:member` -### Parameters + - `:owner` -- `group_id: String` + - `role: :owner | :reader` -- `user_id: String` + `owner` or `reader` - Identifier of the user to add to the group. + - `:owner` -### Returns + - `:reader` -- `class UserCreateResponse` + - `status: :accepted | :expired | :pending` - Confirmation payload returned after adding a user to a group. + `accepted`,`expired`, or `pending` - - `group_id: String` + - `:accepted` - Identifier of the group the user was added to. + - `:expired` - - `object: :"group.user"` + - `:pending` - Always `group.user`. + - `accepted_at: Integer` - - `:"group.user"` + The Unix timestamp (in seconds) of when the invite was accepted. - - `user_id: String` + - `expires_at: Integer` - Identifier of the user that was added. + The Unix timestamp (in seconds) of when the invite expires. ### Example @@ -11660,50 +12650,57 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -user = openai.admin.organization.groups.users.create("group_id", user_id: "user_id") +invite = openai.admin.organization.invites.retrieve("invite_id") -puts(user) +puts(invite) ``` #### Response ```json { - "group_id": "group_id", - "object": "group.user", - "user_id": "user_id" + "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 } ``` -## Remove group user +## Delete invite -`admin.organization.groups.users.delete(user_id, **kwargs) -> UserDeleteResponse` +`admin.organization.invites.delete(invite_id) -> InviteDeleteResponse` -**delete** `/organization/groups/{group_id}/users/{user_id}` +**delete** `/organization/invites/{invite_id}` -Removes a user from a group. +Delete an invite. If the invite has already been accepted, it cannot be deleted. ### Parameters -- `group_id: String` - -- `user_id: String` +- `invite_id: String` ### Returns -- `class UserDeleteResponse` +- `class InviteDeleteResponse` - Confirmation payload returned after removing a user from a group. + - `id: String` - `deleted: bool` - Whether the group membership was removed. - - - `object: :"group.user.deleted"` + - `object: :"organization.invite.deleted"` - Always `group.user.deleted`. + The object type, which is always `organization.invite.deleted` - - `:"group.user.deleted"` + - `:"organization.invite.deleted"` ### Example @@ -11712,286 +12709,228 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -user = openai.admin.organization.groups.users.delete("user_id", group_id: "group_id") +invite = openai.admin.organization.invites.delete("invite_id") -puts(user) +puts(invite) ``` #### Response ```json { + "id": "id", "deleted": true, - "object": "group.user.deleted" + "object": "organization.invite.deleted" } ``` ## Domain Types -### Organization Group User +### Invite -- `class OrganizationGroupUser` +- `class Invite` - Represents an individual user returned when inspecting group membership. + Represents an individual `invite` to the organization. - `id: String` The identifier, which can be referenced in API endpoints - - `email: String` + - `created_at: Integer` - The email address of the user. + The Unix timestamp (in seconds) of when the invite was sent. - - `name: String` + - `email: String` - The name of the user. + The email address of the individual to whom the invite was sent -### User Create Response + - `object: :"organization.invite"` -- `class UserCreateResponse` + The object type, which is always `organization.invite` - Confirmation payload returned after adding a user to a group. + - `:"organization.invite"` - - `group_id: String` + - `projects: Array[Project{ id, role}]` - Identifier of the group the user was added to. + The projects that were granted membership upon acceptance of the invite. - - `object: :"group.user"` + - `id: String` - Always `group.user`. + Project's public ID - - `:"group.user"` + - `role: :member | :owner` - - `user_id: String` + Project membership role - Identifier of the user that was added. + - `:member` -### User Delete Response + - `:owner` -- `class UserDeleteResponse` + - `role: :owner | :reader` - Confirmation payload returned after removing a user from a group. + `owner` or `reader` - - `deleted: bool` + - `:owner` - Whether the group membership was removed. + - `:reader` - - `object: :"group.user.deleted"` + - `status: :accepted | :expired | :pending` - Always `group.user.deleted`. + `accepted`,`expired`, or `pending` - - `:"group.user.deleted"` + - `:accepted` -# Roles + - `:expired` -## List group organization role assignments + - `:pending` -`admin.organization.groups.roles.list(group_id, **kwargs) -> NextCursorPage` + - `accepted_at: Integer` -**get** `/organization/groups/{group_id}/roles` + The Unix timestamp (in seconds) of when the invite was accepted. -Lists the organization roles assigned to a group within the organization. + - `expires_at: Integer` -### Parameters + The Unix timestamp (in seconds) of when the invite expires. -- `group_id: String` +### Invite Delete Response -- `after: String` +- `class InviteDeleteResponse` - Cursor for pagination. Provide the value from the previous response's `next` field to continue listing organization roles. + - `id: String` -- `limit: Integer` + - `deleted: bool` - A limit on the number of organization role assignments to return. - -- `order: :asc | :desc` - - Sort order for the returned organization roles. - - - `:asc` - - - `:desc` + - `object: :"organization.invite.deleted"` -### Returns + The object type, which is always `organization.invite.deleted` -- `class RoleListResponse` + - `:"organization.invite.deleted"` - Detailed information about a role assignment entry returned when listing assignments. +# Users - - `id: String` +## List users - Identifier for the role. +`admin.organization.users.list(**kwargs) -> ConversationCursorPage` - - `created_at: Integer` +**get** `/organization/users` - When the role was created. +Lists all of the users in the organization. - - `created_by: String` +### Parameters - Identifier of the actor who created the role. +- `after: String` - - `created_by_user_obj: Hash[Symbol, untyped]` + 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. - User details for the actor that created the role, when available. +- `emails: Array[String]` - - `description: String` + Filter by the email address of users. - Description of the role. +- `limit: Integer` - - `metadata: Hash[Symbol, untyped]` + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - Arbitrary metadata stored on the role. +### Returns - - `name: String` +- `class OrganizationUser` - Name of the role. + Represents an individual `user` within an organization. - - `permissions: Array[String]` + - `id: String` - Permissions associated with the role. + The identifier, which can be referenced in API endpoints - - `predefined_role: bool` + - `added_at: Integer` - Whether the role is predefined by OpenAI. + The Unix timestamp (in seconds) of when the user was added. - - `resource_type: String` + - `object: :"organization.user"` - Resource type the role applies to. + The object type, which is always `organization.user` - - `updated_at: Integer` + - `:"organization.user"` - When the role was last updated. + - `api_key_last_used_at: Integer` -### Example + The Unix timestamp (in seconds) of the user's last API key usage. -```ruby -require "openai" + - `created: Integer` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + The Unix timestamp (in seconds) of when the user was created. -page = openai.admin.organization.groups.roles.list("group_id") + - `developer_persona: String` -puts(page) -``` + The developer persona metadata for the user. -#### Response + - `email: String` -```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" -} -``` + The email address of the user -## Assign organization role to group + - `is_default: bool` -`admin.organization.groups.roles.create(group_id, **kwargs) -> RoleCreateResponse` + Whether this is the organization's default user. -**post** `/organization/groups/{group_id}/roles` + - `is_scale_tier_authorized_purchaser: bool` -Assigns an organization role to a group within the organization. + Whether the user is an authorized purchaser for Scale Tier. -### Parameters + - `is_scim_managed: bool` -- `group_id: String` + Whether the user is managed through SCIM. -- `role_id: String` + - `is_service_account: bool` - Identifier of the role to assign. + Whether the user is a service account. -### Returns + - `name: String` -- `class RoleCreateResponse` + The name of the user - Role assignment linking a group to a role. + - `projects: Projects{ data, object}` - - `group: Group{ id, created_at, name, 2 more}` + Projects associated with the user, if included. - Summary information about a group returned in role assignment responses. + - `data: Array[Data{ id, name, role}]` - `id: String` - Identifier for the group. - - - `created_at: Integer` - - Unix timestamp (in seconds) when the group was created. - - `name: String` - Display name of the group. - - - `object: :group` - - Always `group`. + - `role: String` - - `:group` + - `object: :list` - - `scim_managed: bool` + - `:list` - Whether the group is managed through SCIM. + - `role: String` - - `object: :"group.role"` + `owner` or `reader` - Always `group.role`. + - `technical_level: String` - - `:"group.role"` + The technical level metadata for the user. - - `role: Role` + - `user: User{ id, object, banned, 5 more}` - Details about a role that can be assigned through the public Roles API. + Nested user details. - `id: String` - Identifier for the role. - - - `description: String` - - Optional description of the role. - - - `name: String` - - Unique name for the role. - - - `object: :role` - - Always `role`. + - `object: :user` - - `:role` + - `:user` - - `permissions: Array[String]` + - `banned: bool` - Permissions granted by the role. + - `banned_at: Integer` - - `predefined_role: bool` + - `email: String` - Whether the role is predefined and managed by OpenAI. + - `enabled: bool` - - `resource_type: String` + - `name: String` - Resource type the role is bound to (for example `api.organization` or `api.project`). + - `picture: String` ### Example @@ -12000,287 +12939,356 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -role = openai.admin.organization.groups.roles.create("group_id", role_id: "role_id") +page = openai.admin.organization.users.list -puts(role) +puts(page) ``` #### Response ```json { - "group": { + "data": [ + { "id": "id", - "created_at": 0, + "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", - "object": "group", - "scim_managed": true - }, - "object": "group.role", - "role": { + "projects": { + "data": [ + { "id": "id", - "description": "description", "name": "name", - "object": "role", - "permissions": [ - "string" + "role": "role" + } ], - "predefined_role": true, - "resource_type": "resource_type" + "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" } ``` -## Unassign organization role from group +## Retrieve user -`admin.organization.groups.roles.delete(role_id, **kwargs) -> RoleDeleteResponse` +`admin.organization.users.retrieve(user_id) -> OrganizationUser` -**delete** `/organization/groups/{group_id}/roles/{role_id}` +**get** `/organization/users/{user_id}` -Unassigns an organization role from a group within the organization. +Retrieves a user by their identifier. ### Parameters -- `group_id: String` - -- `role_id: String` +- `user_id: String` ### Returns -- `class RoleDeleteResponse` +- `class OrganizationUser` - Confirmation payload returned after unassigning a role. + Represents an individual `user` within an organization. - - `deleted: bool` + - `id: String` - Whether the assignment was removed. + The identifier, which can be referenced in API endpoints - - `object: String` + - `added_at: Integer` - Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + The Unix timestamp (in seconds) of when the user was added. -### Example + - `object: :"organization.user"` -```ruby -require "openai" + The object type, which is always `organization.user` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + - `:"organization.user"` -role = openai.admin.organization.groups.roles.delete("role_id", group_id: "group_id") + - `api_key_last_used_at: Integer` -puts(role) -``` + The Unix timestamp (in seconds) of the user's last API key usage. -#### Response + - `created: Integer` -```json -{ - "deleted": true, - "object": "object" -} -``` + The Unix timestamp (in seconds) of when the user was created. -## Domain Types + - `developer_persona: String` -### Role List Response + The developer persona metadata for the user. -- `class RoleListResponse` + - `email: String` - Detailed information about a role assignment entry returned when listing assignments. + The email address of the user - - `id: String` + - `is_default: bool` - Identifier for the role. + Whether this is the organization's default user. - - `created_at: Integer` + - `is_scale_tier_authorized_purchaser: bool` - When the role was created. + Whether the user is an authorized purchaser for Scale Tier. - - `created_by: String` + - `is_scim_managed: bool` - Identifier of the actor who created the role. + Whether the user is managed through SCIM. - - `created_by_user_obj: Hash[Symbol, untyped]` + - `is_service_account: bool` - User details for the actor that created the role, when available. + Whether the user is a service account. - - `description: String` + - `name: String` - Description of the role. + The name of the user - - `metadata: Hash[Symbol, untyped]` + - `projects: Projects{ data, object}` - Arbitrary metadata stored on the role. + Projects associated with the user, if included. - - `name: String` + - `data: Array[Data{ id, name, role}]` - Name of the role. + - `id: String` - - `permissions: Array[String]` + - `name: String` - Permissions associated with the role. + - `role: String` - - `predefined_role: bool` + - `object: :list` - Whether the role is predefined by OpenAI. + - `:list` - - `resource_type: String` + - `role: String` - Resource type the role applies to. + `owner` or `reader` - - `updated_at: Integer` + - `technical_level: String` - When the role was last updated. + The technical level metadata for the user. -### Role Create Response + - `user: User{ id, object, banned, 5 more}` -- `class RoleCreateResponse` + Nested user details. - Role assignment linking a group to a role. + - `id: String` - - `group: Group{ id, created_at, name, 2 more}` + - `object: :user` - Summary information about a group returned in role assignment responses. + - `:user` - - `id: String` + - `banned: bool` - Identifier for the group. + - `banned_at: Integer` - - `created_at: Integer` + - `email: String` - Unix timestamp (in seconds) when the group was created. + - `enabled: bool` - `name: String` - Display name of the group. + - `picture: String` - - `object: :group` +### Example - Always `group`. +```ruby +require "openai" - - `:group` +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") - - `scim_managed: bool` +organization_user = openai.admin.organization.users.retrieve("user_id") - Whether the group is managed through SCIM. +puts(organization_user) +``` - - `object: :"group.role"` +#### Response - Always `group.role`. +```json +{ + "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" + } + ], + "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" + } +} +``` - - `:"group.role"` +## Modify user - - `role: Role` +`admin.organization.users.update(user_id, **kwargs) -> OrganizationUser` - Details about a role that can be assigned through the public Roles API. +**post** `/organization/users/{user_id}` - - `id: String` +Modifies a user's role in the organization. - Identifier for the role. +### Parameters - - `description: String` +- `user_id: String` - Optional description of the role. +- `developer_persona: String` - - `name: String` + Developer persona metadata. - Unique name for the role. +- `role: String` - - `object: :role` + `owner` or `reader` - Always `role`. +- `role_id: String` - - `:role` + Role ID to assign to the user. - - `permissions: Array[String]` +- `technical_level: String` - Permissions granted by the role. + Technical level metadata. - - `predefined_role: bool` +### Returns - Whether the role is predefined and managed by OpenAI. +- `class OrganizationUser` - - `resource_type: String` + Represents an individual `user` within an organization. - Resource type the role is bound to (for example `api.organization` or `api.project`). + - `id: String` -### Role Delete Response + The identifier, which can be referenced in API endpoints -- `class RoleDeleteResponse` + - `added_at: Integer` - Confirmation payload returned after unassigning a role. + The Unix timestamp (in seconds) of when the user was added. - - `deleted: bool` + - `object: :"organization.user"` - Whether the assignment was removed. + The object type, which is always `organization.user` - - `object: String` + - `:"organization.user"` - Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + - `api_key_last_used_at: Integer` -# Roles + The Unix timestamp (in seconds) of the user's last API key usage. -## List organization roles + - `created: Integer` -`admin.organization.roles.list(**kwargs) -> NextCursorPage` + The Unix timestamp (in seconds) of when the user was created. -**get** `/organization/roles` + - `developer_persona: String` -Lists the roles configured for the organization. + The developer persona metadata for the user. -### Parameters + - `email: String` -- `after: String` + The email address of the user - Cursor for pagination. Provide the value from the previous response's `next` field to continue listing roles. + - `is_default: bool` -- `limit: Integer` + Whether this is the organization's default user. - A limit on the number of roles to return. Defaults to 1000. + - `is_scale_tier_authorized_purchaser: bool` -- `order: :asc | :desc` + Whether the user is an authorized purchaser for Scale Tier. - Sort order for the returned roles. + - `is_scim_managed: bool` - - `:asc` + Whether the user is managed through SCIM. - - `:desc` + - `is_service_account: bool` -### Returns + Whether the user is a service account. -- `class Role` + - `name: String` - Details about a role that can be assigned through the public Roles API. + The name of the user - - `id: String` + - `projects: Projects{ data, object}` - Identifier for the role. + Projects associated with the user, if included. - - `description: String` + - `data: Array[Data{ id, name, role}]` - Optional description of the role. + - `id: String` - `name: String` - Unique name for the role. + - `role: String` - - `object: :role` + - `object: :list` - Always `role`. + - `:list` - - `:role` + - `role: String` - - `permissions: Array[String]` + `owner` or `reader` - Permissions granted by the role. + - `technical_level: String` - - `predefined_role: bool` + The technical level metadata for the user. - Whether the role is predefined and managed by OpenAI. + - `user: User{ id, object, banned, 5 more}` - - `resource_type: String` + Nested user details. - Resource type the role is bound to (for example `api.organization` or `api.project`). + - `id: String` + + - `object: :user` + + - `:user` + + - `banned: bool` + + - `banned_at: Integer` + + - `email: String` + + - `enabled: bool` + + - `name: String` + + - `picture: String` ### Example @@ -12289,91 +13297,75 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -page = openai.admin.organization.roles.list +organization_user = openai.admin.organization.users.update("user_id") -puts(page) +puts(organization_user) ``` #### Response ```json { + "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", - "description": "description", "name": "name", - "object": "role", - "permissions": [ - "string" - ], - "predefined_role": true, - "resource_type": "resource_type" + "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" + } } ``` -## Create organization role +## Delete user -`admin.organization.roles.create(**kwargs) -> Role` +`admin.organization.users.delete(user_id) -> UserDeleteResponse` -**post** `/organization/roles` +**delete** `/organization/users/{user_id}` -Creates a custom role for the organization. +Deletes a user from the organization. ### Parameters -- `permissions: Array[String]` - - Permissions to grant to the role. - -- `role_name: String` - - Unique name for the role. - -- `description: String` - - Optional description of the role. +- `user_id: String` ### Returns -- `class Role` - - Details about a role that can be assigned through the public Roles API. +- `class UserDeleteResponse` - `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[String]` - - Permissions granted by the role. - - - `predefined_role: bool` - - Whether the role is predefined and managed by OpenAI. + - `deleted: bool` - - `resource_type: String` + - `object: :"organization.user.deleted"` - Resource type the role is bound to (for example `api.organization` or `api.project`). + - `:"organization.user.deleted"` ### Example @@ -12382,9 +13374,9 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -role = openai.admin.organization.roles.create(permissions: ["string"], role_name: "role_name") +user = openai.admin.organization.users.delete("user_id") -puts(role) +puts(user) ``` #### Response @@ -12392,240 +13384,152 @@ puts(role) ```json { "id": "id", - "description": "description", - "name": "name", - "object": "role", - "permissions": [ - "string" - ], - "predefined_role": true, - "resource_type": "resource_type" + "deleted": true, + "object": "organization.user.deleted" } ``` -## Update organization role +## Domain Types -`admin.organization.roles.update(role_id, **kwargs) -> Role` +### Organization User -**post** `/organization/roles/{role_id}` +- `class OrganizationUser` -Updates an existing organization role. + Represents an individual `user` within an organization. -### Parameters + - `id: String` -- `role_id: String` + The identifier, which can be referenced in API endpoints -- `description: String` + - `added_at: Integer` - New description for the role. + The Unix timestamp (in seconds) of when the user was added. -- `permissions: Array[String]` + - `object: :"organization.user"` - Updated set of permissions for the role. + The object type, which is always `organization.user` -- `role_name: String` + - `:"organization.user"` - New name for the role. + - `api_key_last_used_at: Integer` -### Returns + The Unix timestamp (in seconds) of the user's last API key usage. -- `class Role` + - `created: Integer` - Details about a role that can be assigned through the public Roles API. + The Unix timestamp (in seconds) of when the user was created. - - `id: String` + - `developer_persona: String` - Identifier for the role. + The developer persona metadata for the user. - - `description: String` + - `email: String` - Optional description of the role. + The email address of the user - - `name: String` + - `is_default: bool` - Unique name for the role. + Whether this is the organization's default user. - - `object: :role` + - `is_scale_tier_authorized_purchaser: bool` - Always `role`. + Whether the user is an authorized purchaser for Scale Tier. - - `:role` + - `is_scim_managed: bool` - - `permissions: Array[String]` + Whether the user is managed through SCIM. - Permissions granted by the role. + - `is_service_account: bool` - - `predefined_role: bool` + Whether the user is a service account. - Whether the role is predefined and managed by OpenAI. + - `name: String` - - `resource_type: String` + The name of the user - Resource type the role is bound to (for example `api.organization` or `api.project`). + - `projects: Projects{ data, object}` -### Example + Projects associated with the user, if included. -```ruby -require "openai" + - `data: Array[Data{ id, name, role}]` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + - `id: String` -role = openai.admin.organization.roles.update("role_id") + - `name: String` -puts(role) -``` + - `role: String` -#### Response + - `object: :list` -```json -{ - "id": "id", - "description": "description", - "name": "name", - "object": "role", - "permissions": [ - "string" - ], - "predefined_role": true, - "resource_type": "resource_type" -} -``` + - `:list` -## Delete organization role + - `role: String` -`admin.organization.roles.delete(role_id) -> RoleDeleteResponse` + `owner` or `reader` -**delete** `/organization/roles/{role_id}` + - `technical_level: String` -Deletes a custom role from the organization. + The technical level metadata for the user. -### Parameters + - `user: User{ id, object, banned, 5 more}` -- `role_id: String` + Nested user details. -### Returns + - `id: String` -- `class RoleDeleteResponse` + - `object: :user` - Confirmation payload returned after deleting a role. + - `:user` - - `id: String` + - `banned: bool` - Identifier of the deleted role. + - `banned_at: Integer` - - `deleted: bool` + - `email: String` - Whether the role was deleted. + - `enabled: bool` - - `object: :"role.deleted"` + - `name: String` - Always `role.deleted`. + - `picture: String` - - `:"role.deleted"` +### User Delete Response -### Example +- `class UserDeleteResponse` -```ruby -require "openai" + - `id: String` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + - `deleted: bool` -role = openai.admin.organization.roles.delete("role_id") - -puts(role) -``` - -#### Response - -```json -{ - "id": "id", - "deleted": true, - "object": "role.deleted" -} -``` - -## Domain Types - -### Role - -- `class 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[String]` - - Permissions granted by the role. - - - `predefined_role: bool` - - 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`). - -### Role Delete Response - -- `class RoleDeleteResponse` - - Confirmation payload returned after deleting a role. - - - `id: String` - - Identifier of the deleted role. - - - `deleted: bool` - - Whether the role was deleted. - - - `object: :"role.deleted"` - - Always `role.deleted`. + - `object: :"organization.user.deleted"` - - `:"role.deleted"` + - `:"organization.user.deleted"` -# Certificates +# Roles -## List organization certificates +## List user organization role assignments -`admin.organization.certificates.list(**kwargs) -> ConversationCursorPage` +`admin.organization.users.roles.list(user_id, **kwargs) -> NextCursorPage` -**get** `/organization/certificates` +**get** `/organization/users/{user_id}/roles` -List uploaded certificates for this organization. +Lists the organization roles assigned to a user within the organization. ### Parameters +- `user_id: String` + - `after: 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. + Cursor for pagination. Provide the value from the previous response's `next` field to continue listing organization roles. - `limit: Integer` - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + A limit on the number of organization role assignments to return. - `order: :asc | :desc` - Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + Sort order for the returned organization roles. - `:asc` @@ -12633,41 +13537,53 @@ List uploaded certificates for this organization. ### Returns -- `class CertificateListResponse` +- `class RoleListResponse` - Represents an individual certificate configured at the organization level. + Detailed information about a role assignment entry returned when listing assignments. - `id: String` - The identifier, which can be referenced in API endpoints + Identifier for the role. - - `active: bool` + - `created_at: Integer` - Whether the certificate is currently active at the organization level. + When the role was created. - - `certificate_details: CertificateDetails{ expires_at, valid_at}` + - `created_by: String` - - `expires_at: Integer` + Identifier of the actor who created the role. - The Unix timestamp (in seconds) of when the certificate expires. + - `created_by_user_obj: Hash[Symbol, untyped]` - - `valid_at: Integer` + User details for the actor that created the role, when available. - The Unix timestamp (in seconds) of when the certificate becomes valid. + - `description: String` - - `created_at: Integer` + Description of the role. - The Unix timestamp (in seconds) of when the certificate was uploaded. + - `metadata: Hash[Symbol, untyped]` + + Arbitrary metadata stored on the role. - `name: String` - The name of the certificate. + Name of the role. - - `object: :"organization.certificate"` + - `permissions: Array[String]` - The object type, which is always `organization.certificate`. + Permissions associated with the role. - - `:"organization.certificate"` + - `predefined_role: bool` + + Whether the role is predefined by OpenAI. + + - `resource_type: String` + + Resource type the role applies to. + + - `updated_at: Integer` + + When the role was last updated. ### Example @@ -12676,7 +13592,7 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -page = openai.admin.organization.certificates.list +page = openai.admin.organization.users.roles.list("user_id") puts(page) ``` @@ -12688,191 +13604,191 @@ puts(page) "data": [ { "id": "id", - "active": true, - "certificate_details": { - "expires_at": 0, - "valid_at": 0 - }, "created_at": 0, + "created_by": "created_by", + "created_by_user_obj": { + "foo": "bar" + }, + "description": "description", + "metadata": { + "foo": "bar" + }, "name": "name", - "object": "organization.certificate" + "permissions": [ + "string" + ], + "predefined_role": true, + "resource_type": "resource_type", + "updated_at": 0 } ], - "first_id": "cert_abc", "has_more": true, - "last_id": "cert_abc", + "next": "next", "object": "list" } ``` -## Upload certificate - -`admin.organization.certificates.create(**kwargs) -> Certificate` +## Assign organization role to user -**post** `/organization/certificates` +`admin.organization.users.roles.create(user_id, **kwargs) -> RoleCreateResponse` -Upload a certificate to the organization. This does **not** automatically activate the certificate. +**post** `/organization/users/{user_id}/roles` -Organizations can upload up to 50 certificates. +Assigns an organization role to a user within the organization. ### Parameters -- `certificate: String` - - The certificate content in PEM format +- `user_id: String` -- `name: String` +- `role_id: String` - An optional name for the certificate + Identifier of the role to assign. ### Returns -- `class Certificate` - - Represents an individual `certificate` uploaded to the organization. - - - `id: String` +- `class RoleCreateResponse` - The identifier, which can be referenced in API endpoints + Role assignment linking a user to a role. - - `certificate_details: CertificateDetails{ content, expires_at, valid_at}` + - `object: :"user.role"` - - `content: String` + Always `user.role`. - The content of the certificate in PEM format. + - `:"user.role"` - - `expires_at: Integer` + - `role: Role` - The Unix timestamp (in seconds) of when the certificate expires. + Details about a role that can be assigned through the public Roles API. - - `valid_at: Integer` + - `id: String` - The Unix timestamp (in seconds) of when the certificate becomes valid. + Identifier for the role. - - `created_at: Integer` + - `description: String` - The Unix timestamp (in seconds) of when the certificate was uploaded. + Optional description of the role. - `name: String` - The name of the certificate. + Unique name for the role. - - `object: :certificate | :"organization.certificate" | :"organization.project.certificate"` + - `object: :role` - The object type. + Always `role`. - - If creating, updating, or getting a specific certificate, the object type is `certificate`. - - If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`. - - If listing, activating, or deactivating certificates for a project, the object type is `organization.project.certificate`. + - `:role` - - `:certificate` + - `permissions: Array[String]` - - `:"organization.certificate"` + Permissions granted by the role. - - `:"organization.project.certificate"` + - `predefined_role: bool` - - `active: bool` + Whether the role is predefined and managed by OpenAI. - Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate. + - `resource_type: String` -### Example + Resource type the role is bound to (for example `api.organization` or `api.project`). -```ruby -require "openai" + - `user: OrganizationUser` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + Represents an individual `user` within an organization. -certificate = openai.admin.organization.certificates.create(certificate: "certificate") + - `id: String` -puts(certificate) -``` + The identifier, which can be referenced in API endpoints -#### Response + - `added_at: Integer` -```json -{ - "id": "id", - "certificate_details": { - "content": "content", - "expires_at": 0, - "valid_at": 0 - }, - "created_at": 0, - "name": "name", - "object": "certificate", - "active": true -} -``` + The Unix timestamp (in seconds) of when the user was added. -## Get certificate + - `object: :"organization.user"` -`admin.organization.certificates.retrieve(certificate_id, **kwargs) -> Certificate` + The object type, which is always `organization.user` -**get** `/organization/certificates/{certificate_id}` + - `:"organization.user"` -Get a certificate that has been uploaded to the organization. + - `api_key_last_used_at: Integer` -You can get a certificate regardless of whether it is active or not. + The Unix timestamp (in seconds) of the user's last API key usage. -### Parameters + - `created: Integer` -- `certificate_id: String` + The Unix timestamp (in seconds) of when the user was created. -- `include: Array[:content]` + - `developer_persona: String` - A list of additional fields to include in the response. Currently the only supported value is `content` to fetch the PEM content of the certificate. + The developer persona metadata for the user. - - `:content` + - `email: String` -### Returns + The email address of the user -- `class Certificate` + - `is_default: bool` - Represents an individual `certificate` uploaded to the organization. + Whether this is the organization's default user. - - `id: String` + - `is_scale_tier_authorized_purchaser: bool` - The identifier, which can be referenced in API endpoints + Whether the user is an authorized purchaser for Scale Tier. - - `certificate_details: CertificateDetails{ content, expires_at, valid_at}` + - `is_scim_managed: bool` - - `content: String` + Whether the user is managed through SCIM. - The content of the certificate in PEM format. + - `is_service_account: bool` - - `expires_at: Integer` + Whether the user is a service account. - The Unix timestamp (in seconds) of when the certificate expires. + - `name: String` - - `valid_at: Integer` + The name of the user - The Unix timestamp (in seconds) of when the certificate becomes valid. + - `projects: Projects{ data, object}` - - `created_at: Integer` + Projects associated with the user, if included. - The Unix timestamp (in seconds) of when the certificate was uploaded. + - `data: Array[Data{ id, name, role}]` + + - `id: String` - `name: String` - The name of the certificate. + - `role: String` - - `object: :certificate | :"organization.certificate" | :"organization.project.certificate"` + - `object: :list` - The object type. + - `:list` - - If creating, updating, or getting a specific certificate, the object type is `certificate`. - - If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`. - - If listing, activating, or deactivating certificates for a project, the object type is `organization.project.certificate`. + - `role: String` - - `:certificate` + `owner` or `reader` - - `:"organization.certificate"` + - `technical_level: String` - - `:"organization.project.certificate"` + The technical level metadata for the user. - - `active: bool` + - `user: User{ id, object, banned, 5 more}` - Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate. + Nested user details. + + - `id: String` + + - `object: :user` + + - `:user` + + - `banned: bool` + + - `banned_at: Integer` + + - `email: String` + + - `enabled: bool` + + - `name: String` + + - `picture: String` ### Example @@ -12881,93 +13797,93 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -certificate = openai.admin.organization.certificates.retrieve("certificate_id") +role = openai.admin.organization.users.roles.create("user_id", role_id: "role_id") -puts(certificate) +puts(role) ``` #### Response ```json { + "object": "user.role", + "role": { "id": "id", - "certificate_details": { - "content": "content", - "expires_at": 0, - "valid_at": 0 + "description": "description", + "name": "name", + "object": "role", + "permissions": [ + "string" + ], + "predefined_role": true, + "resource_type": "resource_type" }, - "created_at": 0, + "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", - "object": "certificate", - "active": true + "projects": { + "data": [ + { + "id": "id", + "name": "name", + "role": "role" + } + ], + "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" + } + } } ``` -## Modify certificate +## Unassign organization role from user -`admin.organization.certificates.update(certificate_id, **kwargs) -> Certificate` +`admin.organization.users.roles.delete(role_id, **kwargs) -> RoleDeleteResponse` -**post** `/organization/certificates/{certificate_id}` +**delete** `/organization/users/{user_id}/roles/{role_id}` -Modify a certificate. Note that only the name can be modified. +Unassigns an organization role from a user within the organization. ### Parameters -- `certificate_id: String` - -- `name: String` +- `user_id: String` - The updated name for the certificate +- `role_id: String` ### Returns -- `class Certificate` - - Represents an individual `certificate` uploaded to the organization. - - - `id: String` - - The identifier, which can be referenced in API endpoints - - - `certificate_details: CertificateDetails{ content, expires_at, valid_at}` - - - `content: String` - - The content of the certificate in PEM format. - - - `expires_at: Integer` - - The Unix timestamp (in seconds) of when the certificate expires. - - - `valid_at: Integer` - - The Unix timestamp (in seconds) of when the certificate becomes valid. - - - `created_at: Integer` - - The Unix timestamp (in seconds) of when the certificate was uploaded. - - - `name: String` - - The name of the certificate. - - - `object: :certificate | :"organization.certificate" | :"organization.project.certificate"` - - The object type. - - - If creating, updating, or getting a specific certificate, the object type is `certificate`. - - If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`. - - If listing, activating, or deactivating certificates for a project, the object type is `organization.project.certificate`. +- `class RoleDeleteResponse` - - `:certificate` + Confirmation payload returned after unassigning a role. - - `:"organization.certificate"` + - `deleted: bool` - - `:"organization.project.certificate"` + Whether the assignment was removed. - - `active: bool` + - `object: String` - Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate. + Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. ### Example @@ -12976,486 +13892,418 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -certificate = openai.admin.organization.certificates.update("certificate_id") +role = openai.admin.organization.users.roles.delete("role_id", user_id: "user_id") -puts(certificate) +puts(role) ``` #### Response ```json { - "id": "id", - "certificate_details": { - "content": "content", - "expires_at": 0, - "valid_at": 0 - }, - "created_at": 0, - "name": "name", - "object": "certificate", - "active": true + "deleted": true, + "object": "object" } ``` -## Delete certificate +## Domain Types -`admin.organization.certificates.delete(certificate_id) -> CertificateDeleteResponse` +### Role List Response -**delete** `/organization/certificates/{certificate_id}` +- `class RoleListResponse` -Delete a certificate from the organization. + Detailed information about a role assignment entry returned when listing assignments. -The certificate must be inactive for the organization and all projects. + - `id: String` -### Parameters + Identifier for the role. -- `certificate_id: String` + - `created_at: Integer` -### Returns + When the role was created. -- `class CertificateDeleteResponse` + - `created_by: String` - - `id: String` + Identifier of the actor who created the role. - The ID of the certificate that was deleted. + - `created_by_user_obj: Hash[Symbol, untyped]` - - `object: :"certificate.deleted"` + User details for the actor that created the role, when available. - The object type, must be `certificate.deleted`. + - `description: String` - - `:"certificate.deleted"` + Description of the role. -### Example + - `metadata: Hash[Symbol, untyped]` -```ruby -require "openai" + Arbitrary metadata stored on the role. -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + - `name: String` -certificate = openai.admin.organization.certificates.delete("certificate_id") + Name of the role. -puts(certificate) -``` - -#### Response + - `permissions: Array[String]` -```json -{ - "id": "id", - "object": "certificate.deleted" -} -``` + Permissions associated with the role. -## Activate certificates for organization + - `predefined_role: bool` -`admin.organization.certificates.activate(**kwargs) -> Page` + Whether the role is predefined by OpenAI. -**post** `/organization/certificates/activate` + - `resource_type: String` -Activate certificates at the organization level. + Resource type the role applies to. -You can atomically and idempotently activate up to 10 certificates at a time. + - `updated_at: Integer` -### Parameters + When the role was last updated. -- `certificate_ids: Array[String]` +### Role Create Response -### Returns +- `class RoleCreateResponse` -- `class CertificateActivateResponse` + Role assignment linking a user to a role. - Represents an individual certificate configured at the organization level. + - `object: :"user.role"` - - `id: String` + Always `user.role`. - The identifier, which can be referenced in API endpoints + - `:"user.role"` - - `active: bool` + - `role: Role` - Whether the certificate is currently active at the organization level. + Details about a role that can be assigned through the public Roles API. - - `certificate_details: CertificateDetails{ expires_at, valid_at}` + - `id: String` - - `expires_at: Integer` + Identifier for the role. - The Unix timestamp (in seconds) of when the certificate expires. + - `description: String` - - `valid_at: Integer` + Optional description of the role. - The Unix timestamp (in seconds) of when the certificate becomes valid. + - `name: String` - - `created_at: Integer` + Unique name for the role. - The Unix timestamp (in seconds) of when the certificate was uploaded. + - `object: :role` - - `name: String` + Always `role`. - The name of the certificate. + - `:role` - - `object: :"organization.certificate"` + - `permissions: Array[String]` - The object type, which is always `organization.certificate`. + Permissions granted by the role. - - `:"organization.certificate"` + - `predefined_role: bool` -### Example + Whether the role is predefined and managed by OpenAI. -```ruby -require "openai" + - `resource_type: String` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + Resource type the role is bound to (for example `api.organization` or `api.project`). -page = openai.admin.organization.certificates.activate(certificate_ids: ["cert_abc"]) + - `user: OrganizationUser` -puts(page) -``` + Represents an individual `user` within an organization. -#### Response + - `id: String` -```json -{ - "data": [ - { - "id": "id", - "active": true, - "certificate_details": { - "expires_at": 0, - "valid_at": 0 - }, - "created_at": 0, - "name": "name", - "object": "organization.certificate" - } - ], - "object": "organization.certificate.activation" -} -``` + The identifier, which can be referenced in API endpoints -## Deactivate certificates for organization + - `added_at: Integer` -`admin.organization.certificates.deactivate(**kwargs) -> Page` + The Unix timestamp (in seconds) of when the user was added. -**post** `/organization/certificates/deactivate` + - `object: :"organization.user"` -Deactivate certificates at the organization level. + The object type, which is always `organization.user` -You can atomically and idempotently deactivate up to 10 certificates at a time. + - `:"organization.user"` -### Parameters + - `api_key_last_used_at: Integer` -- `certificate_ids: Array[String]` + The Unix timestamp (in seconds) of the user's last API key usage. -### Returns + - `created: Integer` -- `class CertificateDeactivateResponse` + The Unix timestamp (in seconds) of when the user was created. - Represents an individual certificate configured at the organization level. + - `developer_persona: String` - - `id: String` + The developer persona metadata for the user. - The identifier, which can be referenced in API endpoints + - `email: String` - - `active: bool` + The email address of the user - Whether the certificate is currently active at the organization level. + - `is_default: bool` - - `certificate_details: CertificateDetails{ expires_at, valid_at}` + Whether this is the organization's default user. - - `expires_at: Integer` + - `is_scale_tier_authorized_purchaser: bool` - The Unix timestamp (in seconds) of when the certificate expires. + Whether the user is an authorized purchaser for Scale Tier. - - `valid_at: Integer` + - `is_scim_managed: bool` - The Unix timestamp (in seconds) of when the certificate becomes valid. + Whether the user is managed through SCIM. - - `created_at: Integer` + - `is_service_account: bool` - The Unix timestamp (in seconds) of when the certificate was uploaded. + Whether the user is a service account. - `name: String` - The name of the certificate. + The name of the user - - `object: :"organization.certificate"` + - `projects: Projects{ data, object}` - The object type, which is always `organization.certificate`. + Projects associated with the user, if included. - - `:"organization.certificate"` + - `data: Array[Data{ id, name, role}]` -### Example + - `id: String` -```ruby -require "openai" + - `name: String` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + - `role: String` -page = openai.admin.organization.certificates.deactivate(certificate_ids: ["cert_abc"]) + - `object: :list` -puts(page) -``` + - `:list` -#### Response + - `role: String` -```json -{ - "data": [ - { - "id": "id", - "active": true, - "certificate_details": { - "expires_at": 0, - "valid_at": 0 - }, - "created_at": 0, - "name": "name", - "object": "organization.certificate" - } - ], - "object": "organization.certificate.deactivation" -} -``` + `owner` or `reader` -## Domain Types + - `technical_level: String` -### Certificate + The technical level metadata for the user. -- `class Certificate` + - `user: User{ id, object, banned, 5 more}` - Represents an individual `certificate` uploaded to the organization. + Nested user details. - `id: String` - The identifier, which can be referenced in API endpoints + - `object: :user` - - `certificate_details: CertificateDetails{ content, expires_at, valid_at}` + - `:user` - - `content: String` + - `banned: bool` - The content of the certificate in PEM format. + - `banned_at: Integer` - - `expires_at: Integer` + - `email: String` - The Unix timestamp (in seconds) of when the certificate expires. + - `enabled: bool` - - `valid_at: Integer` + - `name: String` - The Unix timestamp (in seconds) of when the certificate becomes valid. + - `picture: String` - - `created_at: Integer` +### Role Delete Response - The Unix timestamp (in seconds) of when the certificate was uploaded. +- `class RoleDeleteResponse` - - `name: String` + Confirmation payload returned after unassigning a role. - The name of the certificate. + - `deleted: bool` - - `object: :certificate | :"organization.certificate" | :"organization.project.certificate"` + Whether the assignment was removed. - The object type. + - `object: String` - - If creating, updating, or getting a specific certificate, the object type is `certificate`. - - If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`. - - If listing, activating, or deactivating certificates for a project, the object type is `organization.project.certificate`. + Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. - - `:certificate` +# Groups - - `:"organization.certificate"` +## List groups - - `:"organization.project.certificate"` +`admin.organization.groups.list(**kwargs) -> NextCursorPage` - - `active: bool` +**get** `/organization/groups` - Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate. +Lists all groups in the organization. -### Certificate List Response +### Parameters -- `class CertificateListResponse` +- `after: String` - Represents an individual certificate configured at the organization level. + A cursor for use in pagination. `after` is a group ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with group_abc, your subsequent call can include `after=group_abc` in order to fetch the next page of the list. - - `id: String` +- `limit: Integer` - The identifier, which can be referenced in API endpoints + A limit on the number of groups to be returned. Limit can range between 0 and 1000, and the default is 100. - - `active: bool` +- `order: :asc | :desc` - Whether the certificate is currently active at the organization level. + Specifies the sort order of the returned groups. - - `certificate_details: CertificateDetails{ expires_at, valid_at}` + - `:asc` - - `expires_at: Integer` + - `:desc` - The Unix timestamp (in seconds) of when the certificate expires. +### Returns - - `valid_at: Integer` +- `class Group` - The Unix timestamp (in seconds) of when the certificate becomes valid. + Details about an organization group. - - `created_at: Integer` + - `id: String` - The Unix timestamp (in seconds) of when the certificate was uploaded. - - - `name: String` - - The name of the certificate. - - - `object: :"organization.certificate"` - - The object type, which is always `organization.certificate`. - - - `:"organization.certificate"` - -### Certificate Delete Response - -- `class CertificateDeleteResponse` - - - `id: String` - - The ID of the certificate that was deleted. + Identifier for the group. - - `object: :"certificate.deleted"` + - `created_at: Integer` - The object type, must be `certificate.deleted`. + Unix timestamp (in seconds) when the group was created. - - `:"certificate.deleted"` + - `group_type: String` -### Certificate Activate Response + The type of the group. -- `class CertificateActivateResponse` + - `is_scim_managed: bool` - Represents an individual certificate configured at the organization level. + Whether the group is managed through SCIM and controlled by your identity provider. - - `id: String` + - `name: String` - The identifier, which can be referenced in API endpoints + Display name of the group. - - `active: bool` +### Example - Whether the certificate is currently active at the organization level. +```ruby +require "openai" - - `certificate_details: CertificateDetails{ expires_at, valid_at}` +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") - - `expires_at: Integer` +page = openai.admin.organization.groups.list - The Unix timestamp (in seconds) of when the certificate expires. +puts(page) +``` - - `valid_at: Integer` +#### Response - The Unix timestamp (in seconds) of when the certificate becomes valid. +```json +{ + "data": [ + { + "id": "id", + "created_at": 0, + "group_type": "group_type", + "is_scim_managed": true, + "name": "name" + } + ], + "has_more": true, + "next": "next", + "object": "list" +} +``` - - `created_at: Integer` +## Create group - The Unix timestamp (in seconds) of when the certificate was uploaded. +`admin.organization.groups.create(**kwargs) -> Group` - - `name: String` +**post** `/organization/groups` - The name of the certificate. +Creates a new group in the organization. - - `object: :"organization.certificate"` +### Parameters - The object type, which is always `organization.certificate`. +- `name: String` - - `:"organization.certificate"` + Human readable name for the group. -### Certificate Deactivate Response +### Returns -- `class CertificateDeactivateResponse` +- `class Group` - Represents an individual certificate configured at the organization level. + Details about an organization group. - `id: String` - The identifier, which can be referenced in API endpoints - - - `active: bool` - - Whether the certificate is currently active at the organization level. - - - `certificate_details: CertificateDetails{ expires_at, valid_at}` + Identifier for the group. - - `expires_at: Integer` + - `created_at: Integer` - The Unix timestamp (in seconds) of when the certificate expires. + Unix timestamp (in seconds) when the group was created. - - `valid_at: Integer` + - `group_type: String` - The Unix timestamp (in seconds) of when the certificate becomes valid. + The type of the group. - - `created_at: Integer` + - `is_scim_managed: bool` - The Unix timestamp (in seconds) of when the certificate was uploaded. + Whether the group is managed through SCIM and controlled by your identity provider. - `name: String` - The name of the certificate. + Display name of the group. - - `object: :"organization.certificate"` +### Example - The object type, which is always `organization.certificate`. +```ruby +require "openai" - - `:"organization.certificate"` +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -# Projects +group = openai.admin.organization.groups.create(name: "x") -## List projects +puts(group) +``` -`admin.organization.projects.list(**kwargs) -> ConversationCursorPage` +#### Response -**get** `/organization/projects` +```json +{ + "id": "id", + "created_at": 0, + "group_type": "group_type", + "is_scim_managed": true, + "name": "name" +} +``` -Returns a list of projects. +## Update group -### Parameters +`admin.organization.groups.update(group_id, **kwargs) -> GroupUpdateResponse` -- `after: String` +**post** `/organization/groups/{group_id}` - 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. +Updates a group's information. -- `include_archived: bool` +### Parameters - If `true` returns all projects including those that have been `archived`. Archived projects are not included by default. +- `group_id: String` -- `limit: Integer` +- `name: String` - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + New display name for the group. ### Returns -- `class Project` +- `class GroupUpdateResponse` - Represents an individual project. + Response returned after updating a group. - `id: String` - The identifier, which can be referenced in API endpoints + Identifier for the group. - `created_at: Integer` - The Unix timestamp (in seconds) of when the project was created. - - - `object: :"organization.project"` - - The object type, which is always `organization.project` - - - `:"organization.project"` - - - `archived_at: Integer` - - The Unix timestamp (in seconds) of when the project was archived or `null`. + Unix timestamp (in seconds) when the group was created. - - `external_key_id: String` + - `is_scim_managed: bool` - The external key associated with the project. + Whether the group is managed through SCIM and controlled by your identity provider. - `name: String` - The name of the project. This appears in reporting. - - - `status: String` - - `active` or `archived` + Updated display name for the group. ### Example @@ -13464,90 +14312,53 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -page = openai.admin.organization.projects.list +group = openai.admin.organization.groups.update("group_id", name: "x") -puts(page) +puts(group) ``` #### Response ```json { - "data": [ - { "id": "id", "created_at": 0, - "object": "organization.project", - "archived_at": 0, - "external_key_id": "external_key_id", - "name": "name", - "status": "status" - } - ], - "has_more": true, - "object": "list", - "first_id": "first_id", - "last_id": "last_id" + "is_scim_managed": true, + "name": "name" } ``` -## Create project +## Delete group -`admin.organization.projects.create(**kwargs) -> Project` +`admin.organization.groups.delete(group_id) -> GroupDeleteResponse` -**post** `/organization/projects` +**delete** `/organization/groups/{group_id}` -Create a new project in the organization. Projects can be created and archived, but cannot be deleted. +Deletes a group from the organization. ### Parameters -- `name: String` - - The friendly name of the project, this name appears in reports. - -- `external_key_id: String` - - External key ID to associate with the project. - -- `geography: String` - - Create the project with the specified data residency region. Your organization must have access to Data residency functionality in order to use. See [data residency controls](https://platform.openai.com/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field. +- `group_id: String` ### Returns -- `class Project` +- `class GroupDeleteResponse` - Represents an individual project. + Confirmation payload returned after deleting a group. - `id: String` - The identifier, which can be referenced in API endpoints - - - `created_at: Integer` - - The Unix timestamp (in seconds) of when the project was created. - - - `object: :"organization.project"` - - The object type, which is always `organization.project` - - - `:"organization.project"` - - - `archived_at: Integer` - - The Unix timestamp (in seconds) of when the project was archived or `null`. - - - `external_key_id: String` + Identifier of the deleted group. - The external key associated with the project. + - `deleted: bool` - - `name: String` + Whether the group was deleted. - The name of the project. This appears in reporting. + - `object: :"group.deleted"` - - `status: String` + Always `group.deleted`. - `active` or `archived` + - `:"group.deleted"` ### Example @@ -13556,9 +14367,9 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -project = openai.admin.organization.projects.create(name: "name") +group = openai.admin.organization.groups.delete("group_id") -puts(project) +puts(group) ``` #### Response @@ -13566,148 +14377,128 @@ puts(project) ```json { "id": "id", - "created_at": 0, - "object": "organization.project", - "archived_at": 0, - "external_key_id": "external_key_id", - "name": "name", - "status": "status" + "deleted": true, + "object": "group.deleted" } ``` -## Retrieve project +## Domain Types -`admin.organization.projects.retrieve(project_id) -> Project` +### Group -**get** `/organization/projects/{project_id}` +- `class Group` -Retrieves a project. + Details about an organization group. -### Parameters + - `id: String` -- `project_id: String` + Identifier for the group. -### Returns + - `created_at: Integer` -- `class Project` + Unix timestamp (in seconds) when the group was created. - Represents an individual project. + - `group_type: String` - - `id: String` + The type of the group. - The identifier, which can be referenced in API endpoints + - `is_scim_managed: bool` - - `created_at: Integer` + Whether the group is managed through SCIM and controlled by your identity provider. - The Unix timestamp (in seconds) of when the project was created. + - `name: String` - - `object: :"organization.project"` + Display name of the group. - The object type, which is always `organization.project` +### Group Update Response - - `:"organization.project"` +- `class GroupUpdateResponse` - - `archived_at: Integer` + Response returned after updating a group. - The Unix timestamp (in seconds) of when the project was archived or `null`. + - `id: String` - - `external_key_id: String` + Identifier for the group. - The external key associated with the project. + - `created_at: Integer` - - `name: String` + Unix timestamp (in seconds) when the group was created. - The name of the project. This appears in reporting. + - `is_scim_managed: bool` - - `status: String` + Whether the group is managed through SCIM and controlled by your identity provider. - `active` or `archived` + - `name: String` -### Example + Updated display name for the group. -```ruby -require "openai" +### Group Delete Response -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") +- `class GroupDeleteResponse` -project = openai.admin.organization.projects.retrieve("project_id") + Confirmation payload returned after deleting a group. -puts(project) -``` + - `id: String` -#### Response + Identifier of the deleted group. -```json -{ - "id": "id", - "created_at": 0, - "object": "organization.project", - "archived_at": 0, - "external_key_id": "external_key_id", - "name": "name", - "status": "status" -} -``` + - `deleted: bool` -## Modify project + Whether the group was deleted. -`admin.organization.projects.update(project_id, **kwargs) -> Project` + - `object: :"group.deleted"` -**post** `/organization/projects/{project_id}` + Always `group.deleted`. -Modifies a project in the organization. + - `:"group.deleted"` -### Parameters +# Users -- `project_id: String` +## List group users -- `external_key_id: String` +`admin.organization.groups.users.list(group_id, **kwargs) -> NextCursorPage` - External key ID to associate with the project. +**get** `/organization/groups/{group_id}/users` -- `geography: String` +Lists the users assigned to a group. - Geography for the project. +### Parameters -- `name: String` +- `group_id: String` - The updated name of the project, this name appears in reports. +- `after: String` -### Returns + A cursor for use in pagination. Provide the ID of the last user from the previous list response to retrieve the next page. -- `class Project` +- `limit: Integer` - Represents an individual project. + A limit on the number of users to be returned. Limit can range between 0 and 1000, and the default is 100. - - `id: String` +- `order: :asc | :desc` - The identifier, which can be referenced in API endpoints + Specifies the sort order of users in the list. - - `created_at: Integer` + - `:asc` - The Unix timestamp (in seconds) of when the project was created. + - `:desc` - - `object: :"organization.project"` +### Returns - The object type, which is always `organization.project` +- `class OrganizationGroupUser` - - `:"organization.project"` + Represents an individual user returned when inspecting group membership. - - `archived_at: Integer` + - `id: String` - The Unix timestamp (in seconds) of when the project was archived or `null`. + The identifier, which can be referenced in API endpoints - - `external_key_id: String` + - `email: String` - The external key associated with the project. + The email address of the user. - `name: String` - The name of the project. This appears in reporting. - - - `status: String` - - `active` or `archived` + The name of the user. ### Example @@ -13716,72 +14507,63 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -project = openai.admin.organization.projects.update("project_id") +page = openai.admin.organization.groups.users.list("group_id") -puts(project) +puts(page) ``` #### Response ```json { + "data": [ + { "id": "id", - "created_at": 0, - "object": "organization.project", - "archived_at": 0, - "external_key_id": "external_key_id", - "name": "name", - "status": "status" + "email": "email", + "name": "name" + } + ], + "has_more": true, + "next": "next", + "object": "list" } ``` -## Archive project +## Add group user -`admin.organization.projects.archive(project_id) -> Project` +`admin.organization.groups.users.create(group_id, **kwargs) -> UserCreateResponse` -**post** `/organization/projects/{project_id}/archive` +**post** `/organization/groups/{group_id}/users` -Archives a project in the organization. Archived projects cannot be used or updated. +Adds a user to a group. ### Parameters -- `project_id: String` - -### Returns - -- `class Project` - - Represents an individual project. - - - `id: String` - - The identifier, which can be referenced in API endpoints - - - `created_at: Integer` +- `group_id: String` - The Unix timestamp (in seconds) of when the project was created. +- `user_id: String` - - `object: :"organization.project"` + Identifier of the user to add to the group. - The object type, which is always `organization.project` +### Returns - - `:"organization.project"` +- `class UserCreateResponse` - - `archived_at: Integer` + Confirmation payload returned after adding a user to a group. - The Unix timestamp (in seconds) of when the project was archived or `null`. + - `group_id: String` - - `external_key_id: String` + Identifier of the group the user was added to. - The external key associated with the project. + - `object: :"group.user"` - - `name: String` + Always `group.user`. - The name of the project. This appears in reporting. + - `:"group.user"` - - `status: String` + - `user_id: String` - `active` or `archived` + Identifier of the user that was added. ### Example @@ -13790,205 +14572,207 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -project = openai.admin.organization.projects.archive("project_id") +user = openai.admin.organization.groups.users.create("group_id", user_id: "user_id") -puts(project) +puts(user) ``` #### Response ```json { - "id": "id", - "created_at": 0, - "object": "organization.project", - "archived_at": 0, - "external_key_id": "external_key_id", - "name": "name", - "status": "status" + "group_id": "group_id", + "object": "group.user", + "user_id": "user_id" } ``` -## Domain Types - -### Project +## Remove group user -- `class Project` +`admin.organization.groups.users.delete(user_id, **kwargs) -> UserDeleteResponse` - Represents an individual project. +**delete** `/organization/groups/{group_id}/users/{user_id}` - - `id: String` +Removes a user from a group. - The identifier, which can be referenced in API endpoints +### Parameters - - `created_at: Integer` +- `group_id: String` - The Unix timestamp (in seconds) of when the project was created. +- `user_id: String` - - `object: :"organization.project"` +### Returns - The object type, which is always `organization.project` +- `class UserDeleteResponse` - - `:"organization.project"` + Confirmation payload returned after removing a user from a group. - - `archived_at: Integer` + - `deleted: bool` - The Unix timestamp (in seconds) of when the project was archived or `null`. + Whether the group membership was removed. - - `external_key_id: String` + - `object: :"group.user.deleted"` - The external key associated with the project. + Always `group.user.deleted`. - - `name: String` + - `:"group.user.deleted"` - The name of the project. This appears in reporting. +### Example - - `status: String` +```ruby +require "openai" - `active` or `archived` +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -# Users +user = openai.admin.organization.groups.users.delete("user_id", group_id: "group_id") -## List project users - -`admin.organization.projects.users.list(project_id, **kwargs) -> ConversationCursorPage` +puts(user) +``` -**get** `/organization/projects/{project_id}/users` +#### Response -Returns a list of users in the project. +```json +{ + "deleted": true, + "object": "group.user.deleted" +} +``` -### Parameters +## Domain Types -- `project_id: String` +### Organization Group User -- `after: String` +- `class OrganizationGroupUser` - 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. + Represents an individual user returned when inspecting group membership. -- `limit: Integer` + - `id: String` - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + The identifier, which can be referenced in API endpoints -### Returns + - `email: String` -- `class ProjectUser` + The email address of the user. - Represents an individual user in a project. + - `name: String` - - `id: String` + The name of the user. - The identifier, which can be referenced in API endpoints +### User Create Response - - `added_at: Integer` +- `class UserCreateResponse` - The Unix timestamp (in seconds) of when the project was added. + Confirmation payload returned after adding a user to a group. - - `object: :"organization.project.user"` + - `group_id: String` - The object type, which is always `organization.project.user` + Identifier of the group the user was added to. - - `:"organization.project.user"` + - `object: :"group.user"` - - `role: String` + Always `group.user`. - `owner` or `member` + - `:"group.user"` - - `email: String` + - `user_id: String` - The email address of the user + Identifier of the user that was added. - - `name: String` +### User Delete Response - The name of the user +- `class UserDeleteResponse` -### Example + Confirmation payload returned after removing a user from a group. -```ruby -require "openai" + - `deleted: bool` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + Whether the group membership was removed. -page = openai.admin.organization.projects.users.list("project_id") + - `object: :"group.user.deleted"` -puts(page) -``` + Always `group.user.deleted`. -#### Response + - `:"group.user.deleted"` -```json -{ - "data": [ - { - "id": "id", - "added_at": 0, - "object": "organization.project.user", - "role": "role", - "email": "email", - "name": "name" - } - ], - "has_more": true, - "object": "object", - "first_id": "first_id", - "last_id": "last_id" -} -``` +# Roles -## Create project user +## List group organization role assignments -`admin.organization.projects.users.create(project_id, **kwargs) -> ProjectUser` +`admin.organization.groups.roles.list(group_id, **kwargs) -> NextCursorPage` -**post** `/organization/projects/{project_id}/users` +**get** `/organization/groups/{group_id}/roles` -Adds a user to the project. Users must already be members of the organization to be added to a project. +Lists the organization roles assigned to a group within the organization. ### Parameters -- `project_id: String` +- `group_id: String` -- `role: String` +- `after: String` - `owner` or `member` + Cursor for pagination. Provide the value from the previous response's `next` field to continue listing organization roles. -- `email: String` +- `limit: Integer` - Email of the user to add. + A limit on the number of organization role assignments to return. -- `user_id: String` +- `order: :asc | :desc` - The ID of the user. + Sort order for the returned organization roles. + + - `:asc` + + - `:desc` ### Returns -- `class ProjectUser` +- `class RoleListResponse` - Represents an individual user in a project. + Detailed information about a role assignment entry returned when listing assignments. - `id: String` - The identifier, which can be referenced in API endpoints + Identifier for the role. - - `added_at: Integer` + - `created_at: Integer` - The Unix timestamp (in seconds) of when the project was added. + When the role was created. - - `object: :"organization.project.user"` + - `created_by: String` - The object type, which is always `organization.project.user` + Identifier of the actor who created the role. - - `:"organization.project.user"` + - `created_by_user_obj: Hash[Symbol, untyped]` - - `role: String` + User details for the actor that created the role, when available. - `owner` or `member` + - `description: String` - - `email: String` + Description of the role. - The email address of the user + - `metadata: Hash[Symbol, untyped]` + + Arbitrary metadata stored on the role. - `name: String` - The name of the user + Name of the role. + + - `permissions: Array[String]` + + Permissions associated with the role. + + - `predefined_role: bool` + + Whether the role is predefined by OpenAI. + + - `resource_type: String` + + Resource type the role applies to. + + - `updated_at: Integer` + + When the role was last updated. ### Example @@ -13997,144 +14781,129 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -project_user = openai.admin.organization.projects.users.create("project_id", role: "role") +page = openai.admin.organization.groups.roles.list("group_id") -puts(project_user) +puts(page) ``` #### Response ```json { + "data": [ + { "id": "id", - "added_at": 0, - "object": "organization.project.user", - "role": "role", - "email": "email", - "name": "name" + "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" } ``` -## Retrieve project user +## Assign organization role to group -`admin.organization.projects.users.retrieve(user_id, **kwargs) -> ProjectUser` +`admin.organization.groups.roles.create(group_id, **kwargs) -> RoleCreateResponse` -**get** `/organization/projects/{project_id}/users/{user_id}` +**post** `/organization/groups/{group_id}/roles` -Retrieves a user in the project. +Assigns an organization role to a group within the organization. ### Parameters -- `project_id: String` +- `group_id: String` -- `user_id: String` +- `role_id: String` + + Identifier of the role to assign. ### Returns -- `class ProjectUser` +- `class RoleCreateResponse` - Represents an individual user in a project. + Role assignment linking a group to a role. + + - `group: Group{ id, created_at, name, 2 more}` + + Summary information about a group returned in role assignment responses. - `id: String` - The identifier, which can be referenced in API endpoints + Identifier for the group. - - `added_at: Integer` + - `created_at: Integer` - The Unix timestamp (in seconds) of when the project was added. + Unix timestamp (in seconds) when the group was created. - - `object: :"organization.project.user"` + - `name: String` - The object type, which is always `organization.project.user` + Display name of the group. - - `:"organization.project.user"` + - `object: :group` - - `role: String` + Always `group`. - `owner` or `member` + - `:group` - - `email: String` + - `scim_managed: bool` - The email address of the user + Whether the group is managed through SCIM. - - `name: String` + - `object: :"group.role"` - The name of the user + Always `group.role`. -### Example + - `:"group.role"` -```ruby -require "openai" + - `role: Role` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + Details about a role that can be assigned through the public Roles API. -project_user = openai.admin.organization.projects.users.retrieve("user_id", project_id: "project_id") + - `id: String` -puts(project_user) -``` + Identifier for the role. -#### Response + - `description: String` -```json -{ - "id": "id", - "added_at": 0, - "object": "organization.project.user", - "role": "role", - "email": "email", - "name": "name" -} -``` - -## Modify project user - -`admin.organization.projects.users.update(user_id, **kwargs) -> ProjectUser` - -**post** `/organization/projects/{project_id}/users/{user_id}` - -Modifies a user's role in the project. - -### Parameters - -- `project_id: String` - -- `user_id: String` - -- `role: String` - - `owner` or `member` - -### Returns - -- `class ProjectUser` - - Represents an individual user in a project. - - - `id: String` - - The identifier, which can be referenced in API endpoints + Optional description of the role. - - `added_at: Integer` + - `name: String` - The Unix timestamp (in seconds) of when the project was added. + Unique name for the role. - - `object: :"organization.project.user"` + - `object: :role` - The object type, which is always `organization.project.user` + Always `role`. - - `:"organization.project.user"` + - `:role` - - `role: String` + - `permissions: Array[String]` - `owner` or `member` + Permissions granted by the role. - - `email: String` + - `predefined_role: bool` - The email address of the user + Whether the role is predefined and managed by OpenAI. - - `name: String` + - `resource_type: String` - The name of the user + Resource type the role is bound to (for example `api.organization` or `api.project`). ### Example @@ -14143,52 +14912,64 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -project_user = openai.admin.organization.projects.users.update("user_id", project_id: "project_id") +role = openai.admin.organization.groups.roles.create("group_id", role_id: "role_id") -puts(project_user) +puts(role) ``` #### Response ```json { + "group": { "id": "id", - "added_at": 0, - "object": "organization.project.user", - "role": "role", - "email": "email", - "name": "name" + "created_at": 0, + "name": "name", + "object": "group", + "scim_managed": true + }, + "object": "group.role", + "role": { + "id": "id", + "description": "description", + "name": "name", + "object": "role", + "permissions": [ + "string" + ], + "predefined_role": true, + "resource_type": "resource_type" + } } ``` -## Delete project user - -`admin.organization.projects.users.delete(user_id, **kwargs) -> UserDeleteResponse` +## Unassign organization role from group -**delete** `/organization/projects/{project_id}/users/{user_id}` +`admin.organization.groups.roles.delete(role_id, **kwargs) -> RoleDeleteResponse` -Deletes a user from the project. +**delete** `/organization/groups/{group_id}/roles/{role_id}` -Returns confirmation of project user deletion, or an error if the project is -archived (archived projects have no users). +Unassigns an organization role from a group within the organization. ### Parameters -- `project_id: String` +- `group_id: String` -- `user_id: String` +- `role_id: String` ### Returns -- `class UserDeleteResponse` +- `class RoleDeleteResponse` - - `id: String` + Confirmation payload returned after unassigning a role. - `deleted: bool` - - `object: :"organization.project.user.deleted"` + Whether the assignment was removed. - - `:"organization.project.user.deleted"` + - `object: String` + + Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. ### Example @@ -14197,100 +14978,2616 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -user = openai.admin.organization.projects.users.delete("user_id", project_id: "project_id") +role = openai.admin.organization.groups.roles.delete("role_id", group_id: "group_id") -puts(user) +puts(role) ``` #### Response ```json { - "id": "id", "deleted": true, - "object": "organization.project.user.deleted" + "object": "object" } ``` ## Domain Types -### Project User +### Role List Response -- `class ProjectUser` +- `class RoleListResponse` - Represents an individual user in a project. + Detailed information about a role assignment entry returned when listing assignments. - `id: String` - The identifier, which can be referenced in API endpoints + Identifier for the role. - - `added_at: Integer` + - `created_at: Integer` - The Unix timestamp (in seconds) of when the project was added. + When the role was created. - - `object: :"organization.project.user"` + - `created_by: String` - The object type, which is always `organization.project.user` + Identifier of the actor who created the role. - - `:"organization.project.user"` + - `created_by_user_obj: Hash[Symbol, untyped]` - - `role: String` + User details for the actor that created the role, when available. - `owner` or `member` + - `description: String` - - `email: String` + Description of the role. - The email address of the user + - `metadata: Hash[Symbol, untyped]` + + Arbitrary metadata stored on the role. - `name: String` - The name of the user + Name of the role. -### User Delete Response + - `permissions: Array[String]` -- `class UserDeleteResponse` + Permissions associated with the role. + + - `predefined_role: bool` + + Whether the role is predefined by OpenAI. + + - `resource_type: String` + + Resource type the role applies to. + + - `updated_at: Integer` + + When the role was last updated. + +### Role Create Response + +- `class RoleCreateResponse` + + Role assignment linking a group to a role. + + - `group: Group{ id, created_at, name, 2 more}` + + Summary information about a group returned in role assignment responses. + + - `id: String` + + Identifier for the group. + + - `created_at: Integer` + + Unix timestamp (in seconds) when the group was created. + + - `name: String` + + Display name of the group. + + - `object: :group` + + Always `group`. + + - `:group` + + - `scim_managed: bool` + + Whether the group is managed through SCIM. + + - `object: :"group.role"` + + Always `group.role`. + + - `:"group.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[String]` + + Permissions granted by the role. + + - `predefined_role: bool` + + 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`). + +### Role Delete Response + +- `class RoleDeleteResponse` + + Confirmation payload returned after unassigning a role. + - `deleted: bool` - - `object: :"organization.project.user.deleted"` + Whether the assignment was removed. - - `:"organization.project.user.deleted"` + - `object: String` + + Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. # Roles -## List project user role assignments +## List organization roles + +`admin.organization.roles.list(**kwargs) -> NextCursorPage` + +**get** `/organization/roles` + +Lists the roles configured for the organization. + +### Parameters + +- `after: String` + + Cursor for pagination. Provide the value from the previous response's `next` field to continue listing roles. + +- `limit: Integer` + + A limit on the number of roles to return. Defaults to 1000. + +- `order: :asc | :desc` + + Sort order for the returned roles. + + - `:asc` + + - `:desc` + +### Returns + +- `class 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[String]` + + Permissions granted by the role. + + - `predefined_role: bool` + + 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`). + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +page = openai.admin.organization.roles.list + +puts(page) +``` + +#### Response + +```json +{ + "data": [ + { + "id": "id", + "description": "description", + "name": "name", + "object": "role", + "permissions": [ + "string" + ], + "predefined_role": true, + "resource_type": "resource_type" + } + ], + "has_more": true, + "next": "next", + "object": "list" +} +``` + +## Create organization role + +`admin.organization.roles.create(**kwargs) -> Role` + +**post** `/organization/roles` + +Creates a custom role for the organization. + +### Parameters + +- `permissions: Array[String]` + + Permissions to grant to the role. + +- `role_name: String` + + Unique name for the role. + +- `description: String` + + Optional description of the role. + +### Returns + +- `class 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[String]` + + Permissions granted by the role. + + - `predefined_role: bool` + + 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`). + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +role = openai.admin.organization.roles.create(permissions: ["string"], role_name: "role_name") + +puts(role) +``` + +#### Response + +```json +{ + "id": "id", + "description": "description", + "name": "name", + "object": "role", + "permissions": [ + "string" + ], + "predefined_role": true, + "resource_type": "resource_type" +} +``` + +## Update organization role + +`admin.organization.roles.update(role_id, **kwargs) -> Role` + +**post** `/organization/roles/{role_id}` + +Updates an existing organization role. + +### Parameters + +- `role_id: String` + +- `description: String` + + New description for the role. + +- `permissions: Array[String]` + + Updated set of permissions for the role. + +- `role_name: String` + + New name for the role. + +### Returns + +- `class 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[String]` + + Permissions granted by the role. + + - `predefined_role: bool` + + 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`). + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +role = openai.admin.organization.roles.update("role_id") + +puts(role) +``` + +#### Response + +```json +{ + "id": "id", + "description": "description", + "name": "name", + "object": "role", + "permissions": [ + "string" + ], + "predefined_role": true, + "resource_type": "resource_type" +} +``` + +## Delete organization role + +`admin.organization.roles.delete(role_id) -> RoleDeleteResponse` + +**delete** `/organization/roles/{role_id}` + +Deletes a custom role from the organization. + +### Parameters + +- `role_id: String` + +### Returns + +- `class RoleDeleteResponse` + + Confirmation payload returned after deleting a role. + + - `id: String` + + Identifier of the deleted role. + + - `deleted: bool` + + Whether the role was deleted. + + - `object: :"role.deleted"` + + Always `role.deleted`. + + - `:"role.deleted"` + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +role = openai.admin.organization.roles.delete("role_id") + +puts(role) +``` + +#### Response + +```json +{ + "id": "id", + "deleted": true, + "object": "role.deleted" +} +``` + +## Domain Types + +### Role + +- `class 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[String]` + + Permissions granted by the role. + + - `predefined_role: bool` + + 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`). + +### Role Delete Response + +- `class RoleDeleteResponse` + + Confirmation payload returned after deleting a role. + + - `id: String` + + Identifier of the deleted role. + + - `deleted: bool` + + Whether the role was deleted. + + - `object: :"role.deleted"` + + Always `role.deleted`. + + - `:"role.deleted"` + +# Certificates + +## List organization certificates + +`admin.organization.certificates.list(**kwargs) -> ConversationCursorPage` + +**get** `/organization/certificates` + +List uploaded certificates for this organization. + +### Parameters + +- `after: 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: Integer` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + +- `order: :asc | :desc` + + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + + - `:asc` + + - `:desc` + +### Returns + +- `class CertificateListResponse` + + Represents an individual certificate configured at the organization level. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `active: bool` + + Whether the certificate is currently active at the organization level. + + - `certificate_details: CertificateDetails{ expires_at, valid_at}` + + - `expires_at: Integer` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `valid_at: Integer` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `created_at: Integer` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `name: String` + + The name of the certificate. + + - `object: :"organization.certificate"` + + The object type, which is always `organization.certificate`. + + - `:"organization.certificate"` + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +page = openai.admin.organization.certificates.list + +puts(page) +``` + +#### Response + +```json +{ + "data": [ + { + "id": "id", + "active": true, + "certificate_details": { + "expires_at": 0, + "valid_at": 0 + }, + "created_at": 0, + "name": "name", + "object": "organization.certificate" + } + ], + "first_id": "cert_abc", + "has_more": true, + "last_id": "cert_abc", + "object": "list" +} +``` + +## Upload certificate + +`admin.organization.certificates.create(**kwargs) -> Certificate` + +**post** `/organization/certificates` + +Upload a certificate to the organization. This does **not** automatically activate the certificate. + +Organizations can upload up to 50 certificates. + +### Parameters + +- `certificate: String` + + The certificate content in PEM format + +- `name: String` + + An optional name for the certificate + +### Returns + +- `class Certificate` + + Represents an individual `certificate` uploaded to the organization. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `certificate_details: CertificateDetails{ content, expires_at, valid_at}` + + - `content: String` + + The content of the certificate in PEM format. + + - `expires_at: Integer` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `valid_at: Integer` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `created_at: Integer` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `name: String` + + The name of the certificate. + + - `object: :certificate | :"organization.certificate" | :"organization.project.certificate"` + + The object type. + + - If creating, updating, or getting a specific certificate, the object type is `certificate`. + - If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`. + - If listing, activating, or deactivating certificates for a project, the object type is `organization.project.certificate`. + + - `:certificate` + + - `:"organization.certificate"` + + - `:"organization.project.certificate"` + + - `active: bool` + + Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate. + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +certificate = openai.admin.organization.certificates.create(certificate: "certificate") + +puts(certificate) +``` + +#### Response + +```json +{ + "id": "id", + "certificate_details": { + "content": "content", + "expires_at": 0, + "valid_at": 0 + }, + "created_at": 0, + "name": "name", + "object": "certificate", + "active": true +} +``` + +## Get certificate + +`admin.organization.certificates.retrieve(certificate_id, **kwargs) -> Certificate` + +**get** `/organization/certificates/{certificate_id}` + +Get a certificate that has been uploaded to the organization. + +You can get a certificate regardless of whether it is active or not. + +### Parameters + +- `certificate_id: String` + +- `include: Array[:content]` + + A list of additional fields to include in the response. Currently the only supported value is `content` to fetch the PEM content of the certificate. + + - `:content` + +### Returns + +- `class Certificate` + + Represents an individual `certificate` uploaded to the organization. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `certificate_details: CertificateDetails{ content, expires_at, valid_at}` + + - `content: String` + + The content of the certificate in PEM format. + + - `expires_at: Integer` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `valid_at: Integer` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `created_at: Integer` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `name: String` + + The name of the certificate. + + - `object: :certificate | :"organization.certificate" | :"organization.project.certificate"` + + The object type. + + - If creating, updating, or getting a specific certificate, the object type is `certificate`. + - If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`. + - If listing, activating, or deactivating certificates for a project, the object type is `organization.project.certificate`. + + - `:certificate` + + - `:"organization.certificate"` + + - `:"organization.project.certificate"` + + - `active: bool` + + Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate. + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +certificate = openai.admin.organization.certificates.retrieve("certificate_id") + +puts(certificate) +``` + +#### Response + +```json +{ + "id": "id", + "certificate_details": { + "content": "content", + "expires_at": 0, + "valid_at": 0 + }, + "created_at": 0, + "name": "name", + "object": "certificate", + "active": true +} +``` + +## Modify certificate + +`admin.organization.certificates.update(certificate_id, **kwargs) -> Certificate` + +**post** `/organization/certificates/{certificate_id}` + +Modify a certificate. Note that only the name can be modified. + +### Parameters + +- `certificate_id: String` + +- `name: String` + + The updated name for the certificate + +### Returns + +- `class Certificate` + + Represents an individual `certificate` uploaded to the organization. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `certificate_details: CertificateDetails{ content, expires_at, valid_at}` + + - `content: String` + + The content of the certificate in PEM format. + + - `expires_at: Integer` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `valid_at: Integer` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `created_at: Integer` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `name: String` + + The name of the certificate. + + - `object: :certificate | :"organization.certificate" | :"organization.project.certificate"` + + The object type. + + - If creating, updating, or getting a specific certificate, the object type is `certificate`. + - If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`. + - If listing, activating, or deactivating certificates for a project, the object type is `organization.project.certificate`. + + - `:certificate` + + - `:"organization.certificate"` + + - `:"organization.project.certificate"` + + - `active: bool` + + Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate. + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +certificate = openai.admin.organization.certificates.update("certificate_id") + +puts(certificate) +``` + +#### Response + +```json +{ + "id": "id", + "certificate_details": { + "content": "content", + "expires_at": 0, + "valid_at": 0 + }, + "created_at": 0, + "name": "name", + "object": "certificate", + "active": true +} +``` + +## Delete certificate + +`admin.organization.certificates.delete(certificate_id) -> CertificateDeleteResponse` + +**delete** `/organization/certificates/{certificate_id}` + +Delete a certificate from the organization. + +The certificate must be inactive for the organization and all projects. + +### Parameters + +- `certificate_id: String` + +### Returns + +- `class CertificateDeleteResponse` + + - `id: String` + + The ID of the certificate that was deleted. + + - `object: :"certificate.deleted"` + + The object type, must be `certificate.deleted`. + + - `:"certificate.deleted"` + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +certificate = openai.admin.organization.certificates.delete("certificate_id") + +puts(certificate) +``` + +#### Response + +```json +{ + "id": "id", + "object": "certificate.deleted" +} +``` + +## Activate certificates for organization + +`admin.organization.certificates.activate(**kwargs) -> Page` + +**post** `/organization/certificates/activate` + +Activate certificates at the organization level. + +You can atomically and idempotently activate up to 10 certificates at a time. + +### Parameters + +- `certificate_ids: Array[String]` + +### Returns + +- `class CertificateActivateResponse` + + Represents an individual certificate configured at the organization level. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `active: bool` + + Whether the certificate is currently active at the organization level. + + - `certificate_details: CertificateDetails{ expires_at, valid_at}` + + - `expires_at: Integer` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `valid_at: Integer` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `created_at: Integer` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `name: String` + + The name of the certificate. + + - `object: :"organization.certificate"` + + The object type, which is always `organization.certificate`. + + - `:"organization.certificate"` + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +page = openai.admin.organization.certificates.activate(certificate_ids: ["cert_abc"]) + +puts(page) +``` + +#### Response + +```json +{ + "data": [ + { + "id": "id", + "active": true, + "certificate_details": { + "expires_at": 0, + "valid_at": 0 + }, + "created_at": 0, + "name": "name", + "object": "organization.certificate" + } + ], + "object": "organization.certificate.activation" +} +``` + +## Deactivate certificates for organization + +`admin.organization.certificates.deactivate(**kwargs) -> Page` + +**post** `/organization/certificates/deactivate` + +Deactivate certificates at the organization level. + +You can atomically and idempotently deactivate up to 10 certificates at a time. + +### Parameters + +- `certificate_ids: Array[String]` + +### Returns + +- `class CertificateDeactivateResponse` + + Represents an individual certificate configured at the organization level. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `active: bool` + + Whether the certificate is currently active at the organization level. + + - `certificate_details: CertificateDetails{ expires_at, valid_at}` + + - `expires_at: Integer` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `valid_at: Integer` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `created_at: Integer` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `name: String` + + The name of the certificate. + + - `object: :"organization.certificate"` + + The object type, which is always `organization.certificate`. + + - `:"organization.certificate"` + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +page = openai.admin.organization.certificates.deactivate(certificate_ids: ["cert_abc"]) + +puts(page) +``` + +#### Response + +```json +{ + "data": [ + { + "id": "id", + "active": true, + "certificate_details": { + "expires_at": 0, + "valid_at": 0 + }, + "created_at": 0, + "name": "name", + "object": "organization.certificate" + } + ], + "object": "organization.certificate.deactivation" +} +``` + +## Domain Types + +### Certificate + +- `class Certificate` + + Represents an individual `certificate` uploaded to the organization. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `certificate_details: CertificateDetails{ content, expires_at, valid_at}` + + - `content: String` + + The content of the certificate in PEM format. + + - `expires_at: Integer` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `valid_at: Integer` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `created_at: Integer` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `name: String` + + The name of the certificate. + + - `object: :certificate | :"organization.certificate" | :"organization.project.certificate"` + + The object type. + + - If creating, updating, or getting a specific certificate, the object type is `certificate`. + - If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`. + - If listing, activating, or deactivating certificates for a project, the object type is `organization.project.certificate`. + + - `:certificate` + + - `:"organization.certificate"` + + - `:"organization.project.certificate"` + + - `active: bool` + + Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate. + +### Certificate List Response + +- `class CertificateListResponse` + + Represents an individual certificate configured at the organization level. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `active: bool` + + Whether the certificate is currently active at the organization level. + + - `certificate_details: CertificateDetails{ expires_at, valid_at}` + + - `expires_at: Integer` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `valid_at: Integer` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `created_at: Integer` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `name: String` + + The name of the certificate. + + - `object: :"organization.certificate"` + + The object type, which is always `organization.certificate`. + + - `:"organization.certificate"` + +### Certificate Delete Response + +- `class CertificateDeleteResponse` + + - `id: String` + + The ID of the certificate that was deleted. + + - `object: :"certificate.deleted"` + + The object type, must be `certificate.deleted`. + + - `:"certificate.deleted"` + +### Certificate Activate Response + +- `class CertificateActivateResponse` + + Represents an individual certificate configured at the organization level. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `active: bool` + + Whether the certificate is currently active at the organization level. + + - `certificate_details: CertificateDetails{ expires_at, valid_at}` + + - `expires_at: Integer` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `valid_at: Integer` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `created_at: Integer` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `name: String` + + The name of the certificate. + + - `object: :"organization.certificate"` + + The object type, which is always `organization.certificate`. + + - `:"organization.certificate"` + +### Certificate Deactivate Response + +- `class CertificateDeactivateResponse` + + Represents an individual certificate configured at the organization level. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `active: bool` + + Whether the certificate is currently active at the organization level. + + - `certificate_details: CertificateDetails{ expires_at, valid_at}` + + - `expires_at: Integer` + + The Unix timestamp (in seconds) of when the certificate expires. + + - `valid_at: Integer` + + The Unix timestamp (in seconds) of when the certificate becomes valid. + + - `created_at: Integer` + + The Unix timestamp (in seconds) of when the certificate was uploaded. + + - `name: String` + + The name of the certificate. + + - `object: :"organization.certificate"` + + The object type, which is always `organization.certificate`. + + - `:"organization.certificate"` + +# Projects + +## List projects + +`admin.organization.projects.list(**kwargs) -> ConversationCursorPage` + +**get** `/organization/projects` + +Returns a list of projects. + +### Parameters + +- `after: 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. + +- `include_archived: bool` + + If `true` returns all projects including those that have been `archived`. Archived projects are not included by default. + +- `limit: Integer` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + +### Returns + +- `class Project` + + Represents an individual project. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `created_at: Integer` + + The Unix timestamp (in seconds) of when the project was created. + + - `object: :"organization.project"` + + The object type, which is always `organization.project` + + - `:"organization.project"` + + - `archived_at: Integer` + + The Unix timestamp (in seconds) of when the project was archived or `null`. + + - `external_key_id: String` + + The external key associated with the project. + + - `name: String` + + The name of the project. This appears in reporting. + + - `status: String` + + `active` or `archived` + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +page = openai.admin.organization.projects.list + +puts(page) +``` + +#### Response + +```json +{ + "data": [ + { + "id": "id", + "created_at": 0, + "object": "organization.project", + "archived_at": 0, + "external_key_id": "external_key_id", + "name": "name", + "status": "status" + } + ], + "has_more": true, + "object": "list", + "first_id": "first_id", + "last_id": "last_id" +} +``` + +## Create project + +`admin.organization.projects.create(**kwargs) -> Project` + +**post** `/organization/projects` + +Create a new project in the organization. Projects can be created and archived, but cannot be deleted. + +### Parameters + +- `name: String` + + The friendly name of the project, this name appears in reports. + +- `external_key_id: String` + + External key ID to associate with the project. + +- `geography: String` + + Create the project with the specified data residency region. Your organization must have access to Data residency functionality in order to use. See [data residency controls](https://platform.openai.com/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field. + +### Returns + +- `class Project` + + Represents an individual project. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `created_at: Integer` + + The Unix timestamp (in seconds) of when the project was created. + + - `object: :"organization.project"` + + The object type, which is always `organization.project` + + - `:"organization.project"` + + - `archived_at: Integer` + + The Unix timestamp (in seconds) of when the project was archived or `null`. + + - `external_key_id: String` + + The external key associated with the project. + + - `name: String` + + The name of the project. This appears in reporting. + + - `status: String` + + `active` or `archived` + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +project = openai.admin.organization.projects.create(name: "name") + +puts(project) +``` + +#### Response + +```json +{ + "id": "id", + "created_at": 0, + "object": "organization.project", + "archived_at": 0, + "external_key_id": "external_key_id", + "name": "name", + "status": "status" +} +``` + +## Retrieve project + +`admin.organization.projects.retrieve(project_id) -> Project` + +**get** `/organization/projects/{project_id}` + +Retrieves a project. + +### Parameters + +- `project_id: String` + +### Returns + +- `class Project` + + Represents an individual project. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `created_at: Integer` + + The Unix timestamp (in seconds) of when the project was created. + + - `object: :"organization.project"` + + The object type, which is always `organization.project` + + - `:"organization.project"` + + - `archived_at: Integer` + + The Unix timestamp (in seconds) of when the project was archived or `null`. + + - `external_key_id: String` + + The external key associated with the project. + + - `name: String` + + The name of the project. This appears in reporting. + + - `status: String` + + `active` or `archived` + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +project = openai.admin.organization.projects.retrieve("project_id") + +puts(project) +``` + +#### Response + +```json +{ + "id": "id", + "created_at": 0, + "object": "organization.project", + "archived_at": 0, + "external_key_id": "external_key_id", + "name": "name", + "status": "status" +} +``` + +## Modify project + +`admin.organization.projects.update(project_id, **kwargs) -> Project` + +**post** `/organization/projects/{project_id}` + +Modifies a project in the organization. + +### Parameters + +- `project_id: String` + +- `external_key_id: String` + + External key ID to associate with the project. + +- `geography: String` + + Geography for the project. + +- `name: String` + + The updated name of the project, this name appears in reports. + +### Returns + +- `class Project` + + Represents an individual project. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `created_at: Integer` + + The Unix timestamp (in seconds) of when the project was created. + + - `object: :"organization.project"` + + The object type, which is always `organization.project` + + - `:"organization.project"` + + - `archived_at: Integer` + + The Unix timestamp (in seconds) of when the project was archived or `null`. + + - `external_key_id: String` + + The external key associated with the project. + + - `name: String` + + The name of the project. This appears in reporting. + + - `status: String` + + `active` or `archived` + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +project = openai.admin.organization.projects.update("project_id") + +puts(project) +``` + +#### Response + +```json +{ + "id": "id", + "created_at": 0, + "object": "organization.project", + "archived_at": 0, + "external_key_id": "external_key_id", + "name": "name", + "status": "status" +} +``` + +## Archive project + +`admin.organization.projects.archive(project_id) -> Project` + +**post** `/organization/projects/{project_id}/archive` + +Archives a project in the organization. Archived projects cannot be used or updated. + +### Parameters + +- `project_id: String` + +### Returns + +- `class Project` + + Represents an individual project. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `created_at: Integer` + + The Unix timestamp (in seconds) of when the project was created. + + - `object: :"organization.project"` + + The object type, which is always `organization.project` + + - `:"organization.project"` + + - `archived_at: Integer` + + The Unix timestamp (in seconds) of when the project was archived or `null`. + + - `external_key_id: String` + + The external key associated with the project. + + - `name: String` + + The name of the project. This appears in reporting. + + - `status: String` + + `active` or `archived` + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +project = openai.admin.organization.projects.archive("project_id") + +puts(project) +``` + +#### Response + +```json +{ + "id": "id", + "created_at": 0, + "object": "organization.project", + "archived_at": 0, + "external_key_id": "external_key_id", + "name": "name", + "status": "status" +} +``` + +## Domain Types + +### Project + +- `class Project` + + Represents an individual project. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `created_at: Integer` + + The Unix timestamp (in seconds) of when the project was created. + + - `object: :"organization.project"` + + The object type, which is always `organization.project` + + - `:"organization.project"` + + - `archived_at: Integer` + + The Unix timestamp (in seconds) of when the project was archived or `null`. + + - `external_key_id: String` + + The external key associated with the project. + + - `name: String` + + The name of the project. This appears in reporting. + + - `status: String` + + `active` or `archived` + +# Users + +## List project users + +`admin.organization.projects.users.list(project_id, **kwargs) -> ConversationCursorPage` + +**get** `/organization/projects/{project_id}/users` + +Returns a list of users in the project. + +### Parameters + +- `project_id: String` + +- `after: 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: Integer` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + +### Returns + +- `class ProjectUser` + + Represents an individual user in a project. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `added_at: Integer` + + The Unix timestamp (in seconds) of when the project was added. + + - `object: :"organization.project.user"` + + The object type, which is always `organization.project.user` + + - `:"organization.project.user"` + + - `role: String` + + `owner` or `member` + + - `email: String` + + The email address of the user + + - `name: String` + + The name of the user + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +page = openai.admin.organization.projects.users.list("project_id") + +puts(page) +``` + +#### Response + +```json +{ + "data": [ + { + "id": "id", + "added_at": 0, + "object": "organization.project.user", + "role": "role", + "email": "email", + "name": "name" + } + ], + "has_more": true, + "object": "object", + "first_id": "first_id", + "last_id": "last_id" +} +``` + +## Create project user + +`admin.organization.projects.users.create(project_id, **kwargs) -> ProjectUser` + +**post** `/organization/projects/{project_id}/users` + +Adds a user to the project. Users must already be members of the organization to be added to a project. + +### Parameters + +- `project_id: String` + +- `role: String` + + `owner` or `member` + +- `email: String` + + Email of the user to add. + +- `user_id: String` + + The ID of the user. + +### Returns + +- `class ProjectUser` + + Represents an individual user in a project. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `added_at: Integer` + + The Unix timestamp (in seconds) of when the project was added. + + - `object: :"organization.project.user"` + + The object type, which is always `organization.project.user` + + - `:"organization.project.user"` + + - `role: String` + + `owner` or `member` + + - `email: String` + + The email address of the user + + - `name: String` + + The name of the user + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +project_user = openai.admin.organization.projects.users.create("project_id", role: "role") + +puts(project_user) +``` + +#### Response + +```json +{ + "id": "id", + "added_at": 0, + "object": "organization.project.user", + "role": "role", + "email": "email", + "name": "name" +} +``` + +## Retrieve project user + +`admin.organization.projects.users.retrieve(user_id, **kwargs) -> ProjectUser` + +**get** `/organization/projects/{project_id}/users/{user_id}` + +Retrieves a user in the project. + +### Parameters + +- `project_id: String` + +- `user_id: String` + +### Returns + +- `class ProjectUser` + + Represents an individual user in a project. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `added_at: Integer` + + The Unix timestamp (in seconds) of when the project was added. + + - `object: :"organization.project.user"` + + The object type, which is always `organization.project.user` + + - `:"organization.project.user"` + + - `role: String` + + `owner` or `member` + + - `email: String` + + The email address of the user + + - `name: String` + + The name of the user + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +project_user = openai.admin.organization.projects.users.retrieve("user_id", project_id: "project_id") + +puts(project_user) +``` + +#### Response + +```json +{ + "id": "id", + "added_at": 0, + "object": "organization.project.user", + "role": "role", + "email": "email", + "name": "name" +} +``` + +## Modify project user + +`admin.organization.projects.users.update(user_id, **kwargs) -> ProjectUser` + +**post** `/organization/projects/{project_id}/users/{user_id}` + +Modifies a user's role in the project. + +### Parameters + +- `project_id: String` + +- `user_id: String` + +- `role: String` + + `owner` or `member` + +### Returns + +- `class ProjectUser` + + Represents an individual user in a project. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `added_at: Integer` + + The Unix timestamp (in seconds) of when the project was added. + + - `object: :"organization.project.user"` + + The object type, which is always `organization.project.user` + + - `:"organization.project.user"` + + - `role: String` + + `owner` or `member` + + - `email: String` + + The email address of the user + + - `name: String` + + The name of the user + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +project_user = openai.admin.organization.projects.users.update("user_id", project_id: "project_id") + +puts(project_user) +``` + +#### Response + +```json +{ + "id": "id", + "added_at": 0, + "object": "organization.project.user", + "role": "role", + "email": "email", + "name": "name" +} +``` + +## Delete project user + +`admin.organization.projects.users.delete(user_id, **kwargs) -> UserDeleteResponse` + +**delete** `/organization/projects/{project_id}/users/{user_id}` + +Deletes a user from the project. + +Returns confirmation of project user deletion, or an error if the project is +archived (archived projects have no users). + +### Parameters + +- `project_id: String` + +- `user_id: String` + +### Returns + +- `class UserDeleteResponse` + + - `id: String` + + - `deleted: bool` + + - `object: :"organization.project.user.deleted"` + + - `:"organization.project.user.deleted"` + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +user = openai.admin.organization.projects.users.delete("user_id", project_id: "project_id") + +puts(user) +``` + +#### Response + +```json +{ + "id": "id", + "deleted": true, + "object": "organization.project.user.deleted" +} +``` + +## Domain Types + +### Project User + +- `class ProjectUser` + + Represents an individual user in a project. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `added_at: Integer` + + The Unix timestamp (in seconds) of when the project was added. + + - `object: :"organization.project.user"` + + The object type, which is always `organization.project.user` + + - `:"organization.project.user"` + + - `role: String` + + `owner` or `member` + + - `email: String` + + The email address of the user + + - `name: String` + + The name of the user + +### User Delete Response + +- `class UserDeleteResponse` + + - `id: String` + + - `deleted: bool` + + - `object: :"organization.project.user.deleted"` + + - `:"organization.project.user.deleted"` + +# Roles + +## List project user role assignments + +`admin.organization.projects.users.roles.list(user_id, **kwargs) -> NextCursorPage` + +**get** `/projects/{project_id}/users/{user_id}/roles` + +Lists the project roles assigned to a user within a project. + +### Parameters + +- `project_id: String` + +- `user_id: String` + +- `after: String` + + Cursor for pagination. Provide the value from the previous response's `next` field to continue listing project roles. + +- `limit: Integer` + + A limit on the number of project role assignments to return. + +- `order: :asc | :desc` + + Sort order for the returned project roles. + + - `:asc` + + - `:desc` + +### Returns + +- `class RoleListResponse` + + Detailed information about a role assignment entry returned when listing assignments. + + - `id: String` + + Identifier for the role. + + - `created_at: Integer` + + When the role was created. + + - `created_by: String` + + Identifier of the actor who created the role. + + - `created_by_user_obj: Hash[Symbol, untyped]` + + User details for the actor that created the role, when available. + + - `description: String` + + Description of the role. + + - `metadata: Hash[Symbol, untyped]` + + Arbitrary metadata stored on the role. + + - `name: String` + + Name of the role. + + - `permissions: Array[String]` + + Permissions associated with the role. + + - `predefined_role: bool` + + Whether the role is predefined by OpenAI. + + - `resource_type: String` + + Resource type the role applies to. + + - `updated_at: Integer` + + When the role was last updated. + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +page = openai.admin.organization.projects.users.roles.list("user_id", project_id: "project_id") + +puts(page) +``` + +#### 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" +} +``` + +## Assign project role to user + +`admin.organization.projects.users.roles.create(user_id, **kwargs) -> RoleCreateResponse` + +**post** `/projects/{project_id}/users/{user_id}/roles` + +Assigns a project role to a user within a project. + +### Parameters + +- `project_id: String` + +- `user_id: String` + +- `role_id: String` + + Identifier of the role to assign. + +### Returns + +- `class RoleCreateResponse` + + Role assignment linking a user to a role. + + - `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[String]` + + Permissions granted by the role. + + - `predefined_role: bool` + + 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: Integer` + + The Unix timestamp (in seconds) of when the user was added. + + - `object: :"organization.user"` + + The object type, which is always `organization.user` + + - `:"organization.user"` + + - `api_key_last_used_at: Integer` + + The Unix timestamp (in seconds) of the user's last API key usage. + + - `created: Integer` + + The Unix timestamp (in seconds) of when the user was created. + + - `developer_persona: String` + + The developer persona metadata for the user. + + - `email: String` + + The email address of the user + + - `is_default: bool` + + Whether this is the organization's default user. + + - `is_scale_tier_authorized_purchaser: bool` + + Whether the user is an authorized purchaser for Scale Tier. + + - `is_scim_managed: bool` + + Whether the user is managed through SCIM. + + - `is_service_account: bool` + + Whether the user is a service account. + + - `name: String` + + The name of the user + + - `projects: Projects{ data, object}` + + Projects associated with the user, if included. + + - `data: Array[Data{ id, name, role}]` + + - `id: String` + + - `name: String` + + - `role: String` + + - `object: :list` + + - `:list` + + - `role: String` + + `owner` or `reader` + + - `technical_level: String` + + The technical level metadata for the user. + + - `user: User{ id, object, banned, 5 more}` + + Nested user details. + + - `id: String` + + - `object: :user` + + - `:user` + + - `banned: bool` + + - `banned_at: Integer` + + - `email: String` + + - `enabled: bool` + + - `name: String` + + - `picture: String` + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +role = openai.admin.organization.projects.users.roles.create( + "user_id", + project_id: "project_id", + role_id: "role_id" +) + +puts(role) +``` + +#### 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", + "name": "name", + "role": "role" + } + ], + "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" + } + } +} +``` + +## Unassign project role from user + +`admin.organization.projects.users.roles.delete(role_id, **kwargs) -> RoleDeleteResponse` + +**delete** `/projects/{project_id}/users/{user_id}/roles/{role_id}` + +Unassigns a project role from a user within a project. + +### Parameters + +- `project_id: String` + +- `user_id: String` + +- `role_id: String` + +### Returns -`admin.organization.projects.users.roles.list(user_id, **kwargs) -> NextCursorPage` +- `class RoleDeleteResponse` -**get** `/projects/{project_id}/users/{user_id}/roles` + Confirmation payload returned after unassigning a role. -Lists the project roles assigned to a user within a project. + - `deleted: bool` -### Parameters + Whether the assignment was removed. -- `project_id: String` + - `object: String` -- `user_id: String` + Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. -- `after: String` +### Example - Cursor for pagination. Provide the value from the previous response's `next` field to continue listing project roles. +```ruby +require "openai" -- `limit: Integer` +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") - A limit on the number of project role assignments to return. +role = openai.admin.organization.projects.users.roles.delete( + "role_id", + project_id: "project_id", + user_id: "user_id" +) -- `order: :asc | :desc` +puts(role) +``` - Sort order for the returned project roles. +#### Response - - `:asc` +```json +{ + "deleted": true, + "object": "object" +} +``` - - `:desc` +## Domain Types -### Returns +### Role List Response - `class RoleListResponse` @@ -14340,68 +17637,7 @@ Lists the project roles assigned to a user within a project. When the role was last updated. -### Example - -```ruby -require "openai" - -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") - -page = openai.admin.organization.projects.users.roles.list("user_id", project_id: "project_id") - -puts(page) -``` - -#### 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" -} -``` - -## Assign project role to user - -`admin.organization.projects.users.roles.create(user_id, **kwargs) -> RoleCreateResponse` - -**post** `/projects/{project_id}/users/{user_id}/roles` - -Assigns a project role to a user within a project. - -### Parameters - -- `project_id: String` - -- `user_id: String` - -- `role_id: String` - - Identifier of the role to assign. - -### Returns +### Role Create Response - `class RoleCreateResponse` @@ -14521,31 +17757,183 @@ Assigns a project role to a user within a project. `owner` or `reader` - - `technical_level: String` + - `technical_level: String` + + The technical level metadata for the user. + + - `user: User{ id, object, banned, 5 more}` + + Nested user details. + + - `id: String` + + - `object: :user` + + - `:user` + + - `banned: bool` + + - `banned_at: Integer` + + - `email: String` + + - `enabled: bool` + + - `name: String` + + - `picture: String` + +### Role Delete Response + +- `class RoleDeleteResponse` + + Confirmation payload returned after unassigning a role. + + - `deleted: bool` + + 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 + +`admin.organization.projects.service_accounts.list(project_id, **kwargs) -> ConversationCursorPage` + +**get** `/organization/projects/{project_id}/service_accounts` + +Returns a list of service accounts in the project. + +### Parameters + +- `project_id: String` + +- `after: 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: Integer` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + +### Returns + +- `class ProjectServiceAccount` + + Represents an individual service account in a project. + + - `id: String` + + The identifier, which can be referenced in API endpoints + + - `created_at: Integer` + + 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 | :member` + + `owner` or `member` + + - `:owner` + + - `:member` + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +page = openai.admin.organization.projects.service_accounts.list("project_id") + +puts(page) +``` + +#### Response + +```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" +} +``` + +## Create project service account + +`admin.organization.projects.service_accounts.create(project_id, **kwargs) -> ServiceAccountCreateResponse` + +**post** `/organization/projects/{project_id}/service_accounts` + +Creates a new service account in the project. This also returns an unredacted API key for the service account. + +### Parameters + +- `project_id: String` + +- `name: String` + + The name of the service account being created. + +### Returns + +- `class ServiceAccountCreateResponse` + + - `id: String` + + - `api_key: APIKey{ id, created_at, name, 2 more}` + + - `id: String` + + - `created_at: Integer` - The technical level metadata for the user. + - `name: String` - - `user: User{ 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: Integer` - - `banned: bool` + - `name: String` - - `banned_at: Integer` + - `object: :"organization.project.service_account"` - - `email: String` + - `:"organization.project.service_account"` - - `enabled: bool` + - `role: :member` - - `name: String` + Service accounts can only have one role of type `member` - - `picture: String` + - `:member` ### Example @@ -14554,99 +17942,75 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -role = openai.admin.organization.projects.users.roles.create( - "user_id", - project_id: "project_id", - role_id: "role_id" -) +service_account = openai.admin.organization.projects.service_accounts.create("project_id", name: "name") -puts(role) +puts(service_account) ``` #### 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": [ - { + "api_key": { "id": "id", + "created_at": 0, "name": "name", - "role": "role" - } - ], - "object": "list" + "object": "organization.project.service_account.api_key", + "value": "value" }, - "role": "role", - "technical_level": "technical_level", - "user": { - "id": "id", - "object": "user", - "banned": true, - "banned_at": 0, - "email": "email", - "enabled": true, + "created_at": 0, "name": "name", - "picture": "picture" - } - } + "object": "organization.project.service_account", + "role": "member" } ``` -## Unassign project role from user +## Retrieve project service account -`admin.organization.projects.users.roles.delete(role_id, **kwargs) -> RoleDeleteResponse` +`admin.organization.projects.service_accounts.retrieve(service_account_id, **kwargs) -> ProjectServiceAccount` -**delete** `/projects/{project_id}/users/{user_id}/roles/{role_id}` +**get** `/organization/projects/{project_id}/service_accounts/{service_account_id}` -Unassigns a project role from a user within a project. +Retrieves a service account in the project. ### Parameters - `project_id: String` -- `user_id: String` - -- `role_id: String` +- `service_account_id: String` ### Returns -- `class RoleDeleteResponse` +- `class ProjectServiceAccount` - Confirmation payload returned after unassigning a role. + Represents an individual service account in a project. - - `deleted: bool` + - `id: String` - Whether the assignment was removed. + The identifier, which can be referenced in API endpoints - - `object: String` + - `created_at: Integer` - Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + 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 | :member` + + `owner` or `member` + + - `:owner` + + - `:member` ### Example @@ -14655,263 +18019,242 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -role = openai.admin.organization.projects.users.roles.delete( - "role_id", - project_id: "project_id", - user_id: "user_id" +project_service_account = openai.admin.organization.projects.service_accounts.retrieve( + "service_account_id", + project_id: "project_id" ) -puts(role) +puts(project_service_account) ``` #### Response ```json { - "deleted": true, - "object": "object" + "id": "id", + "created_at": 0, + "name": "name", + "object": "organization.project.service_account", + "role": "owner" } ``` -## Domain Types - -### Role List Response - -- `class RoleListResponse` - - Detailed information about a role assignment entry returned when listing assignments. - - - `id: String` - - Identifier for the role. - - - `created_at: Integer` - - When the role was created. - - - `created_by: String` - - Identifier of the actor who created the role. +## Delete project service account - - `created_by_user_obj: Hash[Symbol, untyped]` +`admin.organization.projects.service_accounts.delete(service_account_id, **kwargs) -> ServiceAccountDeleteResponse` - User details for the actor that created the role, when available. +**delete** `/organization/projects/{project_id}/service_accounts/{service_account_id}` - - `description: String` +Deletes a service account from the project. - Description of the role. +Returns confirmation of service account deletion, or an error if the project +is archived (archived projects have no service accounts). - - `metadata: Hash[Symbol, untyped]` +### Parameters - Arbitrary metadata stored on the role. +- `project_id: String` - - `name: String` +- `service_account_id: String` - Name of the role. +### Returns - - `permissions: Array[String]` +- `class ServiceAccountDeleteResponse` - Permissions associated with the role. + - `id: String` - - `predefined_role: bool` + - `deleted: bool` - Whether the role is predefined by OpenAI. + - `object: :"organization.project.service_account.deleted"` - - `resource_type: String` + - `:"organization.project.service_account.deleted"` - Resource type the role applies to. +### Example - - `updated_at: Integer` +```ruby +require "openai" - When the role was last updated. +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -### Role Create Response +service_account = openai.admin.organization.projects.service_accounts.delete("service_account_id", project_id: "project_id") -- `class RoleCreateResponse` +puts(service_account) +``` - Role assignment linking a user to a role. +#### Response - - `object: :"user.role"` +```json +{ + "id": "id", + "deleted": true, + "object": "organization.project.service_account.deleted" +} +``` - Always `user.role`. +## Domain Types - - `:"user.role"` +### Project Service Account - - `role: Role` +- `class ProjectServiceAccount` - Details about a role that can be assigned through the public Roles API. + Represents an individual service account in a project. - `id: String` - Identifier for the role. + The identifier, which can be referenced in API endpoints - - `description: String` + - `created_at: Integer` - Optional description of the role. + The Unix timestamp (in seconds) of when the service account was created - `name: String` - Unique name for the role. - - - `object: :role` - - Always `role`. - - - `:role` - - - `permissions: Array[String]` - - Permissions granted by the role. + The name of the service account - - `predefined_role: bool` + - `object: :"organization.project.service_account"` - Whether the role is predefined and managed by OpenAI. + The object type, which is always `organization.project.service_account` - - `resource_type: String` + - `:"organization.project.service_account"` - Resource type the role is bound to (for example `api.organization` or `api.project`). + - `role: :owner | :member` - - `user: OrganizationUser` + `owner` or `member` - Represents an individual `user` within an organization. + - `:owner` - - `id: String` + - `:member` - The identifier, which can be referenced in API endpoints +### Service Account Create Response - - `added_at: Integer` +- `class ServiceAccountCreateResponse` - The Unix timestamp (in seconds) of when the user was added. + - `id: String` - - `object: :"organization.user"` + - `api_key: APIKey{ id, created_at, name, 2 more}` - The object type, which is always `organization.user` + - `id: String` - - `:"organization.user"` + - `created_at: Integer` - - `api_key_last_used_at: Integer` + - `name: String` - The Unix timestamp (in seconds) of the user's last API key usage. + - `object: :"organization.project.service_account.api_key"` - - `created: Integer` + The object type, which is always `organization.project.service_account.api_key` - The Unix timestamp (in seconds) of when the user was created. + - `:"organization.project.service_account.api_key"` - - `developer_persona: String` + - `value: String` - The developer persona metadata for the user. + - `created_at: Integer` - - `email: String` + - `name: String` - The email address of the user + - `object: :"organization.project.service_account"` - - `is_default: bool` + - `:"organization.project.service_account"` - Whether this is the organization's default user. + - `role: :member` - - `is_scale_tier_authorized_purchaser: bool` + Service accounts can only have one role of type `member` - Whether the user is an authorized purchaser for Scale Tier. + - `:member` - - `is_scim_managed: bool` +### Service Account Delete Response - Whether the user is managed through SCIM. +- `class ServiceAccountDeleteResponse` - - `is_service_account: bool` + - `id: String` - Whether the user is a service account. + - `deleted: bool` - - `name: String` + - `object: :"organization.project.service_account.deleted"` - The name of the user + - `:"organization.project.service_account.deleted"` - - `projects: Projects{ data, object}` +# API Keys - Projects associated with the user, if included. +## List project API keys - - `data: Array[Data{ id, name, role}]` +`admin.organization.projects.api_keys.list(project_id, **kwargs) -> ConversationCursorPage` - - `id: String` +**get** `/organization/projects/{project_id}/api_keys` - - `name: String` +Returns a list of API keys in the project. - - `role: String` +### Parameters - - `object: :list` +- `project_id: String` - - `:list` +- `after: String` - - `role: 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. - `owner` or `reader` +- `limit: Integer` - - `technical_level: String` + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - The technical level metadata for the user. +### Returns - - `user: User{ id, object, banned, 5 more}` +- `class ProjectAPIKey` - Nested user details. + Represents an individual API key in a project. - `id: String` - - `object: :user` - - - `:user` + The identifier, which can be referenced in API endpoints - - `banned: bool` + - `created_at: Integer` - - `banned_at: Integer` + The Unix timestamp (in seconds) of when the API key was created - - `email: String` + - `last_used_at: Integer` - - `enabled: bool` + The Unix timestamp (in seconds) of when the API key was last used. - `name: String` - - `picture: String` - -### Role Delete Response + The name of the API key -- `class RoleDeleteResponse` + - `object: :"organization.project.api_key"` - Confirmation payload returned after unassigning a role. + The object type, which is always `organization.project.api_key` - - `deleted: bool` + - `:"organization.project.api_key"` - Whether the assignment was removed. + - `owner: Owner{ service_account, type, user}` - - `object: String` + - `service_account: ServiceAccount{ id, created_at, name, role}` - Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + The service account that owns a project API key. -# Service Accounts + - `id: String` -## List project service accounts + The identifier, which can be referenced in API endpoints -`admin.organization.projects.service_accounts.list(project_id, **kwargs) -> ConversationCursorPage` + - `created_at: Integer` -**get** `/organization/projects/{project_id}/service_accounts` + The Unix timestamp (in seconds) of when the service account was created. -Returns a list of service accounts in the project. + - `name: String` -### Parameters + The name of the service account. -- `project_id: String` + - `role: String` -- `after: String` + The service account's project role. - 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. + - `type: :user | :service_account` -- `limit: Integer` + `user` or `service_account` - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + - `:user` -### Returns + - `:service_account` -- `class ProjectServiceAccount` + - `user: User{ id, created_at, email, 2 more}` - Represents an individual service account in a project. + The user that owns a project API key. - `id: String` @@ -14919,25 +18262,23 @@ Returns a list of service accounts in the project. - `created_at: Integer` - The Unix timestamp (in seconds) of when the service account was created - - - `name: String` + The Unix timestamp (in seconds) of when the user was created. - The name of the service account + - `email: String` - - `object: :"organization.project.service_account"` + The email address of the user. - The object type, which is always `organization.project.service_account` + - `name: String` - - `:"organization.project.service_account"` + The name of the user. - - `role: :owner | :member` + - `role: String` - `owner` or `member` + The user's project role. - - `:owner` + - `redacted_value: String` - - `:member` + The redacted value of the API key ### Example @@ -14946,7 +18287,7 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -page = openai.admin.organization.projects.service_accounts.list("project_id") +page = openai.admin.organization.projects.api_keys.list("project_id") puts(page) ``` @@ -14959,9 +18300,26 @@ puts(page) { "id": "id", "created_at": 0, + "last_used_at": 0, "name": "name", - "object": "organization.project.service_account", - "role": "owner" + "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" } ], "has_more": true, @@ -14971,108 +18329,81 @@ puts(page) } ``` -## Create project service account +## Retrieve project API key -`admin.organization.projects.service_accounts.create(project_id, **kwargs) -> ServiceAccountCreateResponse` +`admin.organization.projects.api_keys.retrieve(api_key_id, **kwargs) -> ProjectAPIKey` -**post** `/organization/projects/{project_id}/service_accounts` +**get** `/organization/projects/{project_id}/api_keys/{api_key_id}` -Creates a new service account in the project. This also returns an unredacted API key for the service account. +Retrieves an API key in the project. ### Parameters - `project_id: String` -- `name: String` - - The name of the service account being created. +- `api_key_id: String` ### Returns -- `class ServiceAccountCreateResponse` - - - `id: String` +- `class ProjectAPIKey` - - `api_key: APIKey{ id, created_at, name, 2 more}` + Represents an individual API key in a project. - `id: String` - - `created_at: Integer` - - - `name: String` - - - `object: :"organization.project.service_account.api_key"` + The identifier, which can be referenced in API endpoints - The object type, which is always `organization.project.service_account.api_key` + - `created_at: Integer` - - `:"organization.project.service_account.api_key"` + The Unix timestamp (in seconds) of when the API key was created - - `value: String` + - `last_used_at: Integer` - - `created_at: Integer` + The Unix timestamp (in seconds) of when the API key was last used. - `name: String` - - `object: :"organization.project.service_account"` - - - `:"organization.project.service_account"` + The name of the API key - - `role: :member` + - `object: :"organization.project.api_key"` - Service accounts can only have one role of type `member` + The object type, which is always `organization.project.api_key` - - `:member` + - `:"organization.project.api_key"` -### Example + - `owner: Owner{ service_account, type, user}` -```ruby -require "openai" + - `service_account: ServiceAccount{ id, created_at, name, role}` -openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + The service account that owns a project API key. -service_account = openai.admin.organization.projects.service_accounts.create("project_id", name: "name") + - `id: String` -puts(service_account) -``` + The identifier, which can be referenced in API endpoints -#### Response + - `created_at: Integer` -```json -{ - "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" -} -``` + The Unix timestamp (in seconds) of when the service account was created. -## Retrieve project service account + - `name: String` -`admin.organization.projects.service_accounts.retrieve(service_account_id, **kwargs) -> ProjectServiceAccount` + The name of the service account. -**get** `/organization/projects/{project_id}/service_accounts/{service_account_id}` + - `role: String` -Retrieves a service account in the project. + The service account's project role. -### Parameters + - `type: :user | :service_account` -- `project_id: String` + `user` or `service_account` -- `service_account_id: String` + - `:user` -### Returns + - `:service_account` -- `class ProjectServiceAccount` + - `user: User{ id, created_at, email, 2 more}` - Represents an individual service account in a project. + The user that owns a project API key. - `id: String` @@ -15080,25 +18411,23 @@ Retrieves a service account in the project. - `created_at: Integer` - The Unix timestamp (in seconds) of when the service account was created - - - `name: String` + The Unix timestamp (in seconds) of when the user was created. - The name of the service account + - `email: String` - - `object: :"organization.project.service_account"` + The email address of the user. - The object type, which is always `organization.project.service_account` + - `name: String` - - `:"organization.project.service_account"` + The name of the user. - - `role: :owner | :member` + - `role: String` - `owner` or `member` + The user's project role. - - `:owner` + - `redacted_value: String` - - `:member` + The redacted value of the API key ### Example @@ -15107,12 +18436,9 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -project_service_account = openai.admin.organization.projects.service_accounts.retrieve( - "service_account_id", - project_id: "project_id" -) +project_api_key = openai.admin.organization.projects.api_keys.retrieve("api_key_id", project_id: "project_id") -puts(project_service_account) +puts(project_api_key) ``` #### Response @@ -15121,40 +18447,57 @@ puts(project_service_account) { "id": "id", "created_at": 0, + "last_used_at": 0, "name": "name", - "object": "organization.project.service_account", - "role": "owner" + "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" } ``` -## Delete project service account +## Delete project API key -`admin.organization.projects.service_accounts.delete(service_account_id, **kwargs) -> ServiceAccountDeleteResponse` +`admin.organization.projects.api_keys.delete(api_key_id, **kwargs) -> APIKeyDeleteResponse` -**delete** `/organization/projects/{project_id}/service_accounts/{service_account_id}` +**delete** `/organization/projects/{project_id}/api_keys/{api_key_id}` -Deletes a service account from the project. +Deletes an API key from the project. -Returns confirmation of service account deletion, or an error if the project -is archived (archived projects have no service accounts). +Returns confirmation of the key deletion, or an error if the key belonged to +a service account. ### Parameters - `project_id: String` -- `service_account_id: String` +- `api_key_id: String` ### Returns -- `class ServiceAccountDeleteResponse` +- `class APIKeyDeleteResponse` - `id: String` - `deleted: bool` - - `object: :"organization.project.service_account.deleted"` + - `object: :"organization.project.api_key.deleted"` - - `:"organization.project.service_account.deleted"` + - `:"organization.project.api_key.deleted"` ### Example @@ -15163,9 +18506,9 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -service_account = openai.admin.organization.projects.service_accounts.delete("service_account_id", project_id: "project_id") +api_key = openai.admin.organization.projects.api_keys.delete("api_key_id", project_id: "project_id") -puts(service_account) +puts(api_key) ``` #### Response @@ -15174,17 +18517,17 @@ puts(service_account) { "id": "id", "deleted": true, - "object": "organization.project.service_account.deleted" + "object": "organization.project.api_key.deleted" } ``` ## Domain Types -### Project Service Account +### Project API Key -- `class ProjectServiceAccount` +- `class ProjectAPIKey` - Represents an individual service account in a project. + Represents an individual API key in a project. - `id: String` @@ -15192,83 +18535,101 @@ puts(service_account) - `created_at: Integer` - The Unix timestamp (in seconds) of when the service account was created - - - `name: String` + The Unix timestamp (in seconds) of when the API key was created - The name of the service account + - `last_used_at: Integer` - - `object: :"organization.project.service_account"` + The Unix timestamp (in seconds) of when the API key was last used. - The object type, which is always `organization.project.service_account` + - `name: String` - - `:"organization.project.service_account"` + The name of the API key - - `role: :owner | :member` + - `object: :"organization.project.api_key"` - `owner` or `member` + The object type, which is always `organization.project.api_key` - - `:owner` + - `:"organization.project.api_key"` - - `:member` + - `owner: Owner{ service_account, type, user}` -### Service Account Create Response + - `service_account: ServiceAccount{ id, created_at, name, role}` -- `class ServiceAccountCreateResponse` + The service account that owns a project API key. - `id: String` - - `api_key: APIKey{ id, created_at, name, 2 more}` - - - `id: String` + The identifier, which can be referenced in API endpoints - `created_at: Integer` + The Unix timestamp (in seconds) of when the service account was created. + - `name: String` - - `object: :"organization.project.service_account.api_key"` + The name of the service account. - The object type, which is always `organization.project.service_account.api_key` + - `role: String` - - `:"organization.project.service_account.api_key"` + The service account's project role. - - `value: String` + - `type: :user | :service_account` + + `user` or `service_account` + + - `:user` + + - `:service_account` + + - `user: User{ id, created_at, email, 2 more}` + + The user that owns a project API key. + + - `id: String` + + The identifier, which can be referenced in API endpoints - `created_at: Integer` + The Unix timestamp (in seconds) of when the user was created. + + - `email: String` + + The email address of the user. + - `name: String` - - `object: :"organization.project.service_account"` + The name of the user. - - `:"organization.project.service_account"` + - `role: String` - - `role: :member` + The user's project role. - Service accounts can only have one role of type `member` + - `redacted_value: String` - - `:member` + The redacted value of the API key -### Service Account Delete Response +### API Key Delete Response -- `class ServiceAccountDeleteResponse` +- `class APIKeyDeleteResponse` - `id: String` - `deleted: bool` - - `object: :"organization.project.service_account.deleted"` + - `object: :"organization.project.api_key.deleted"` - - `:"organization.project.service_account.deleted"` + - `:"organization.project.api_key.deleted"` -# API Keys +# Rate Limits -## List project API keys +## List project rate limits -`admin.organization.projects.api_keys.list(project_id, **kwargs) -> ConversationCursorPage` +`admin.organization.projects.rate_limits.list_rate_limits(project_id, **kwargs) -> ConversationCursorPage` -**get** `/organization/projects/{project_id}/api_keys` +**get** `/organization/projects/{project_id}/rate_limits` -Returns a list of API keys in the project. +Returns the rate limits per model for a project. ### Parameters @@ -15278,95 +18639,175 @@ Returns a list of API keys in the project. 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: 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: Integer` - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + A limit on the number of objects to be returned. The default is 100. ### Returns -- `class ProjectAPIKey` +- `class ProjectRateLimit` + + Represents a project rate limit config. + + - `id: String` + + The identifier, which can be referenced in API endpoints. + + - `max_requests_per_1_minute: Integer` + + The maximum requests per minute. + + - `max_tokens_per_1_minute: Integer` + + 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: Integer` + + The maximum batch input tokens per day. Only present for relevant models. + + - `max_audio_megabytes_per_1_minute: Integer` + + The maximum audio megabytes per minute. Only present for relevant models. + + - `max_images_per_1_minute: Integer` + + The maximum images per minute. Only present for relevant models. + + - `max_requests_per_1_day: Integer` + + The maximum requests per day. Only present for relevant models. + +### Example + +```ruby +require "openai" + +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + +page = openai.admin.organization.projects.rate_limits.list_rate_limits("project_id") + +puts(page) +``` + +#### Response + +```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 + } + ], + "has_more": true, + "object": "list", + "first_id": "first_id", + "last_id": "last_id" +} +``` - Represents an individual API key in a project. +## Modify project rate limit - - `id: String` +`admin.organization.projects.rate_limits.update_rate_limit(rate_limit_id, **kwargs) -> ProjectRateLimit` - The identifier, which can be referenced in API endpoints +**post** `/organization/projects/{project_id}/rate_limits/{rate_limit_id}` - - `created_at: Integer` +Updates a project rate limit. - The Unix timestamp (in seconds) of when the API key was created +### Parameters - - `last_used_at: Integer` +- `project_id: String` - The Unix timestamp (in seconds) of when the API key was last used. +- `rate_limit_id: String` - - `name: String` +- `batch_1_day_max_input_tokens: Integer` - The name of the API key + The maximum batch input tokens per day. Only relevant for certain models. - - `object: :"organization.project.api_key"` +- `max_audio_megabytes_per_1_minute: Integer` - The object type, which is always `organization.project.api_key` + The maximum audio megabytes per minute. Only relevant for certain models. - - `:"organization.project.api_key"` +- `max_images_per_1_minute: Integer` - - `owner: Owner{ service_account, type, user}` + The maximum images per minute. Only relevant for certain models. - - `service_account: ServiceAccount{ id, created_at, name, role}` +- `max_requests_per_1_day: Integer` - The service account that owns a project API key. + The maximum requests per day. Only relevant for certain models. - - `id: String` +- `max_requests_per_1_minute: Integer` - The identifier, which can be referenced in API endpoints + The maximum requests per minute. - - `created_at: Integer` +- `max_tokens_per_1_minute: Integer` - The Unix timestamp (in seconds) of when the service account was created. + The maximum tokens per minute. - - `name: String` +### Returns - The name of the service account. +- `class ProjectRateLimit` - - `role: String` + Represents a project rate limit config. - The service account's project role. + - `id: String` - - `type: :user | :service_account` + The identifier, which can be referenced in API endpoints. - `user` or `service_account` + - `max_requests_per_1_minute: Integer` - - `:user` + The maximum requests per minute. - - `:service_account` + - `max_tokens_per_1_minute: Integer` - - `user: User{ id, created_at, email, 2 more}` + The maximum tokens per minute. - The user that owns a project API key. + - `model: String` - - `id: String` + The model this rate limit applies to. - The identifier, which can be referenced in API endpoints + - `object: :"project.rate_limit"` - - `created_at: Integer` + The object type, which is always `project.rate_limit` - The Unix timestamp (in seconds) of when the user was created. + - `:"project.rate_limit"` - - `email: String` + - `batch_1_day_max_input_tokens: Integer` - The email address of the user. + The maximum batch input tokens per day. Only present for relevant models. - - `name: String` + - `max_audio_megabytes_per_1_minute: Integer` - The name of the user. + The maximum audio megabytes per minute. Only present for relevant models. - - `role: String` + - `max_images_per_1_minute: Integer` - The user's project role. + The maximum images per minute. Only present for relevant models. - - `redacted_value: String` + - `max_requests_per_1_day: Integer` - The redacted value of the API key + The maximum requests per day. Only present for relevant models. ### Example @@ -15375,147 +18816,113 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -page = openai.admin.organization.projects.api_keys.list("project_id") +project_rate_limit = openai.admin.organization.projects.rate_limits.update_rate_limit( + "rate_limit_id", + project_id: "project_id" +) -puts(page) +puts(project_rate_limit) ``` #### Response ```json { - "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" - } - ], - "has_more": true, - "object": "list", - "first_id": "first_id", - "last_id": "last_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 - -`admin.organization.projects.api_keys.retrieve(api_key_id, **kwargs) -> ProjectAPIKey` - -**get** `/organization/projects/{project_id}/api_keys/{api_key_id}` - -Retrieves an API key in the project. - -### Parameters - -- `project_id: String` - -- `api_key_id: String` +## Domain Types -### Returns +### Project Rate Limit -- `class ProjectAPIKey` +- `class ProjectRateLimit` - 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: Integer` - - The Unix timestamp (in seconds) of when the API key was created + The identifier, which can be referenced in API endpoints. - - `last_used_at: Integer` + - `max_requests_per_1_minute: Integer` - The Unix timestamp (in seconds) of when the API key was last used. + The maximum requests per minute. - - `name: String` + - `max_tokens_per_1_minute: Integer` - The name of the API key + The maximum tokens per minute. - - `object: :"organization.project.api_key"` + - `model: String` - The object type, which is always `organization.project.api_key` + The model this rate limit applies to. - - `:"organization.project.api_key"` + - `object: :"project.rate_limit"` - - `owner: Owner{ service_account, type, user}` + The object type, which is always `project.rate_limit` - - `service_account: ServiceAccount{ id, created_at, name, role}` + - `:"project.rate_limit"` - The service account that owns a project API key. + - `batch_1_day_max_input_tokens: Integer` - - `id: String` + The maximum batch input tokens per day. Only present for relevant models. - The identifier, which can be referenced in API endpoints + - `max_audio_megabytes_per_1_minute: Integer` - - `created_at: Integer` + The maximum audio megabytes per minute. Only present for relevant models. - The Unix timestamp (in seconds) of when the service account was created. + - `max_images_per_1_minute: Integer` - - `name: String` + The maximum images per minute. Only present for relevant models. - The name of the service account. + - `max_requests_per_1_day: Integer` - - `role: String` + The maximum requests per day. Only present for relevant models. - The service account's project role. +# Model Permissions - - `type: :user | :service_account` +## Retrieve project model permissions - `user` or `service_account` +`admin.organization.projects.model_permissions.retrieve(project_id) -> ProjectModelPermissions` - - `:user` +**get** `/organization/projects/{project_id}/model_permissions` - - `:service_account` +Returns model permissions for a project. - - `user: User{ id, created_at, email, 2 more}` +### Parameters - The user that owns a project API key. +- `project_id: String` - - `id: String` +### Returns - The identifier, which can be referenced in API endpoints +- `class ProjectModelPermissions` - - `created_at: Integer` + Represents the model allowlist or denylist policy for a project. - The Unix timestamp (in seconds) of when the user was created. + - `mode: :allow_list | :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[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 @@ -15524,68 +18931,70 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -project_api_key = openai.admin.organization.projects.api_keys.retrieve("api_key_id", project_id: "project_id") +project_model_permissions = openai.admin.organization.projects.model_permissions.retrieve("project_id") -puts(project_api_key) +puts(project_model_permissions) ``` #### Response ```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" } ``` -## Delete project API key - -`admin.organization.projects.api_keys.delete(api_key_id, **kwargs) -> APIKeyDeleteResponse` +## Modify project model permissions -**delete** `/organization/projects/{project_id}/api_keys/{api_key_id}` +`admin.organization.projects.model_permissions.update(project_id, **kwargs) -> ProjectModelPermissions` -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. ### Parameters - `project_id: String` -- `api_key_id: String` +- `mode: :allow_list | :deny_list` + + The model permissions mode to apply. + + - `:allow_list` + + - `:deny_list` + +- `model_ids: Array[String]` + + The model IDs included in this permissions policy. ### Returns -- `class APIKeyDeleteResponse` +- `class ProjectModelPermissions` - - `id: String` + Represents the model allowlist or denylist policy for a project. + + - `mode: :allow_list | :deny_list` + + Whether the project uses an allowlist or a denylist. + + - `:allow_list` + + - `:deny_list` + + - `model_ids: Array[String]` + + The model IDs included in the model permissions policy. - - `deleted: bool` + - `object: :"project.model_permissions"` - - `object: :"organization.project.api_key.deleted"` + The object type, which is always `project.model_permissions`. - - `:"organization.project.api_key.deleted"` + - `:"project.model_permissions"` ### Example @@ -15594,190 +19003,177 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -api_key = openai.admin.organization.projects.api_keys.delete("api_key_id", project_id: "project_id") +project_model_permissions = openai.admin.organization.projects.model_permissions.update( + "project_id", + mode: :allow_list, + model_ids: ["string"] +) -puts(api_key) +puts(project_model_permissions) ``` #### Response ```json { - "id": "id", - "deleted": true, - "object": "organization.project.api_key.deleted" + "mode": "allow_list", + "model_ids": [ + "string" + ], + "object": "project.model_permissions" } ``` -## Domain Types - -### Project API Key - -- `class ProjectAPIKey` - - Represents an individual API key in a project. - - - `id: String` - - The identifier, which can be referenced in API endpoints - - - `created_at: Integer` - - The Unix timestamp (in seconds) of when the API key was created - - - `last_used_at: Integer` +## Delete project model permissions - The Unix timestamp (in seconds) of when the API key was last used. +`admin.organization.projects.model_permissions.delete(project_id) -> ProjectModelPermissionsDeleted` - - `name: String` +**delete** `/organization/projects/{project_id}/model_permissions` - The name of the API key +Deletes model permissions for a project. - - `object: :"organization.project.api_key"` +### Parameters - The object type, which is always `organization.project.api_key` +- `project_id: String` - - `:"organization.project.api_key"` +### Returns - - `owner: Owner{ service_account, type, user}` +- `class ProjectModelPermissionsDeleted` - - `service_account: ServiceAccount{ id, created_at, name, role}` + Confirmation payload returned after deleting project model permissions. - The service account that owns a project API key. + - `deleted: bool` - - `id: String` + Whether the project model permissions were deleted. - The identifier, which can be referenced in API endpoints + - `object: :"project.model_permissions.deleted"` - - `created_at: Integer` + The object type, which is always `project.model_permissions.deleted`. - The Unix timestamp (in seconds) of when the service account was created. + - `:"project.model_permissions.deleted"` - - `name: String` +### Example - The name of the service account. +```ruby +require "openai" - - `role: String` +openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") - The service account's project role. +project_model_permissions_deleted = openai.admin.organization.projects.model_permissions.delete("project_id") - - `type: :user | :service_account` +puts(project_model_permissions_deleted) +``` - `user` or `service_account` +#### Response - - `:user` +```json +{ + "deleted": true, + "object": "project.model_permissions.deleted" +} +``` - - `:service_account` +## Domain Types - - `user: User{ id, created_at, email, 2 more}` +### Project Model Permissions - The user that owns a project API key. +- `class ProjectModelPermissions` - - `id: String` + Represents the model allowlist or denylist policy for a project. - The identifier, which can be referenced in API endpoints + - `mode: :allow_list | :deny_list` - - `created_at: Integer` + Whether the project uses an allowlist or a denylist. - The Unix timestamp (in seconds) of when the user was created. + - `:allow_list` - - `email: String` + - `:deny_list` - The email address of the user. + - `model_ids: Array[String]` - - `name: String` + The model IDs included in the model permissions policy. - The name of the user. + - `object: :"project.model_permissions"` - - `role: String` + The object type, which is always `project.model_permissions`. - The user's project role. + - `:"project.model_permissions"` - - `redacted_value: String` +### Project Model Permissions Deleted - The redacted value of the API key +- `class ProjectModelPermissionsDeleted` -### API Key Delete Response + Confirmation payload returned after deleting project model permissions. -- `class APIKeyDeleteResponse` + - `deleted: bool` - - `id: String` + Whether the project model permissions were deleted. - - `deleted: bool` + - `object: :"project.model_permissions.deleted"` - - `object: :"organization.project.api_key.deleted"` + The object type, which is always `project.model_permissions.deleted`. - - `:"organization.project.api_key.deleted"` + - `:"project.model_permissions.deleted"` -# Rate Limits +# Hosted Tool Permissions -## List project rate limits +## Retrieve project hosted tool permissions -`admin.organization.projects.rate_limits.list_rate_limits(project_id, **kwargs) -> ConversationCursorPage` +`admin.organization.projects.hosted_tool_permissions.retrieve(project_id) -> ProjectHostedToolPermissions` -**get** `/organization/projects/{project_id}/rate_limits` +**get** `/organization/projects/{project_id}/hosted_tool_permissions` -Returns the rate limits per model for a project. +Returns hosted tool permissions for a project. ### Parameters - `project_id: String` -- `after: 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: 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: Integer` - - A limit on the number of objects to be returned. The default is 100. - ### Returns -- `class ProjectRateLimit` +- `class ProjectHostedToolPermissions` - Represents a project rate limit config. + Represents hosted tool permissions for a project. - - `id: String` + - `code_interpreter: CodeInterpreter{ 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: Integer` + - `enabled: bool` - The maximum requests per minute. + Whether the hosted tool is enabled for the project. - - `max_tokens_per_1_minute: Integer` + - `file_search: FileSearch{ enabled}` - The maximum tokens per minute. + Permission state for a single hosted tool on a project. - - `model: String` + - `enabled: bool` - The model this rate limit applies to. + Whether the hosted tool is enabled for the project. - - `object: :"project.rate_limit"` + - `image_generation: ImageGeneration{ enabled}` - The object type, which is always `project.rate_limit` + Permission state for a single hosted tool on a project. - - `:"project.rate_limit"` + - `enabled: bool` - - `batch_1_day_max_input_tokens: Integer` + Whether the hosted tool is enabled for the project. - The maximum batch input tokens per day. Only present for relevant models. + - `mcp: Mcp{ enabled}` - - `max_audio_megabytes_per_1_minute: Integer` + Permission state for a single hosted tool on a project. - The maximum audio megabytes per minute. Only present for relevant models. + - `enabled: bool` - - `max_images_per_1_minute: Integer` + Whether the hosted tool is enabled for the project. - The maximum images per minute. Only present for relevant models. + - `web_search: WebSearch{ enabled}` - - `max_requests_per_1_day: Integer` + Permission state for a single hosted tool on a project. - The maximum requests per day. Only present for relevant models. + - `enabled: bool` + + Whether the hosted tool is enabled for the project. ### Example @@ -15786,116 +19182,130 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -page = openai.admin.organization.projects.rate_limits.list_rate_limits("project_id") +project_hosted_tool_permissions = openai.admin.organization.projects.hosted_tool_permissions.retrieve("project_id") -puts(page) +puts(project_hosted_tool_permissions) ``` #### Response ```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" } ``` -## Modify project rate limit +## Modify project hosted tool permissions -`admin.organization.projects.rate_limits.update_rate_limit(rate_limit_id, **kwargs) -> ProjectRateLimit` +`admin.organization.projects.hosted_tool_permissions.update(project_id, **kwargs) -> ProjectHostedToolPermissions` -**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. ### Parameters - `project_id: String` -- `rate_limit_id: String` +- `code_interpreter: CodeInterpreter{ enabled}` -- `batch_1_day_max_input_tokens: Integer` + The code interpreter permission update. - The maximum batch input tokens per day. Only relevant for certain models. + - `enabled: bool` -- `max_audio_megabytes_per_1_minute: Integer` + Whether to enable the hosted tool for the project. - The maximum audio megabytes per minute. Only relevant for certain models. +- `file_search: FileSearch{ enabled}` -- `max_images_per_1_minute: Integer` + The file search permission update. - The maximum images per minute. Only relevant for certain models. + - `enabled: bool` -- `max_requests_per_1_day: Integer` + Whether to enable the hosted tool for the project. - The maximum requests per day. Only relevant for certain models. +- `image_generation: ImageGeneration{ enabled}` -- `max_requests_per_1_minute: Integer` + The image generation permission update. - The maximum requests per minute. + - `enabled: bool` -- `max_tokens_per_1_minute: Integer` + Whether to enable the hosted tool for the project. - The maximum tokens per minute. +- `mcp: Mcp{ enabled}` + + The MCP permission update. + + - `enabled: bool` + + Whether to enable the hosted tool for the project. + +- `web_search: WebSearch{ enabled}` + + The web search permission update. + + - `enabled: bool` + + Whether to enable the hosted tool for the project. ### Returns -- `class ProjectRateLimit` +- `class ProjectHostedToolPermissions` - Represents a project rate limit config. + Represents hosted tool permissions for a project. - - `id: String` + - `code_interpreter: CodeInterpreter{ 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: Integer` + - `enabled: bool` - The maximum requests per minute. + Whether the hosted tool is enabled for the project. - - `max_tokens_per_1_minute: Integer` + - `file_search: FileSearch{ enabled}` - The maximum tokens per minute. + Permission state for a single hosted tool on a project. - - `model: String` + - `enabled: bool` - The model this rate limit applies to. + Whether the hosted tool is enabled for the project. - - `object: :"project.rate_limit"` + - `image_generation: ImageGeneration{ enabled}` - The object type, which is always `project.rate_limit` + Permission state for a single hosted tool on a project. - - `:"project.rate_limit"` + - `enabled: bool` - - `batch_1_day_max_input_tokens: Integer` + Whether the hosted tool is enabled for the project. - The maximum batch input tokens per day. Only present for relevant models. + - `mcp: Mcp{ enabled}` - - `max_audio_megabytes_per_1_minute: Integer` + Permission state for a single hosted tool on a project. - The maximum audio megabytes per minute. Only present for relevant models. + - `enabled: bool` - - `max_images_per_1_minute: Integer` + Whether the hosted tool is enabled for the project. - The maximum images per minute. Only present for relevant models. + - `web_search: WebSearch{ enabled}` - - `max_requests_per_1_day: Integer` + Permission state for a single hosted tool on a project. - The maximum requests per day. Only present for relevant models. + - `enabled: bool` + + Whether the hosted tool is enabled for the project. ### Example @@ -15904,75 +19314,80 @@ require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") -project_rate_limit = openai.admin.organization.projects.rate_limits.update_rate_limit( - "rate_limit_id", - project_id: "project_id" -) +project_hosted_tool_permissions = openai.admin.organization.projects.hosted_tool_permissions.update("project_id") -puts(project_rate_limit) +puts(project_hosted_tool_permissions) ``` #### Response ```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 + } } ``` ## Domain Types -### Project Rate Limit +### Project Hosted Tool Permissions -- `class ProjectRateLimit` +- `class ProjectHostedToolPermissions` - Represents a project rate limit config. + Represents hosted tool permissions for a project. - - `id: String` + - `code_interpreter: CodeInterpreter{ 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: Integer` + - `enabled: bool` - The maximum requests per minute. + Whether the hosted tool is enabled for the project. - - `max_tokens_per_1_minute: Integer` + - `file_search: FileSearch{ enabled}` - The maximum tokens per minute. + Permission state for a single hosted tool on a project. - - `model: String` + - `enabled: bool` - The model this rate limit applies to. + Whether the hosted tool is enabled for the project. - - `object: :"project.rate_limit"` + - `image_generation: ImageGeneration{ enabled}` - The object type, which is always `project.rate_limit` + Permission state for a single hosted tool on a project. - - `:"project.rate_limit"` + - `enabled: bool` - - `batch_1_day_max_input_tokens: Integer` + Whether the hosted tool is enabled for the project. - The maximum batch input tokens per day. Only present for relevant models. + - `mcp: Mcp{ enabled}` - - `max_audio_megabytes_per_1_minute: Integer` + Permission state for a single hosted tool on a project. - The maximum audio megabytes per minute. Only present for relevant models. + - `enabled: bool` - - `max_images_per_1_minute: Integer` + Whether the hosted tool is enabled for the project. - The maximum images per minute. Only present for relevant models. + - `web_search: WebSearch{ enabled}` - - `max_requests_per_1_day: Integer` + Permission state for a single hosted tool on a project. - The maximum requests per day. Only present for relevant models. + - `enabled: bool` + + Whether the hosted tool is enabled for the project. # Groups