diff --git a/en/go/resources/admin/index.md b/en/go/resources/admin/index.md index 18829ea..2af4dce 100644 --- a/en/go/resources/admin/index.md +++ b/en/go/resources/admin/index.md @@ -2192,6 +2192,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. + - `type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationUsageFileSearchesResult struct{…}` + + The aggregated file search calls usage details of the specific time bucket. + + - `NumRequests int64` + + The count of file search calls. + + - `Object OrganizationUsageFileSearchesResult` + + - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `VectorStoreID string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationUsageWebSearchesResult struct{…}` + + The aggregated web search calls usage details of the specific time bucket. + + - `NumModelRequests int64` + + The count of model requests. + + - `NumRequests int64` + + The count of web search calls. + + - `Object OrganizationUsageWebSearchesResult` + + - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ContextLevel 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. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationCostsResult struct{…}` The aggregated costs details of the specific time bucket. @@ -2639,6 +2703,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. + - `type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationUsageFileSearchesResult struct{…}` + + The aggregated file search calls usage details of the specific time bucket. + + - `NumRequests int64` + + The count of file search calls. + + - `Object OrganizationUsageFileSearchesResult` + + - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `VectorStoreID string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationUsageWebSearchesResult struct{…}` + + The aggregated web search calls usage details of the specific time bucket. + + - `NumModelRequests int64` + + The count of model requests. + + - `NumRequests int64` + + The count of web search calls. + + - `Object OrganizationUsageWebSearchesResult` + + - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ContextLevel 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. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationCostsResult struct{…}` The aggregated costs details of the specific time bucket. @@ -3068,6 +3196,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. + - `type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationUsageFileSearchesResult struct{…}` + + The aggregated file search calls usage details of the specific time bucket. + + - `NumRequests int64` + + The count of file search calls. + + - `Object OrganizationUsageFileSearchesResult` + + - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `VectorStoreID string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationUsageWebSearchesResult struct{…}` + + The aggregated web search calls usage details of the specific time bucket. + + - `NumModelRequests int64` + + The count of model requests. + + - `NumRequests int64` + + The count of web search calls. + + - `Object OrganizationUsageWebSearchesResult` + + - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ContextLevel 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. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationCostsResult struct{…}` The aggregated costs details of the specific time bucket. @@ -3523,6 +3715,70 @@ Get completions usage details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `type AdminOrganizationUsageCompletionsResponseDataResultOrganizationUsageFileSearchesResult struct{…}` + + The aggregated file search calls usage details of the specific time bucket. + + - `NumRequests int64` + + The count of file search calls. + + - `Object OrganizationUsageFileSearchesResult` + + - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `VectorStoreID string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `type AdminOrganizationUsageCompletionsResponseDataResultOrganizationUsageWebSearchesResult struct{…}` + + The aggregated web search calls usage details of the specific time bucket. + + - `NumModelRequests int64` + + The count of model requests. + + - `NumRequests int64` + + The count of web search calls. + + - `Object OrganizationUsageWebSearchesResult` + + - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ContextLevel 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. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `type AdminOrganizationUsageCompletionsResponseDataResultOrganizationCostsResult struct{…}` The aggregated costs details of the specific time bucket. @@ -3970,6 +4226,70 @@ Get embeddings usage details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationUsageFileSearchesResult struct{…}` + + The aggregated file search calls usage details of the specific time bucket. + + - `NumRequests int64` + + The count of file search calls. + + - `Object OrganizationUsageFileSearchesResult` + + - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `VectorStoreID string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationUsageWebSearchesResult struct{…}` + + The aggregated web search calls usage details of the specific time bucket. + + - `NumModelRequests int64` + + The count of model requests. + + - `NumRequests int64` + + The count of web search calls. + + - `Object OrganizationUsageWebSearchesResult` + + - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ContextLevel 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. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationCostsResult struct{…}` The aggregated costs details of the specific time bucket. @@ -4445,35 +4765,99 @@ Get images usage details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `type AdminOrganizationUsageImagesResponseDataResultOrganizationCostsResult struct{…}` + - `type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageFileSearchesResult struct{…}` - The aggregated costs details of the specific time bucket. + The aggregated file search calls usage details of the specific time bucket. - - `Object OrganizationCostsResult` + - `NumRequests int64` - - `const OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"` + The count of file search calls. - - `Amount AdminOrganizationUsageImagesResponseDataResultOrganizationCostsResultAmount` + - `Object OrganizationUsageFileSearchesResult` - The monetary value in its associated currency. + - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"` - - `Currency string` + - `APIKeyID 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 float64` + - `ProjectID string` - The numeric value of the cost. + When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `APIKeyID string` + - `UserID 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. - - `LineItem string` + - `VectorStoreID 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. - - `ProjectID string` + - `type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageWebSearchesResult struct{…}` + + The aggregated web search calls usage details of the specific time bucket. + + - `NumModelRequests int64` + + The count of model requests. + + - `NumRequests int64` + + The count of web search calls. + + - `Object OrganizationUsageWebSearchesResult` + + - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ContextLevel 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. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `type AdminOrganizationUsageImagesResponseDataResultOrganizationCostsResult struct{…}` + + The aggregated costs details of the specific time bucket. + + - `Object OrganizationCostsResult` + + - `const OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"` + + - `Amount AdminOrganizationUsageImagesResponseDataResultOrganizationCostsResultAmount` + + The monetary value in its associated currency. + + - `Currency string` + + Lowercase ISO-4217 currency e.g. "usd" + + - `Value float64` + + The numeric value of the cost. + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `LineItem string` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `ProjectID string` When `group_by=project_id`, this field provides the project ID of the grouped costs result. @@ -4892,6 +5276,70 @@ Get moderations usage details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - `type AdminOrganizationUsageModerationsResponseDataResultOrganizationUsageFileSearchesResult struct{…}` + + The aggregated file search calls usage details of the specific time bucket. + + - `NumRequests int64` + + The count of file search calls. + + - `Object OrganizationUsageFileSearchesResult` + + - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `VectorStoreID string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `type AdminOrganizationUsageModerationsResponseDataResultOrganizationUsageWebSearchesResult struct{…}` + + The aggregated web search calls usage details of the specific time bucket. + + - `NumModelRequests int64` + + The count of model requests. + + - `NumRequests int64` + + The count of web search calls. + + - `Object OrganizationUsageWebSearchesResult` + + - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ContextLevel 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. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `type AdminOrganizationUsageModerationsResponseDataResultOrganizationCostsResult struct{…}` The aggregated costs details of the specific time bucket. @@ -5321,6 +5769,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. + - `type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationUsageFileSearchesResult struct{…}` + + The aggregated file search calls usage details of the specific time bucket. + + - `NumRequests int64` + + The count of file search calls. + + - `Object OrganizationUsageFileSearchesResult` + + - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `VectorStoreID string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationUsageWebSearchesResult struct{…}` + + The aggregated web search calls usage details of the specific time bucket. + + - `NumModelRequests int64` + + The count of model requests. + + - `NumRequests int64` + + The count of web search calls. + + - `Object OrganizationUsageWebSearchesResult` + + - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ContextLevel 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. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - `type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationCostsResult struct{…}` The aggregated costs details of the specific time bucket. @@ -5428,17 +5940,17 @@ func main() { } ``` -## Costs +## File search calls -`client.Admin.Organization.Usage.Costs(ctx, query) (*AdminOrganizationUsageCostsResponse, error)` +`client.Admin.Organization.Usage.FileSearchCalls(ctx, query) (*AdminOrganizationUsageFileSearchCallsResponse, error)` -**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 -- `query AdminOrganizationUsageCostsParams` +- `query AdminOrganizationUsageFileSearchCallsParams` - `StartTime param.Field[int64]` @@ -5446,13 +5958,17 @@ Get costs details for the organization. - `APIKeyIDs param.Field[[]string]` - Return only costs for these API keys. + Return only usage for these API keys. - - `BucketWidth param.Field[AdminOrganizationUsageCostsParamsBucketWidth]` + - `BucketWidth param.Field[AdminOrganizationUsageFileSearchCallsParamsBucketWidth]` - 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`. - - `const AdminOrganizationUsageCostsParamsBucketWidth1d AdminOrganizationUsageCostsParamsBucketWidth = "1d"` + - `const AdminOrganizationUsageFileSearchCallsParamsBucketWidth1m AdminOrganizationUsageFileSearchCallsParamsBucketWidth = "1m"` + + - `const AdminOrganizationUsageFileSearchCallsParamsBucketWidth1h AdminOrganizationUsageFileSearchCallsParamsBucketWidth = "1h"` + + - `const AdminOrganizationUsageFileSearchCallsParamsBucketWidth1d AdminOrganizationUsageFileSearchCallsParamsBucketWidth = "1d"` - `EndTime param.Field[int64]` @@ -5460,17 +5976,23 @@ Get costs details for the organization. - `GroupBy param.Field[[]string]` - 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. - - `const AdminOrganizationUsageCostsParamsGroupByProjectID AdminOrganizationUsageCostsParamsGroupBy = "project_id"` + - `const AdminOrganizationUsageFileSearchCallsParamsGroupByProjectID AdminOrganizationUsageFileSearchCallsParamsGroupBy = "project_id"` - - `const AdminOrganizationUsageCostsParamsGroupByLineItem AdminOrganizationUsageCostsParamsGroupBy = "line_item"` + - `const AdminOrganizationUsageFileSearchCallsParamsGroupByUserID AdminOrganizationUsageFileSearchCallsParamsGroupBy = "user_id"` - - `const AdminOrganizationUsageCostsParamsGroupByAPIKeyID AdminOrganizationUsageCostsParamsGroupBy = "api_key_id"` + - `const AdminOrganizationUsageFileSearchCallsParamsGroupByAPIKeyID AdminOrganizationUsageFileSearchCallsParamsGroupBy = "api_key_id"` + + - `const AdminOrganizationUsageFileSearchCallsParamsGroupByVectorStoreID AdminOrganizationUsageFileSearchCallsParamsGroupBy = "vector_store_id"` - `Limit param.Field[int64]` - 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 param.Field[string]` @@ -5478,13 +6000,21 @@ Get costs details for the organization. - `ProjectIDs param.Field[[]string]` - Return only costs for these projects. + Return only usage for these projects. + + - `UserIDs param.Field[[]string]` + + Return only usage for these users. + + - `VectorStoreIDs param.Field[[]string]` + + Return only usage for these vector stores. ### Returns -- `type AdminOrganizationUsageCostsResponse struct{…}` +- `type AdminOrganizationUsageFileSearchCallsResponse struct{…}` - - `Data []AdminOrganizationUsageCostsResponseData` + - `Data []AdminOrganizationUsageFileSearchCallsResponseData` - `EndTime int64` @@ -5492,9 +6022,9 @@ Get costs details for the organization. - `const BucketBucket Bucket = "bucket"` - - `Results []AdminOrganizationUsageCostsResponseDataResultUnion` + - `Results []AdminOrganizationUsageFileSearchCallsResponseDataResultUnion` - - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageCompletionsResult struct{…}` + - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageCompletionsResult struct{…}` The aggregated completions usage details of the specific time bucket. @@ -5550,7 +6080,7 @@ Get costs details for the organization. When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageEmbeddingsResult struct{…}` + - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageEmbeddingsResult struct{…}` The aggregated embeddings usage details of the specific time bucket. @@ -5582,7 +6112,7 @@ Get costs details for the organization. When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageModerationsResult struct{…}` + - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageModerationsResult struct{…}` The aggregated moderations usage details of the specific time bucket. @@ -5614,7 +6144,7 @@ Get costs details for the organization. When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageImagesResult struct{…}` + - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageImagesResult struct{…}` The aggregated images usage details of the specific time bucket. @@ -5654,7 +6184,7 @@ Get costs details for the organization. When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}` + - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}` The aggregated audio speeches usage details of the specific time bucket. @@ -5686,7 +6216,7 @@ Get costs details for the organization. When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}` + - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}` The aggregated audio transcriptions usage details of the specific time bucket. @@ -5718,7 +6248,7 @@ Get costs details for the organization. When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageVectorStoresResult struct{…}` + - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageVectorStoresResult struct{…}` The aggregated vector stores usage details of the specific time bucket. @@ -5734,7 +6264,7 @@ Get costs details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}` + - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}` The aggregated code interpreter sessions usage details of the specific time bucket. @@ -5750,7 +6280,71 @@ Get costs details for the organization. When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - `type AdminOrganizationUsageCostsResponseDataResultOrganizationCostsResult struct{…}` + - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageFileSearchesResult struct{…}` + + The aggregated file search calls usage details of the specific time bucket. + + - `NumRequests int64` + + The count of file search calls. + + - `Object OrganizationUsageFileSearchesResult` + + - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `VectorStoreID string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageWebSearchesResult struct{…}` + + The aggregated web search calls usage details of the specific time bucket. + + - `NumModelRequests int64` + + The count of model requests. + + - `NumRequests int64` + + The count of web search calls. + + - `Object OrganizationUsageWebSearchesResult` + + - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ContextLevel 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. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationCostsResult struct{…}` The aggregated costs details of the specific time bucket. @@ -5758,7 +6352,7 @@ Get costs details for the organization. - `const OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"` - - `Amount AdminOrganizationUsageCostsResponseDataResultOrganizationCostsResultAmount` + - `Amount AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationCostsResultAmount` The monetary value in its associated currency. @@ -5813,7 +6407,7 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - response, err := client.Admin.Organization.Usage.Costs(context.TODO(), openai.AdminOrganizationUsageCostsParams{ + response, err := client.Admin.Organization.Usage.FileSearchCalls(context.TODO(), openai.AdminOrganizationUsageFileSearchCallsParams{ StartTime: 0, }) if err != nil { @@ -5857,25 +6451,1041 @@ func main() { } ``` -# Invites - -## List invites +## Web search calls -`client.Admin.Organization.Invites.List(ctx, query) (*ConversationCursorPage[Invite], error)` +`client.Admin.Organization.Usage.WebSearchCalls(ctx, query) (*AdminOrganizationUsageWebSearchCallsResponse, error)` -**get** `/organization/invites` +**get** `/organization/usage/web_search_calls` -Returns a list of invites in the organization. +Get web search calls usage details for the organization. ### Parameters -- `query AdminOrganizationInviteListParams` +- `query AdminOrganizationUsageWebSearchCallsParams` - - `After param.Field[string]` + - `StartTime param.Field[int64]` - 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. + Start time (Unix seconds) of the query time range, inclusive. - - `Limit param.Field[int64]` + - `APIKeyIDs param.Field[[]string]` + + Return only usage for these API keys. + + - `BucketWidth param.Field[AdminOrganizationUsageWebSearchCallsParamsBucketWidth]` + + Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. + + - `const AdminOrganizationUsageWebSearchCallsParamsBucketWidth1m AdminOrganizationUsageWebSearchCallsParamsBucketWidth = "1m"` + + - `const AdminOrganizationUsageWebSearchCallsParamsBucketWidth1h AdminOrganizationUsageWebSearchCallsParamsBucketWidth = "1h"` + + - `const AdminOrganizationUsageWebSearchCallsParamsBucketWidth1d AdminOrganizationUsageWebSearchCallsParamsBucketWidth = "1d"` + + - `ContextLevels param.Field[[]string]` + + Return only web search usage for these context levels. + + - `const AdminOrganizationUsageWebSearchCallsParamsContextLevelLow AdminOrganizationUsageWebSearchCallsParamsContextLevel = "low"` + + - `const AdminOrganizationUsageWebSearchCallsParamsContextLevelMedium AdminOrganizationUsageWebSearchCallsParamsContextLevel = "medium"` + + - `const AdminOrganizationUsageWebSearchCallsParamsContextLevelHigh AdminOrganizationUsageWebSearchCallsParamsContextLevel = "high"` + + - `EndTime param.Field[int64]` + + End time (Unix seconds) of the query time range, exclusive. + + - `GroupBy param.Field[[]string]` + + 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. + + - `const AdminOrganizationUsageWebSearchCallsParamsGroupByProjectID AdminOrganizationUsageWebSearchCallsParamsGroupBy = "project_id"` + + - `const AdminOrganizationUsageWebSearchCallsParamsGroupByUserID AdminOrganizationUsageWebSearchCallsParamsGroupBy = "user_id"` + + - `const AdminOrganizationUsageWebSearchCallsParamsGroupByAPIKeyID AdminOrganizationUsageWebSearchCallsParamsGroupBy = "api_key_id"` + + - `const AdminOrganizationUsageWebSearchCallsParamsGroupByModel AdminOrganizationUsageWebSearchCallsParamsGroupBy = "model"` + + - `const AdminOrganizationUsageWebSearchCallsParamsGroupByContextLevel AdminOrganizationUsageWebSearchCallsParamsGroupBy = "context_level"` + + - `Limit param.Field[int64]` + + 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 param.Field[[]string]` + + Return only usage for these models. + + - `Page param.Field[string]` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + + - `ProjectIDs param.Field[[]string]` + + Return only usage for these projects. + + - `UserIDs param.Field[[]string]` + + Return only usage for these users. + +### Returns + +- `type AdminOrganizationUsageWebSearchCallsResponse struct{…}` + + - `Data []AdminOrganizationUsageWebSearchCallsResponseData` + + - `EndTime int64` + + - `Object Bucket` + + - `const BucketBucket Bucket = "bucket"` + + - `Results []AdminOrganizationUsageWebSearchCallsResponseDataResultUnion` + + - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageCompletionsResult struct{…}` + + The aggregated completions usage details of the specific time bucket. + + - `InputTokens int64` + + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + + - `NumModelRequests int64` + + The count of requests made to the model. + + - `Object OrganizationUsageCompletionsResult` + + - `const OrganizationUsageCompletionsResultOrganizationUsageCompletionsResult OrganizationUsageCompletionsResult = "organization.usage.completions.result"` + + - `OutputTokens int64` + + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Batch bool` + + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + + - `InputAudioTokens int64` + + The aggregated number of audio input tokens used, including cached tokens. + + - `InputCachedTokens int64` + + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Model string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `OutputAudioTokens int64` + + The aggregated number of audio output tokens used. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `ServiceTier string` + + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageEmbeddingsResult struct{…}` + + The aggregated embeddings usage details of the specific time bucket. + + - `InputTokens int64` + + The aggregated number of input tokens used. + + - `NumModelRequests int64` + + The count of requests made to the model. + + - `Object OrganizationUsageEmbeddingsResult` + + - `const OrganizationUsageEmbeddingsResultOrganizationUsageEmbeddingsResult OrganizationUsageEmbeddingsResult = "organization.usage.embeddings.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Model string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageModerationsResult struct{…}` + + The aggregated moderations usage details of the specific time bucket. + + - `InputTokens int64` + + The aggregated number of input tokens used. + + - `NumModelRequests int64` + + The count of requests made to the model. + + - `Object OrganizationUsageModerationsResult` + + - `const OrganizationUsageModerationsResultOrganizationUsageModerationsResult OrganizationUsageModerationsResult = "organization.usage.moderations.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Model string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageImagesResult struct{…}` + + The aggregated images usage details of the specific time bucket. + + - `Images int64` + + The number of images processed. + + - `NumModelRequests int64` + + The count of requests made to the model. + + - `Object OrganizationUsageImagesResult` + + - `const OrganizationUsageImagesResultOrganizationUsageImagesResult OrganizationUsageImagesResult = "organization.usage.images.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Model string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Size string` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `Source string` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}` + + The aggregated audio speeches usage details of the specific time bucket. + + - `Characters int64` + + The number of characters processed. + + - `NumModelRequests int64` + + The count of requests made to the model. + + - `Object OrganizationUsageAudioSpeechesResult` + + - `const OrganizationUsageAudioSpeechesResultOrganizationUsageAudioSpeechesResult OrganizationUsageAudioSpeechesResult = "organization.usage.audio_speeches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Model string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `NumModelRequests int64` + + The count of requests made to the model. + + - `Object OrganizationUsageAudioTranscriptionsResult` + + - `const OrganizationUsageAudioTranscriptionsResultOrganizationUsageAudioTranscriptionsResult OrganizationUsageAudioTranscriptionsResult = "organization.usage.audio_transcriptions.result"` + + - `Seconds int64` + + The number of seconds processed. + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Model string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageVectorStoresResult struct{…}` + + The aggregated vector stores usage details of the specific time bucket. + + - `Object OrganizationUsageVectorStoresResult` + + - `const OrganizationUsageVectorStoresResultOrganizationUsageVectorStoresResult OrganizationUsageVectorStoresResult = "organization.usage.vector_stores.result"` + + - `UsageBytes int64` + + The vector stores usage in bytes. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `NumSessions int64` + + The number of code interpreter sessions. + + - `Object OrganizationUsageCodeInterpreterSessionsResult` + + - `const OrganizationUsageCodeInterpreterSessionsResultOrganizationUsageCodeInterpreterSessionsResult OrganizationUsageCodeInterpreterSessionsResult = "organization.usage.code_interpreter_sessions.result"` + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageFileSearchesResult struct{…}` + + The aggregated file search calls usage details of the specific time bucket. + + - `NumRequests int64` + + The count of file search calls. + + - `Object OrganizationUsageFileSearchesResult` + + - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `VectorStoreID string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageWebSearchesResult struct{…}` + + The aggregated web search calls usage details of the specific time bucket. + + - `NumModelRequests int64` + + The count of model requests. + + - `NumRequests int64` + + The count of web search calls. + + - `Object OrganizationUsageWebSearchesResult` + + - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ContextLevel 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. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationCostsResult struct{…}` + + The aggregated costs details of the specific time bucket. + + - `Object OrganizationCostsResult` + + - `const OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"` + + - `Amount AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationCostsResultAmount` + + The monetary value in its associated currency. + + - `Currency string` + + Lowercase ISO-4217 currency e.g. "usd" + + - `Value float64` + + The numeric value of the cost. + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `LineItem string` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `Quantity float64` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `StartTime int64` + + - `HasMore bool` + + - `NextPage string` + + - `Object Page` + + - `const PagePage Page = "page"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/openai/openai-go" + "github.com/openai/openai-go/option" +) + +func main() { + client := openai.NewClient( + option.WithAdminAPIKey("My Admin API Key"), + ) + response, err := client.Admin.Organization.Usage.WebSearchCalls(context.TODO(), openai.AdminOrganizationUsageWebSearchCallsParams{ + StartTime: 0, + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", response.Data) +} +``` + +#### 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 + +`client.Admin.Organization.Usage.Costs(ctx, query) (*AdminOrganizationUsageCostsResponse, error)` + +**get** `/organization/costs` + +Get costs details for the organization. + +### Parameters + +- `query AdminOrganizationUsageCostsParams` + + - `StartTime param.Field[int64]` + + Start time (Unix seconds) of the query time range, inclusive. + + - `APIKeyIDs param.Field[[]string]` + + Return only costs for these API keys. + + - `BucketWidth param.Field[AdminOrganizationUsageCostsParamsBucketWidth]` + + Width of each time bucket in response. Currently only `1d` is supported, default to `1d`. + + - `const AdminOrganizationUsageCostsParamsBucketWidth1d AdminOrganizationUsageCostsParamsBucketWidth = "1d"` + + - `EndTime param.Field[int64]` + + End time (Unix seconds) of the query time range, exclusive. + + - `GroupBy param.Field[[]string]` + + Group the costs by the specified fields. Support fields include `project_id`, `line_item`, `api_key_id` and any combination of them. + + - `const AdminOrganizationUsageCostsParamsGroupByProjectID AdminOrganizationUsageCostsParamsGroupBy = "project_id"` + + - `const AdminOrganizationUsageCostsParamsGroupByLineItem AdminOrganizationUsageCostsParamsGroupBy = "line_item"` + + - `const AdminOrganizationUsageCostsParamsGroupByAPIKeyID AdminOrganizationUsageCostsParamsGroupBy = "api_key_id"` + + - `Limit param.Field[int64]` + + A limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7. + + - `Page param.Field[string]` + + A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. + + - `ProjectIDs param.Field[[]string]` + + Return only costs for these projects. + +### Returns + +- `type AdminOrganizationUsageCostsResponse struct{…}` + + - `Data []AdminOrganizationUsageCostsResponseData` + + - `EndTime int64` + + - `Object Bucket` + + - `const BucketBucket Bucket = "bucket"` + + - `Results []AdminOrganizationUsageCostsResponseDataResultUnion` + + - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageCompletionsResult struct{…}` + + The aggregated completions usage details of the specific time bucket. + + - `InputTokens int64` + + The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. + + - `NumModelRequests int64` + + The count of requests made to the model. + + - `Object OrganizationUsageCompletionsResult` + + - `const OrganizationUsageCompletionsResultOrganizationUsageCompletionsResult OrganizationUsageCompletionsResult = "organization.usage.completions.result"` + + - `OutputTokens int64` + + The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Batch bool` + + When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + + - `InputAudioTokens int64` + + The aggregated number of audio input tokens used, including cached tokens. + + - `InputCachedTokens int64` + + The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens. + + - `Model string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `OutputAudioTokens int64` + + The aggregated number of audio output tokens used. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `ServiceTier string` + + When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageEmbeddingsResult struct{…}` + + The aggregated embeddings usage details of the specific time bucket. + + - `InputTokens int64` + + The aggregated number of input tokens used. + + - `NumModelRequests int64` + + The count of requests made to the model. + + - `Object OrganizationUsageEmbeddingsResult` + + - `const OrganizationUsageEmbeddingsResultOrganizationUsageEmbeddingsResult OrganizationUsageEmbeddingsResult = "organization.usage.embeddings.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Model string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageModerationsResult struct{…}` + + The aggregated moderations usage details of the specific time bucket. + + - `InputTokens int64` + + The aggregated number of input tokens used. + + - `NumModelRequests int64` + + The count of requests made to the model. + + - `Object OrganizationUsageModerationsResult` + + - `const OrganizationUsageModerationsResultOrganizationUsageModerationsResult OrganizationUsageModerationsResult = "organization.usage.moderations.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Model string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageImagesResult struct{…}` + + The aggregated images usage details of the specific time bucket. + + - `Images int64` + + The number of images processed. + + - `NumModelRequests int64` + + The count of requests made to the model. + + - `Object OrganizationUsageImagesResult` + + - `const OrganizationUsageImagesResultOrganizationUsageImagesResult OrganizationUsageImagesResult = "organization.usage.images.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Model string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `Size string` + + When `group_by=size`, this field provides the image size of the grouped usage result. + + - `Source string` + + When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}` + + The aggregated audio speeches usage details of the specific time bucket. + + - `Characters int64` + + The number of characters processed. + + - `NumModelRequests int64` + + The count of requests made to the model. + + - `Object OrganizationUsageAudioSpeechesResult` + + - `const OrganizationUsageAudioSpeechesResultOrganizationUsageAudioSpeechesResult OrganizationUsageAudioSpeechesResult = "organization.usage.audio_speeches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Model string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}` + + The aggregated audio transcriptions usage details of the specific time bucket. + + - `NumModelRequests int64` + + The count of requests made to the model. + + - `Object OrganizationUsageAudioTranscriptionsResult` + + - `const OrganizationUsageAudioTranscriptionsResultOrganizationUsageAudioTranscriptionsResult OrganizationUsageAudioTranscriptionsResult = "organization.usage.audio_transcriptions.result"` + + - `Seconds int64` + + The number of seconds processed. + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `Model string` + + When `group_by=model`, this field provides the model name of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageVectorStoresResult struct{…}` + + The aggregated vector stores usage details of the specific time bucket. + + - `Object OrganizationUsageVectorStoresResult` + + - `const OrganizationUsageVectorStoresResultOrganizationUsageVectorStoresResult OrganizationUsageVectorStoresResult = "organization.usage.vector_stores.result"` + + - `UsageBytes int64` + + The vector stores usage in bytes. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}` + + The aggregated code interpreter sessions usage details of the specific time bucket. + + - `NumSessions int64` + + The number of code interpreter sessions. + + - `Object OrganizationUsageCodeInterpreterSessionsResult` + + - `const OrganizationUsageCodeInterpreterSessionsResultOrganizationUsageCodeInterpreterSessionsResult OrganizationUsageCodeInterpreterSessionsResult = "organization.usage.code_interpreter_sessions.result"` + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageFileSearchesResult struct{…}` + + The aggregated file search calls usage details of the specific time bucket. + + - `NumRequests int64` + + The count of file search calls. + + - `Object OrganizationUsageFileSearchesResult` + + - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `VectorStoreID string` + + When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + + - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageWebSearchesResult struct{…}` + + The aggregated web search calls usage details of the specific time bucket. + + - `NumModelRequests int64` + + The count of model requests. + + - `NumRequests int64` + + The count of web search calls. + + - `Object OrganizationUsageWebSearchesResult` + + - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"` + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + + - `ContextLevel 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. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped usage result. + + - `UserID string` + + When `group_by=user_id`, this field provides the user ID of the grouped usage result. + + - `type AdminOrganizationUsageCostsResponseDataResultOrganizationCostsResult struct{…}` + + The aggregated costs details of the specific time bucket. + + - `Object OrganizationCostsResult` + + - `const OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"` + + - `Amount AdminOrganizationUsageCostsResponseDataResultOrganizationCostsResultAmount` + + The monetary value in its associated currency. + + - `Currency string` + + Lowercase ISO-4217 currency e.g. "usd" + + - `Value float64` + + The numeric value of the cost. + + - `APIKeyID string` + + When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + + - `LineItem string` + + When `group_by=line_item`, this field provides the line item of the grouped costs result. + + - `ProjectID string` + + When `group_by=project_id`, this field provides the project ID of the grouped costs result. + + - `Quantity float64` + + When `group_by=line_item`, this field provides the quantity of the grouped costs result. + + - `StartTime int64` + + - `HasMore bool` + + - `NextPage string` + + - `Object Page` + + - `const PagePage Page = "page"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/openai/openai-go" + "github.com/openai/openai-go/option" +) + +func main() { + client := openai.NewClient( + option.WithAdminAPIKey("My Admin API Key"), + ) + response, err := client.Admin.Organization.Usage.Costs(context.TODO(), openai.AdminOrganizationUsageCostsParams{ + StartTime: 0, + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", response.Data) +} +``` + +#### 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" +} +``` + +# Invites + +## List invites + +`client.Admin.Organization.Invites.List(ctx, query) (*ConversationCursorPage[Invite], error)` + +**get** `/organization/invites` + +Returns a list of invites in the organization. + +### Parameters + +- `query AdminOrganizationInviteListParams` + + - `After param.Field[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 param.Field[int64]` A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. @@ -6027,7 +7637,7 @@ Create an invite for a user to the organization. The invite must be accepted by - `Projects param.Field[[]AdminOrganizationInviteNewParamsProject]` - 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. + An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one. - `ID string` @@ -10342,43 +11952,243 @@ func main() { - `ArchivedAt int64` - The Unix timestamp (in seconds) of when the project was archived or `null`. + The Unix timestamp (in seconds) of when the project was archived or `null`. + + - `ExternalKeyID 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 + +`client.Admin.Organization.Projects.Users.List(ctx, projectID, query) (*ConversationCursorPage[ProjectUser], error)` + +**get** `/organization/projects/{project_id}/users` + +Returns a list of users in the project. + +### Parameters + +- `projectID string` + +- `query AdminOrganizationProjectUserListParams` + + - `After param.Field[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 param.Field[int64]` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + +### Returns + +- `type ProjectUser struct{…}` + + Represents an individual user in a project. + + - `ID string` + + The identifier, which can be referenced in API endpoints + + - `AddedAt int64` + + The Unix timestamp (in seconds) of when the project was added. + + - `Object OrganizationProjectUser` + + The object type, which is always `organization.project.user` + + - `const OrganizationProjectUserOrganizationProjectUser OrganizationProjectUser = "organization.project.user"` + + - `Role string` + + `owner` or `member` + + - `Email string` + + The email address of the user + + - `Name string` + + The name of the user + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/openai/openai-go" + "github.com/openai/openai-go/option" +) + +func main() { + client := openai.NewClient( + option.WithAdminAPIKey("My Admin API Key"), + ) + page, err := client.Admin.Organization.Projects.Users.List( + context.TODO(), + "project_id", + openai.AdminOrganizationProjectUserListParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", 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 + +`client.Admin.Organization.Projects.Users.New(ctx, projectID, body) (*ProjectUser, error)` + +**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 + +- `projectID string` + +- `body AdminOrganizationProjectUserNewParams` + + - `Role param.Field[string]` + + `owner` or `member` + + - `Email param.Field[string]` + + Email of the user to add. + + - `UserID param.Field[string]` + + The ID of the user. + +### Returns + +- `type ProjectUser struct{…}` + + Represents an individual user in a project. + + - `ID string` + + The identifier, which can be referenced in API endpoints + + - `AddedAt int64` + + The Unix timestamp (in seconds) of when the project was added. + + - `Object OrganizationProjectUser` + + The object type, which is always `organization.project.user` + + - `const OrganizationProjectUserOrganizationProjectUser OrganizationProjectUser = "organization.project.user"` + + - `Role string` + + `owner` or `member` - - `ExternalKeyID 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. + The name of the user - - `Status string` +### Example - `active` or `archived` +```go +package main -# Users +import ( + "context" + "fmt" -## List project users + "github.com/openai/openai-go" + "github.com/openai/openai-go/option" +) -`client.Admin.Organization.Projects.Users.List(ctx, projectID, query) (*ConversationCursorPage[ProjectUser], error)` +func main() { + client := openai.NewClient( + option.WithAdminAPIKey("My Admin API Key"), + ) + projectUser, err := client.Admin.Organization.Projects.Users.New( + context.TODO(), + "project_id", + openai.AdminOrganizationProjectUserNewParams{ + Role: "role", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", projectUser.ID) +} +``` -**get** `/organization/projects/{project_id}/users` +#### Response -Returns a list of users in the project. +```json +{ + "id": "id", + "added_at": 0, + "object": "organization.project.user", + "role": "role", + "email": "email", + "name": "name" +} +``` -### Parameters +## Retrieve project user -- `projectID string` +`client.Admin.Organization.Projects.Users.Get(ctx, projectID, userID) (*ProjectUser, error)` -- `query AdminOrganizationProjectUserListParams` +**get** `/organization/projects/{project_id}/users/{user_id}` - - `After param.Field[string]` +Retrieves a user 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. +### Parameters - - `Limit param.Field[int64]` +- `projectID string` - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. +- `userID string` ### Returns @@ -10429,17 +12239,15 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - page, err := client.Admin.Organization.Projects.Users.List( + projectUser, err := client.Admin.Organization.Projects.Users.Get( context.TODO(), "project_id", - openai.AdminOrganizationProjectUserListParams{ - - }, + "user_id", ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", page) + fmt.Printf("%+v\n", projectUser.ID) } ``` @@ -10447,49 +12255,35 @@ func main() { ```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 +## Modify project user -`client.Admin.Organization.Projects.Users.New(ctx, projectID, body) (*ProjectUser, error)` +`client.Admin.Organization.Projects.Users.Update(ctx, projectID, userID, body) (*ProjectUser, error)` -**post** `/organization/projects/{project_id}/users` +**post** `/organization/projects/{project_id}/users/{user_id}` -Adds a user to the project. Users must already be members of the organization to be added to a project. +Modifies a user's role in the project. ### Parameters - `projectID string` -- `body AdminOrganizationProjectUserNewParams` +- `userID string` + +- `body AdminOrganizationProjectUserUpdateParams` - `Role param.Field[string]` `owner` or `member` - - `Email param.Field[string]` - - Email of the user to add. - - - `UserID param.Field[string]` - - The ID of the user. - ### Returns - `type ProjectUser struct{…}` @@ -10539,11 +12333,12 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - projectUser, err := client.Admin.Organization.Projects.Users.New( + projectUser, err := client.Admin.Organization.Projects.Users.Update( context.TODO(), "project_id", - openai.AdminOrganizationProjectUserNewParams{ - Role: "role", + "user_id", + openai.AdminOrganizationProjectUserUpdateParams{ + }, ) if err != nil { @@ -10566,13 +12361,16 @@ func main() { } ``` -## Retrieve project user +## Delete project user -`client.Admin.Organization.Projects.Users.Get(ctx, projectID, userID) (*ProjectUser, error)` +`client.Admin.Organization.Projects.Users.Delete(ctx, projectID, userID) (*AdminOrganizationProjectUserDeleteResponse, error)` -**get** `/organization/projects/{project_id}/users/{user_id}` +**delete** `/organization/projects/{project_id}/users/{user_id}` -Retrieves a user in the project. +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 @@ -10582,6 +12380,59 @@ Retrieves a user in the project. ### Returns +- `type AdminOrganizationProjectUserDeleteResponse struct{…}` + + - `ID string` + + - `Deleted bool` + + - `Object OrganizationProjectUserDeleted` + + - `const OrganizationProjectUserDeletedOrganizationProjectUserDeleted OrganizationProjectUserDeleted = "organization.project.user.deleted"` + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/openai/openai-go" + "github.com/openai/openai-go/option" +) + +func main() { + client := openai.NewClient( + option.WithAdminAPIKey("My Admin API Key"), + ) + user, err := client.Admin.Organization.Projects.Users.Delete( + context.TODO(), + "project_id", + "user_id", + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", user.ID) +} +``` + +#### Response + +```json +{ + "id": "id", + "deleted": true, + "object": "organization.project.user.deleted" +} +``` + +## Domain Types + +### Project User + - `type ProjectUser struct{…}` Represents an individual user in a project. @@ -10602,15 +12453,99 @@ Retrieves a user in the project. - `Role string` - `owner` or `member` + `owner` or `member` + + - `Email string` + + The email address of the user + + - `Name string` + + The name of the user + +# Roles + +## List project user role assignments + +`client.Admin.Organization.Projects.Users.Roles.List(ctx, projectID, userID, query) (*NextCursorPage[AdminOrganizationProjectUserRoleListResponse], error)` + +**get** `/projects/{project_id}/users/{user_id}/roles` + +Lists the project roles assigned to a user within a project. + +### Parameters + +- `projectID string` + +- `userID string` + +- `query AdminOrganizationProjectUserRoleListParams` + + - `After param.Field[string]` + + Cursor for pagination. Provide the value from the previous response's `next` field to continue listing project roles. + + - `Limit param.Field[int64]` + + A limit on the number of project role assignments to return. + + - `Order param.Field[AdminOrganizationProjectUserRoleListParamsOrder]` + + Sort order for the returned project roles. + + - `const AdminOrganizationProjectUserRoleListParamsOrderAsc AdminOrganizationProjectUserRoleListParamsOrder = "asc"` + + - `const AdminOrganizationProjectUserRoleListParamsOrderDesc AdminOrganizationProjectUserRoleListParamsOrder = "desc"` + +### Returns + +- `type AdminOrganizationProjectUserRoleListResponse struct{…}` + + Detailed information about a role assignment entry returned when listing assignments. + + - `ID string` + + Identifier for the role. + + - `CreatedAt int64` + + When the role was created. + + - `CreatedBy string` + + Identifier of the actor who created the role. + + - `CreatedByUserObj map[string, any]` + + User details for the actor that created the role, when available. + + - `Description string` + + Description of the role. + + - `Metadata map[string, any]` + + Arbitrary metadata stored on the role. + + - `Name string` + + Name of the role. + + - `Permissions []string` + + Permissions associated with the role. + + - `PredefinedRole bool` + + Whether the role is predefined by OpenAI. - - `Email string` + - `ResourceType string` - The email address of the user + Resource type the role applies to. - - `Name string` + - `UpdatedAt int64` - The name of the user + When the role was last updated. ### Example @@ -10629,15 +12564,18 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - projectUser, err := client.Admin.Organization.Projects.Users.Get( + page, err := client.Admin.Organization.Projects.Users.Roles.List( context.TODO(), "project_id", "user_id", + openai.AdminOrganizationProjectUserRoleListParams{ + + }, ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", projectUser.ID) + fmt.Printf("%+v\n", page) } ``` @@ -10645,22 +12583,40 @@ func main() { ```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" } ``` -## Modify project user +## Assign project role to user -`client.Admin.Organization.Projects.Users.Update(ctx, projectID, userID, body) (*ProjectUser, error)` +`client.Admin.Organization.Projects.Users.Roles.New(ctx, projectID, userID, body) (*AdminOrganizationProjectUserRoleNewResponse, error)` -**post** `/organization/projects/{project_id}/users/{user_id}` +**post** `/projects/{project_id}/users/{user_id}/roles` -Modifies a user's role in the project. +Assigns a project role to a user within a project. ### Parameters @@ -10668,17 +12624,61 @@ Modifies a user's role in the project. - `userID string` -- `body AdminOrganizationProjectUserUpdateParams` +- `body AdminOrganizationProjectUserRoleNewParams` - - `Role param.Field[string]` + - `RoleID param.Field[string]` - `owner` or `member` + Identifier of the role to assign. ### Returns -- `type ProjectUser struct{…}` +- `type AdminOrganizationProjectUserRoleNewResponse struct{…}` - Represents an individual user in a project. + Role assignment linking a user to a role. + + - `Object UserRole` + + Always `user.role`. + + - `const UserRoleUserRole UserRole = "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`. + + - `const RoleRole Role = "role"` + + - `Permissions []string` + + Permissions granted by the role. + + - `PredefinedRole bool` + + Whether the role is predefined and managed by OpenAI. + + - `ResourceType 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` @@ -10686,26 +12686,96 @@ Modifies a user's role in the project. - `AddedAt int64` - The Unix timestamp (in seconds) of when the project was added. + The Unix timestamp (in seconds) of when the user was added. - - `Object OrganizationProjectUser` + - `Object OrganizationUser` - The object type, which is always `organization.project.user` + The object type, which is always `organization.user` - - `const OrganizationProjectUserOrganizationProjectUser OrganizationProjectUser = "organization.project.user"` + - `const OrganizationUserOrganizationUser OrganizationUser = "organization.user"` - - `Role string` + - `APIKeyLastUsedAt int64` - `owner` or `member` + The Unix timestamp (in seconds) of the user's last API key usage. + + - `Created int64` + + The Unix timestamp (in seconds) of when the user was created. + + - `DeveloperPersona string` + + The developer persona metadata for the user. - `Email string` The email address of the user + - `IsDefault bool` + + Whether this is the organization's default user. + + - `IsScaleTierAuthorizedPurchaser bool` + + Whether the user is an authorized purchaser for Scale Tier. + + - `IsScimManaged bool` + + Whether the user is managed through SCIM. + + - `IsServiceAccount bool` + + Whether the user is a service account. + - `Name string` The name of the user + - `Projects OrganizationUserProjects` + + Projects associated with the user, if included. + + - `Data []OrganizationUserProjectsData` + + - `ID string` + + - `Name string` + + - `Role string` + + - `Object List` + + - `const ListList List = "list"` + + - `Role string` + + `owner` or `reader` + + - `TechnicalLevel string` + + The technical level metadata for the user. + + - `User OrganizationUserUser` + + Nested user details. + + - `ID string` + + - `Object User` + + - `const UserUser User = "user"` + + - `Banned bool` + + - `BannedAt int64` + + - `Email string` + + - `Enabled bool` + + - `Name string` + + - `Picture string` + ### Example ```go @@ -10723,18 +12793,18 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - projectUser, err := client.Admin.Organization.Projects.Users.Update( + role, err := client.Admin.Organization.Projects.Users.Roles.New( context.TODO(), "project_id", "user_id", - openai.AdminOrganizationProjectUserUpdateParams{ - + openai.AdminOrganizationProjectUserRoleNewParams{ + RoleID: "role_id", }, ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", projectUser.ID) + fmt.Printf("%+v\n", role.Object) } ``` @@ -10742,25 +12812,64 @@ func main() { ```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.project.user", + "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", - "name": "name" + "enabled": true, + "name": "name", + "picture": "picture" + } + } } ``` -## Delete project user - -`client.Admin.Organization.Projects.Users.Delete(ctx, projectID, userID) (*AdminOrganizationProjectUserDeleteResponse, error)` +## Unassign project role from user -**delete** `/organization/projects/{project_id}/users/{user_id}` +`client.Admin.Organization.Projects.Users.Roles.Delete(ctx, projectID, userID, roleID) (*AdminOrganizationProjectUserRoleDeleteResponse, error)` -Deletes a user from the project. +**delete** `/projects/{project_id}/users/{user_id}/roles/{role_id}` -Returns confirmation of project user deletion, or an error if the project is -archived (archived projects have no users). +Unassigns a project role from a user within a project. ### Parameters @@ -10768,17 +12877,21 @@ archived (archived projects have no users). - `userID string` +- `roleID string` + ### Returns -- `type AdminOrganizationProjectUserDeleteResponse struct{…}` +- `type AdminOrganizationProjectUserRoleDeleteResponse struct{…}` - - `ID string` + Confirmation payload returned after unassigning a role. - `Deleted bool` - - `Object OrganizationProjectUserDeleted` + Whether the assignment was removed. - - `const OrganizationProjectUserDeletedOrganizationProjectUserDeleted OrganizationProjectUserDeleted = "organization.project.user.deleted"` + - `Object string` + + Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. ### Example @@ -10797,15 +12910,16 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - user, err := client.Admin.Organization.Projects.Users.Delete( + role, err := client.Admin.Organization.Projects.Users.Roles.Delete( context.TODO(), "project_id", "user_id", + "role_id", ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", user.ID) + fmt.Printf("%+v\n", role.Deleted) } ``` @@ -10813,129 +12927,66 @@ func main() { ```json { - "id": "id", "deleted": true, - "object": "organization.project.user.deleted" + "object": "object" } ``` -## Domain Types - -### Project User - -- `type ProjectUser struct{…}` - - Represents an individual user in a project. - - - `ID string` - - The identifier, which can be referenced in API endpoints - - - `AddedAt int64` - - The Unix timestamp (in seconds) of when the project was added. - - - `Object OrganizationProjectUser` - - The object type, which is always `organization.project.user` - - - `const OrganizationProjectUserOrganizationProjectUser OrganizationProjectUser = "organization.project.user"` - - - `Role string` - - `owner` or `member` - - - `Email string` - - The email address of the user - - - `Name string` - - The name of the user - -# Roles +# Service Accounts -## List project user role assignments +## List project service accounts -`client.Admin.Organization.Projects.Users.Roles.List(ctx, projectID, userID, query) (*NextCursorPage[AdminOrganizationProjectUserRoleListResponse], error)` +`client.Admin.Organization.Projects.ServiceAccounts.List(ctx, projectID, query) (*ConversationCursorPage[ProjectServiceAccount], error)` -**get** `/projects/{project_id}/users/{user_id}/roles` +**get** `/organization/projects/{project_id}/service_accounts` -Lists the project roles assigned to a user within a project. +Returns a list of service accounts in the project. ### Parameters - `projectID string` -- `userID string` - -- `query AdminOrganizationProjectUserRoleListParams` +- `query AdminOrganizationProjectServiceAccountListParams` - `After param.Field[string]` - Cursor for pagination. Provide the value from the previous response's `next` field to continue listing project roles. + 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 param.Field[int64]` - A limit on the number of project role assignments to return. - - - `Order param.Field[AdminOrganizationProjectUserRoleListParamsOrder]` - - Sort order for the returned project roles. - - - `const AdminOrganizationProjectUserRoleListParamsOrderAsc AdminOrganizationProjectUserRoleListParamsOrder = "asc"` - - - `const AdminOrganizationProjectUserRoleListParamsOrderDesc AdminOrganizationProjectUserRoleListParamsOrder = "desc"` + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. ### Returns -- `type AdminOrganizationProjectUserRoleListResponse struct{…}` +- `type ProjectServiceAccount struct{…}` - Detailed information about a role assignment entry returned when listing assignments. + Represents an individual service account in a project. - `ID string` - Identifier for the role. + The identifier, which can be referenced in API endpoints - `CreatedAt int64` - When the role was created. - - - `CreatedBy string` - - Identifier of the actor who created the role. - - - `CreatedByUserObj map[string, any]` - - User details for the actor that created the role, when available. - - - `Description string` - - Description of the role. - - - `Metadata map[string, any]` - - Arbitrary metadata stored on the role. + The Unix timestamp (in seconds) of when the service account was created - `Name string` - Name of the role. - - - `Permissions []string` + The name of the service account - Permissions associated with the role. + - `Object OrganizationProjectServiceAccount` - - `PredefinedRole bool` + The object type, which is always `organization.project.service_account` - Whether the role is predefined by OpenAI. + - `const OrganizationProjectServiceAccountOrganizationProjectServiceAccount OrganizationProjectServiceAccount = "organization.project.service_account"` - - `ResourceType string` + - `Role ProjectServiceAccountRole` - Resource type the role applies to. + `owner` or `member` - - `UpdatedAt int64` + - `const ProjectServiceAccountRoleOwner ProjectServiceAccountRole = "owner"` - When the role was last updated. + - `const ProjectServiceAccountRoleMember ProjectServiceAccountRole = "member"` ### Example @@ -10954,11 +13005,10 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - page, err := client.Admin.Organization.Projects.Users.Roles.List( + page, err := client.Admin.Organization.Projects.ServiceAccounts.List( context.TODO(), "project_id", - "user_id", - openai.AdminOrganizationProjectUserRoleListParams{ + openai.AdminOrganizationProjectServiceAccountListParams{ }, ) @@ -10977,194 +13027,167 @@ func main() { { "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 + "object": "organization.project.service_account", + "role": "owner" } ], "has_more": true, - "next": "next", - "object": "list" + "object": "list", + "first_id": "first_id", + "last_id": "last_id" } ``` -## Assign project role to user +## Create project service account -`client.Admin.Organization.Projects.Users.Roles.New(ctx, projectID, userID, body) (*AdminOrganizationProjectUserRoleNewResponse, error)` +`client.Admin.Organization.Projects.ServiceAccounts.New(ctx, projectID, body) (*AdminOrganizationProjectServiceAccountNewResponse, error)` -**post** `/projects/{project_id}/users/{user_id}/roles` +**post** `/organization/projects/{project_id}/service_accounts` -Assigns a project role to a user within a project. +Creates a new service account in the project. This also returns an unredacted API key for the service account. ### Parameters - `projectID string` -- `userID string` - -- `body AdminOrganizationProjectUserRoleNewParams` +- `body AdminOrganizationProjectServiceAccountNewParams` - - `RoleID param.Field[string]` + - `Name param.Field[string]` - Identifier of the role to assign. + The name of the service account being created. ### Returns -- `type AdminOrganizationProjectUserRoleNewResponse struct{…}` - - Role assignment linking a user to a role. - - - `Object UserRole` - - Always `user.role`. - - - `const UserRoleUserRole UserRole = "user.role"` - - - `Role Role` - - Details about a role that can be assigned through the public Roles API. +- `type AdminOrganizationProjectServiceAccountNewResponse struct{…}` - `ID string` - Identifier for the role. - - - `Description string` - - Optional description of the role. - - - `Name string` - - Unique name for the role. - - - `Object Role` - - Always `role`. - - - `const RoleRole Role = "role"` - - - `Permissions []string` - - Permissions granted by the role. - - - `PredefinedRole bool` - - Whether the role is predefined and managed by OpenAI. - - - `ResourceType string` - - Resource type the role is bound to (for example `api.organization` or `api.project`). - - - `User OrganizationUser` - - Represents an individual `user` within an organization. + - `APIKey AdminOrganizationProjectServiceAccountNewResponseAPIKey` - `ID string` - The identifier, which can be referenced in API endpoints - - - `AddedAt int64` - - The Unix timestamp (in seconds) of when the user was added. - - - `Object OrganizationUser` - - The object type, which is always `organization.user` + - `CreatedAt int64` - - `const OrganizationUserOrganizationUser OrganizationUser = "organization.user"` + - `Name string` - - `APIKeyLastUsedAt int64` + - `Object OrganizationProjectServiceAccountAPIKey` - The Unix timestamp (in seconds) of the user's last API key usage. + The object type, which is always `organization.project.service_account.api_key` - - `Created int64` + - `const OrganizationProjectServiceAccountAPIKeyOrganizationProjectServiceAccountAPIKey OrganizationProjectServiceAccountAPIKey = "organization.project.service_account.api_key"` - The Unix timestamp (in seconds) of when the user was created. + - `Value string` - - `DeveloperPersona string` + - `CreatedAt int64` - The developer persona metadata for the user. + - `Name string` - - `Email string` + - `Object OrganizationProjectServiceAccount` - The email address of the user + - `const OrganizationProjectServiceAccountOrganizationProjectServiceAccount OrganizationProjectServiceAccount = "organization.project.service_account"` - - `IsDefault bool` + - `Role Member` - Whether this is the organization's default user. + Service accounts can only have one role of type `member` - - `IsScaleTierAuthorizedPurchaser bool` + - `const MemberMember Member = "member"` - Whether the user is an authorized purchaser for Scale Tier. +### Example - - `IsScimManaged bool` +```go +package main - Whether the user is managed through SCIM. +import ( + "context" + "fmt" - - `IsServiceAccount bool` + "github.com/openai/openai-go" + "github.com/openai/openai-go/option" +) - Whether the user is a service account. +func main() { + client := openai.NewClient( + option.WithAdminAPIKey("My Admin API Key"), + ) + serviceAccount, err := client.Admin.Organization.Projects.ServiceAccounts.New( + context.TODO(), + "project_id", + openai.AdminOrganizationProjectServiceAccountNewParams{ + Name: "name", + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", serviceAccount.ID) +} +``` - - `Name string` +#### Response - The name of the user +```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" +} +``` - - `Projects OrganizationUserProjects` +## Retrieve project service account - Projects associated with the user, if included. +`client.Admin.Organization.Projects.ServiceAccounts.Get(ctx, projectID, serviceAccountID) (*ProjectServiceAccount, error)` - - `Data []OrganizationUserProjectsData` +**get** `/organization/projects/{project_id}/service_accounts/{service_account_id}` - - `ID string` +Retrieves a service account in the project. - - `Name string` +### Parameters - - `Role string` +- `projectID string` - - `Object List` +- `serviceAccountID string` - - `const ListList List = "list"` +### Returns - - `Role string` +- `type ProjectServiceAccount struct{…}` - `owner` or `reader` + Represents an individual service account in a project. - - `TechnicalLevel string` + - `ID string` - The technical level metadata for the user. + The identifier, which can be referenced in API endpoints - - `User OrganizationUserUser` + - `CreatedAt int64` - Nested user details. + The Unix timestamp (in seconds) of when the service account was created - - `ID string` + - `Name string` - - `Object User` + The name of the service account - - `const UserUser User = "user"` + - `Object OrganizationProjectServiceAccount` - - `Banned bool` + The object type, which is always `organization.project.service_account` - - `BannedAt int64` + - `const OrganizationProjectServiceAccountOrganizationProjectServiceAccount OrganizationProjectServiceAccount = "organization.project.service_account"` - - `Email string` + - `Role ProjectServiceAccountRole` - - `Enabled bool` + `owner` or `member` - - `Name string` + - `const ProjectServiceAccountRoleOwner ProjectServiceAccountRole = "owner"` - - `Picture string` + - `const ProjectServiceAccountRoleMember ProjectServiceAccountRole = "member"` ### Example @@ -11183,18 +13206,15 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - role, err := client.Admin.Organization.Projects.Users.Roles.New( + projectServiceAccount, err := client.Admin.Organization.Projects.ServiceAccounts.Get( context.TODO(), "project_id", - "user_id", - openai.AdminOrganizationProjectUserRoleNewParams{ - RoleID: "role_id", - }, + "service_account_id", ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", role.Object) + fmt.Printf("%+v\n", projectServiceAccount.ID) } ``` @@ -11202,86 +13222,42 @@ func main() { ```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, + "created_at": 0, "name": "name", - "picture": "picture" - } - } + "object": "organization.project.service_account", + "role": "owner" } ``` -## Unassign project role from user +## Delete project service account -`client.Admin.Organization.Projects.Users.Roles.Delete(ctx, projectID, userID, roleID) (*AdminOrganizationProjectUserRoleDeleteResponse, error)` +`client.Admin.Organization.Projects.ServiceAccounts.Delete(ctx, projectID, serviceAccountID) (*AdminOrganizationProjectServiceAccountDeleteResponse, error)` -**delete** `/projects/{project_id}/users/{user_id}/roles/{role_id}` +**delete** `/organization/projects/{project_id}/service_accounts/{service_account_id}` -Unassigns a project role from a user within a project. +Deletes a service account from the project. + +Returns confirmation of service account deletion, or an error if the project +is archived (archived projects have no service accounts). ### Parameters - `projectID string` -- `userID string` - -- `roleID string` +- `serviceAccountID string` ### Returns -- `type AdminOrganizationProjectUserRoleDeleteResponse struct{…}` +- `type AdminOrganizationProjectServiceAccountDeleteResponse struct{…}` - Confirmation payload returned after unassigning a role. + - `ID string` - `Deleted bool` - Whether the assignment was removed. - - - `Object string` + - `Object OrganizationProjectServiceAccountDeleted` - Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + - `const OrganizationProjectServiceAccountDeletedOrganizationProjectServiceAccountDeleted OrganizationProjectServiceAccountDeleted = "organization.project.service_account.deleted"` ### Example @@ -11300,57 +13276,147 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - role, err := client.Admin.Organization.Projects.Users.Roles.Delete( + serviceAccount, err := client.Admin.Organization.Projects.ServiceAccounts.Delete( context.TODO(), "project_id", - "user_id", - "role_id", + "service_account_id", ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", role.Deleted) + fmt.Printf("%+v\n", serviceAccount.ID) +} +``` + +#### Response + +```json +{ + "id": "id", + "deleted": true, + "object": "organization.project.service_account.deleted" } ``` -#### Response +## Domain Types + +### Project Service Account + +- `type ProjectServiceAccount struct{…}` + + Represents an individual service account in a project. + + - `ID string` + + The identifier, which can be referenced in API endpoints + + - `CreatedAt int64` + + The Unix timestamp (in seconds) of when the service account was created + + - `Name string` + + The name of the service account + + - `Object OrganizationProjectServiceAccount` + + The object type, which is always `organization.project.service_account` + + - `const OrganizationProjectServiceAccountOrganizationProjectServiceAccount OrganizationProjectServiceAccount = "organization.project.service_account"` + + - `Role ProjectServiceAccountRole` + + `owner` or `member` + + - `const ProjectServiceAccountRoleOwner ProjectServiceAccountRole = "owner"` + + - `const ProjectServiceAccountRoleMember ProjectServiceAccountRole = "member"` + +# API Keys + +## List project API keys + +`client.Admin.Organization.Projects.APIKeys.List(ctx, projectID, query) (*ConversationCursorPage[ProjectAPIKey], error)` + +**get** `/organization/projects/{project_id}/api_keys` + +Returns a list of API keys in the project. + +### Parameters + +- `projectID string` + +- `query AdminOrganizationProjectAPIKeyListParams` + + - `After param.Field[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 param.Field[int64]` + + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + +### Returns + +- `type ProjectAPIKey struct{…}` + + Represents an individual API key in a project. + + - `ID string` + + The identifier, which can be referenced in API endpoints + + - `CreatedAt int64` + + The Unix timestamp (in seconds) of when the API key was created + + - `LastUsedAt int64` + + The Unix timestamp (in seconds) of when the API key was last used. -```json -{ - "deleted": true, - "object": "object" -} -``` + - `Name string` -# Service Accounts + The name of the API key -## List project service accounts + - `Object OrganizationProjectAPIKey` -`client.Admin.Organization.Projects.ServiceAccounts.List(ctx, projectID, query) (*ConversationCursorPage[ProjectServiceAccount], error)` + The object type, which is always `organization.project.api_key` -**get** `/organization/projects/{project_id}/service_accounts` + - `const OrganizationProjectAPIKeyOrganizationProjectAPIKey OrganizationProjectAPIKey = "organization.project.api_key"` -Returns a list of service accounts in the project. + - `Owner ProjectAPIKeyOwner` -### Parameters + - `ServiceAccount ProjectAPIKeyOwnerServiceAccount` -- `projectID string` + The service account that owns a project API key. -- `query AdminOrganizationProjectServiceAccountListParams` + - `ID string` - - `After param.Field[string]` + The identifier, which can be referenced in API endpoints - 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. + - `CreatedAt int64` - - `Limit param.Field[int64]` + The Unix timestamp (in seconds) of when the service account was created. - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + - `Name string` -### Returns + The name of the service account. -- `type ProjectServiceAccount struct{…}` + - `Role string` - Represents an individual service account in a project. + The service account's project role. + + - `Type string` + + `user` or `service_account` + + - `const ProjectAPIKeyOwnerTypeUser ProjectAPIKeyOwnerType = "user"` + + - `const ProjectAPIKeyOwnerTypeServiceAccount ProjectAPIKeyOwnerType = "service_account"` + + - `User ProjectAPIKeyOwnerUser` + + The user that owns a project API key. - `ID string` @@ -11358,25 +13424,23 @@ Returns a list of service accounts in the project. - `CreatedAt int64` - 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 OrganizationProjectServiceAccount` + The email address of the user. - The object type, which is always `organization.project.service_account` + - `Name string` - - `const OrganizationProjectServiceAccountOrganizationProjectServiceAccount OrganizationProjectServiceAccount = "organization.project.service_account"` + The name of the user. - - `Role ProjectServiceAccountRole` + - `Role string` - `owner` or `member` + The user's project role. - - `const ProjectServiceAccountRoleOwner ProjectServiceAccountRole = "owner"` + - `RedactedValue string` - - `const ProjectServiceAccountRoleMember ProjectServiceAccountRole = "member"` + The redacted value of the API key ### Example @@ -11395,10 +13459,10 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - page, err := client.Admin.Organization.Projects.ServiceAccounts.List( + page, err := client.Admin.Organization.Projects.APIKeys.List( context.TODO(), "project_id", - openai.AdminOrganizationProjectServiceAccountListParams{ + openai.AdminOrganizationProjectAPIKeyListParams{ }, ) @@ -11417,9 +13481,26 @@ func main() { { "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, @@ -11429,129 +13510,81 @@ func main() { } ``` -## Create project service account +## Retrieve project API key -`client.Admin.Organization.Projects.ServiceAccounts.New(ctx, projectID, body) (*AdminOrganizationProjectServiceAccountNewResponse, error)` +`client.Admin.Organization.Projects.APIKeys.Get(ctx, projectID, apiKeyID) (*ProjectAPIKey, error)` -**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 - `projectID string` -- `body AdminOrganizationProjectServiceAccountNewParams` - - - `Name param.Field[string]` - - The name of the service account being created. +- `apiKeyID string` ### Returns -- `type AdminOrganizationProjectServiceAccountNewResponse struct{…}` - - - `ID string` +- `type ProjectAPIKey struct{…}` - - `APIKey AdminOrganizationProjectServiceAccountNewResponseAPIKey` + Represents an individual API key in a project. - `ID string` - - `CreatedAt int64` - - - `Name string` - - - `Object OrganizationProjectServiceAccountAPIKey` + The identifier, which can be referenced in API endpoints - The object type, which is always `organization.project.service_account.api_key` + - `CreatedAt int64` - - `const OrganizationProjectServiceAccountAPIKeyOrganizationProjectServiceAccountAPIKey OrganizationProjectServiceAccountAPIKey = "organization.project.service_account.api_key"` + The Unix timestamp (in seconds) of when the API key was created - - `Value string` + - `LastUsedAt int64` - - `CreatedAt int64` + The Unix timestamp (in seconds) of when the API key was last used. - `Name string` - - `Object OrganizationProjectServiceAccount` - - - `const OrganizationProjectServiceAccountOrganizationProjectServiceAccount OrganizationProjectServiceAccount = "organization.project.service_account"` + The name of the API key - - `Role Member` + - `Object OrganizationProjectAPIKey` - Service accounts can only have one role of type `member` + The object type, which is always `organization.project.api_key` - - `const MemberMember Member = "member"` + - `const OrganizationProjectAPIKeyOrganizationProjectAPIKey OrganizationProjectAPIKey = "organization.project.api_key"` -### Example + - `Owner ProjectAPIKeyOwner` -```go -package main + - `ServiceAccount ProjectAPIKeyOwnerServiceAccount` -import ( - "context" - "fmt" + The service account that owns a project API key. - "github.com/openai/openai-go" - "github.com/openai/openai-go/option" -) + - `ID string` -func main() { - client := openai.NewClient( - option.WithAdminAPIKey("My Admin API Key"), - ) - serviceAccount, err := client.Admin.Organization.Projects.ServiceAccounts.New( - context.TODO(), - "project_id", - openai.AdminOrganizationProjectServiceAccountNewParams{ - Name: "name", - }, - ) - if err != nil { - panic(err.Error()) - } - fmt.Printf("%+v\n", serviceAccount.ID) -} -``` + The identifier, which can be referenced in API endpoints -#### Response + - `CreatedAt int64` -```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` -`client.Admin.Organization.Projects.ServiceAccounts.Get(ctx, projectID, serviceAccountID) (*ProjectServiceAccount, error)` + 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 string` -- `projectID string` + `user` or `service_account` -- `serviceAccountID string` + - `const ProjectAPIKeyOwnerTypeUser ProjectAPIKeyOwnerType = "user"` -### Returns + - `const ProjectAPIKeyOwnerTypeServiceAccount ProjectAPIKeyOwnerType = "service_account"` -- `type ProjectServiceAccount struct{…}` + - `User ProjectAPIKeyOwnerUser` - Represents an individual service account in a project. + The user that owns a project API key. - `ID string` @@ -11559,25 +13592,23 @@ Retrieves a service account in the project. - `CreatedAt int64` - 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 OrganizationProjectServiceAccount` + The email address of the user. - The object type, which is always `organization.project.service_account` + - `Name string` - - `const OrganizationProjectServiceAccountOrganizationProjectServiceAccount OrganizationProjectServiceAccount = "organization.project.service_account"` + The name of the user. - - `Role ProjectServiceAccountRole` + - `Role string` - `owner` or `member` + The user's project role. - - `const ProjectServiceAccountRoleOwner ProjectServiceAccountRole = "owner"` + - `RedactedValue string` - - `const ProjectServiceAccountRoleMember ProjectServiceAccountRole = "member"` + The redacted value of the API key ### Example @@ -11596,15 +13627,15 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - projectServiceAccount, err := client.Admin.Organization.Projects.ServiceAccounts.Get( + projectAPIKey, err := client.Admin.Organization.Projects.APIKeys.Get( context.TODO(), "project_id", - "service_account_id", + "api_key_id", ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", projectServiceAccount.ID) + fmt.Printf("%+v\n", projectAPIKey.ID) } ``` @@ -11614,40 +13645,57 @@ func main() { { "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 -`client.Admin.Organization.Projects.ServiceAccounts.Delete(ctx, projectID, serviceAccountID) (*AdminOrganizationProjectServiceAccountDeleteResponse, error)` +`client.Admin.Organization.Projects.APIKeys.Delete(ctx, projectID, apiKeyID) (*AdminOrganizationProjectAPIKeyDeleteResponse, error)` -**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 - `projectID string` -- `serviceAccountID string` +- `apiKeyID string` ### Returns -- `type AdminOrganizationProjectServiceAccountDeleteResponse struct{…}` +- `type AdminOrganizationProjectAPIKeyDeleteResponse struct{…}` - `ID string` - `Deleted bool` - - `Object OrganizationProjectServiceAccountDeleted` + - `Object OrganizationProjectAPIKeyDeleted` - - `const OrganizationProjectServiceAccountDeletedOrganizationProjectServiceAccountDeleted OrganizationProjectServiceAccountDeleted = "organization.project.service_account.deleted"` + - `const OrganizationProjectAPIKeyDeletedOrganizationProjectAPIKeyDeleted OrganizationProjectAPIKeyDeleted = "organization.project.api_key.deleted"` ### Example @@ -11666,15 +13714,15 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - serviceAccount, err := client.Admin.Organization.Projects.ServiceAccounts.Delete( + apiKey, err := client.Admin.Organization.Projects.APIKeys.Delete( context.TODO(), "project_id", - "service_account_id", + "api_key_id", ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", serviceAccount.ID) + fmt.Printf("%+v\n", apiKey.ID) } ``` @@ -11684,17 +13732,17 @@ func main() { { "id": "id", "deleted": true, - "object": "organization.project.service_account.deleted" + "object": "organization.project.api_key.deleted" } ``` ## Domain Types -### Project Service Account +### Project API Key -- `type ProjectServiceAccount struct{…}` +- `type ProjectAPIKey struct{…}` - Represents an individual service account in a project. + Represents an individual API key in a project. - `ID string` @@ -11702,135 +13750,290 @@ func main() { - `CreatedAt int64` - The Unix timestamp (in seconds) of when the service account was created + The Unix timestamp (in seconds) of when the API key was created + + - `LastUsedAt int64` + + The Unix timestamp (in seconds) of when the API key was last used. - `Name string` - The name of the service account + The name of the API key - - `Object OrganizationProjectServiceAccount` + - `Object OrganizationProjectAPIKey` - The object type, which is always `organization.project.service_account` + The object type, which is always `organization.project.api_key` - - `const OrganizationProjectServiceAccountOrganizationProjectServiceAccount OrganizationProjectServiceAccount = "organization.project.service_account"` + - `const OrganizationProjectAPIKeyOrganizationProjectAPIKey OrganizationProjectAPIKey = "organization.project.api_key"` - - `Role ProjectServiceAccountRole` + - `Owner ProjectAPIKeyOwner` - `owner` or `member` + - `ServiceAccount ProjectAPIKeyOwnerServiceAccount` - - `const ProjectServiceAccountRoleOwner ProjectServiceAccountRole = "owner"` + The service account that owns a project API key. - - `const ProjectServiceAccountRoleMember ProjectServiceAccountRole = "member"` + - `ID string` -# API Keys + The identifier, which can be referenced in API endpoints -## List project API keys + - `CreatedAt int64` -`client.Admin.Organization.Projects.APIKeys.List(ctx, projectID, query) (*ConversationCursorPage[ProjectAPIKey], error)` + The Unix timestamp (in seconds) of when the service account was created. -**get** `/organization/projects/{project_id}/api_keys` + - `Name string` -Returns a list of API keys in the project. + The name of the service account. + + - `Role string` + + The service account's project role. + + - `Type string` + + `user` or `service_account` + + - `const ProjectAPIKeyOwnerTypeUser ProjectAPIKeyOwnerType = "user"` + + - `const ProjectAPIKeyOwnerTypeServiceAccount ProjectAPIKeyOwnerType = "service_account"` + + - `User ProjectAPIKeyOwnerUser` + + The user that owns a project API key. + + - `ID string` + + The identifier, which can be referenced in API endpoints + + - `CreatedAt int64` + + The Unix timestamp (in seconds) of when the user was created. + + - `Email string` + + The email address of the user. + + - `Name string` + + The name of the user. + + - `Role string` + + The user's project role. + + - `RedactedValue string` + + The redacted value of the API key + +# Rate Limits + +## List project rate limits + +`client.Admin.Organization.Projects.RateLimits.ListRateLimits(ctx, projectID, query) (*ConversationCursorPage[ProjectRateLimit], error)` + +**get** `/organization/projects/{project_id}/rate_limits` + +Returns the rate limits per model for a project. ### Parameters - `projectID string` -- `query AdminOrganizationProjectAPIKeyListParams` +- `query AdminOrganizationProjectRateLimitListRateLimitsParams` - `After param.Field[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 param.Field[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 param.Field[int64]` - 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 -- `type ProjectAPIKey struct{…}` +- `type ProjectRateLimit struct{…}` - 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 + The identifier, which can be referenced in API endpoints. - - `CreatedAt int64` + - `MaxRequestsPer1Minute int64` - The Unix timestamp (in seconds) of when the API key was created + The maximum requests per minute. - - `LastUsedAt int64` + - `MaxTokensPer1Minute int64` - The Unix timestamp (in seconds) of when the API key was last used. + The maximum tokens per minute. - - `Name string` + - `Model string` - The name of the API key + The model this rate limit applies to. - - `Object OrganizationProjectAPIKey` + - `Object ProjectRateLimit` - The object type, which is always `organization.project.api_key` + The object type, which is always `project.rate_limit` - - `const OrganizationProjectAPIKeyOrganizationProjectAPIKey OrganizationProjectAPIKey = "organization.project.api_key"` + - `const ProjectRateLimitProjectRateLimit ProjectRateLimit = "project.rate_limit"` - - `Owner ProjectAPIKeyOwner` + - `Batch1DayMaxInputTokens int64` - - `ServiceAccount ProjectAPIKeyOwnerServiceAccount` + The maximum batch input tokens per day. Only present for relevant models. - The service account that owns a project API key. + - `MaxAudioMegabytesPer1Minute int64` - - `ID string` + The maximum audio megabytes per minute. Only present for relevant models. - The identifier, which can be referenced in API endpoints + - `MaxImagesPer1Minute int64` + + The maximum images per minute. Only present for relevant models. + + - `MaxRequestsPer1Day int64` + + The maximum requests per day. Only present for relevant models. + +### Example + +```go +package main + +import ( + "context" + "fmt" + + "github.com/openai/openai-go" + "github.com/openai/openai-go/option" +) + +func main() { + client := openai.NewClient( + option.WithAdminAPIKey("My Admin API Key"), + ) + page, err := client.Admin.Organization.Projects.RateLimits.ListRateLimits( + context.TODO(), + "project_id", + openai.AdminOrganizationProjectRateLimitListRateLimitsParams{ + + }, + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", 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" +} +``` + +## Modify project rate limit + +`client.Admin.Organization.Projects.RateLimits.UpdateRateLimit(ctx, projectID, rateLimitID, body) (*ProjectRateLimit, error)` + +**post** `/organization/projects/{project_id}/rate_limits/{rate_limit_id}` + +Updates a project rate limit. + +### Parameters + +- `projectID string` + +- `rateLimitID string` + +- `body AdminOrganizationProjectRateLimitUpdateRateLimitParams` + + - `Batch1DayMaxInputTokens param.Field[int64]` + + The maximum batch input tokens per day. Only relevant for certain models. + + - `MaxAudioMegabytesPer1Minute param.Field[int64]` + + The maximum audio megabytes per minute. Only relevant for certain models. + + - `MaxImagesPer1Minute param.Field[int64]` + + The maximum images per minute. Only relevant for certain models. + + - `MaxRequestsPer1Day param.Field[int64]` + + The maximum requests per day. Only relevant for certain models. + + - `MaxRequestsPer1Minute param.Field[int64]` + + The maximum requests per minute. - - `CreatedAt int64` + - `MaxTokensPer1Minute param.Field[int64]` - 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. +- `type ProjectRateLimit struct{…}` - - `Role string` + Represents a project rate limit config. - The service account's project role. + - `ID string` - - `Type string` + The identifier, which can be referenced in API endpoints. - `user` or `service_account` + - `MaxRequestsPer1Minute int64` - - `const ProjectAPIKeyOwnerTypeUser ProjectAPIKeyOwnerType = "user"` + The maximum requests per minute. - - `const ProjectAPIKeyOwnerTypeServiceAccount ProjectAPIKeyOwnerType = "service_account"` + - `MaxTokensPer1Minute int64` - - `User ProjectAPIKeyOwnerUser` + 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 ProjectRateLimit` - - `CreatedAt int64` + The object type, which is always `project.rate_limit` - The Unix timestamp (in seconds) of when the user was created. + - `const ProjectRateLimitProjectRateLimit ProjectRateLimit = "project.rate_limit"` - - `Email string` + - `Batch1DayMaxInputTokens int64` - The email address of the user. + The maximum batch input tokens per day. Only present for relevant models. - - `Name string` + - `MaxAudioMegabytesPer1Minute int64` - The name of the user. + The maximum audio megabytes per minute. Only present for relevant models. - - `Role string` + - `MaxImagesPer1Minute int64` - The user's project role. + The maximum images per minute. Only present for relevant models. - - `RedactedValue string` + - `MaxRequestsPer1Day int64` - The redacted value of the API key + The maximum requests per day. Only present for relevant models. ### Example @@ -11849,17 +14052,18 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - page, err := client.Admin.Organization.Projects.APIKeys.List( + projectRateLimit, err := client.Admin.Organization.Projects.RateLimits.UpdateRateLimit( context.TODO(), "project_id", - openai.AdminOrganizationProjectAPIKeyListParams{ + "rate_limit_id", + openai.AdminOrganizationProjectRateLimitUpdateRateLimitParams{ }, ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", page) + fmt.Printf("%+v\n", projectRateLimit.ID) } ``` @@ -11867,138 +14071,188 @@ func main() { ```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 +## Domain Types -`client.Admin.Organization.Projects.APIKeys.Get(ctx, projectID, apiKeyID) (*ProjectAPIKey, error)` +### Project Rate Limit -**get** `/organization/projects/{project_id}/api_keys/{api_key_id}` +- `type ProjectRateLimit struct{…}` -Retrieves an API key in the project. + Represents a project rate limit config. + + - `ID string` + + The identifier, which can be referenced in API endpoints. + + - `MaxRequestsPer1Minute int64` + + The maximum requests per minute. + + - `MaxTokensPer1Minute int64` + + The maximum tokens per minute. + + - `Model string` + + The model this rate limit applies to. + + - `Object ProjectRateLimit` + + The object type, which is always `project.rate_limit` + + - `const ProjectRateLimitProjectRateLimit ProjectRateLimit = "project.rate_limit"` + + - `Batch1DayMaxInputTokens int64` + + The maximum batch input tokens per day. Only present for relevant models. + + - `MaxAudioMegabytesPer1Minute int64` + + The maximum audio megabytes per minute. Only present for relevant models. + + - `MaxImagesPer1Minute int64` + + The maximum images per minute. Only present for relevant models. + + - `MaxRequestsPer1Day int64` + + The maximum requests per day. Only present for relevant models. + +# Model Permissions + +## Retrieve project model permissions + +`client.Admin.Organization.Projects.ModelPermissions.Get(ctx, projectID) (*ProjectModelPermissions, error)` + +**get** `/organization/projects/{project_id}/model_permissions` + +Returns model permissions for a project. ### Parameters - `projectID string` -- `apiKeyID string` - ### Returns -- `type ProjectAPIKey struct{…}` +- `type ProjectModelPermissions struct{…}` - Represents an individual API key in a project. + Represents the model allowlist or denylist policy for a project. - - `ID string` + - `Mode ProjectModelPermissionsMode` - The identifier, which can be referenced in API endpoints + Whether the project uses an allowlist or a denylist. - - `CreatedAt int64` + - `const ProjectModelPermissionsModeAllowList ProjectModelPermissionsMode = "allow_list"` - The Unix timestamp (in seconds) of when the API key was created + - `const ProjectModelPermissionsModeDenyList ProjectModelPermissionsMode = "deny_list"` - - `LastUsedAt int64` + - `ModelIDs []string` - The Unix timestamp (in seconds) of when the API key was last used. + The model IDs included in the model permissions policy. - - `Name string` + - `Object ProjectModelPermissions` - The name of the API key + The object type, which is always `project.model_permissions`. - - `Object OrganizationProjectAPIKey` + - `const ProjectModelPermissionsProjectModelPermissions ProjectModelPermissions = "project.model_permissions"` - The object type, which is always `organization.project.api_key` +### Example - - `const OrganizationProjectAPIKeyOrganizationProjectAPIKey OrganizationProjectAPIKey = "organization.project.api_key"` +```go +package main - - `Owner ProjectAPIKeyOwner` +import ( + "context" + "fmt" - - `ServiceAccount ProjectAPIKeyOwnerServiceAccount` + "github.com/openai/openai-go" + "github.com/openai/openai-go/option" +) - The service account that owns a project API key. +func main() { + client := openai.NewClient( + option.WithAdminAPIKey("My Admin API Key"), + ) + projectModelPermissions, err := client.Admin.Organization.Projects.ModelPermissions.Get(context.TODO(), "project_id") + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", projectModelPermissions.ModelIDs) +} +``` - - `ID string` +#### Response - The identifier, which can be referenced in API endpoints +```json +{ + "mode": "allow_list", + "model_ids": [ + "string" + ], + "object": "project.model_permissions" +} +``` - - `CreatedAt int64` +## Modify project model permissions - The Unix timestamp (in seconds) of when the service account was created. +`client.Admin.Organization.Projects.ModelPermissions.Update(ctx, projectID, body) (*ProjectModelPermissions, error)` - - `Name string` +**post** `/organization/projects/{project_id}/model_permissions` - The name of the service account. +Updates model permissions for a project. - - `Role string` +### Parameters - The service account's project role. +- `projectID string` - - `Type string` +- `body AdminOrganizationProjectModelPermissionUpdateParams` - `user` or `service_account` + - `Mode param.Field[AdminOrganizationProjectModelPermissionUpdateParamsMode]` - - `const ProjectAPIKeyOwnerTypeUser ProjectAPIKeyOwnerType = "user"` + The model permissions mode to apply. - - `const ProjectAPIKeyOwnerTypeServiceAccount ProjectAPIKeyOwnerType = "service_account"` + - `const AdminOrganizationProjectModelPermissionUpdateParamsModeAllowList AdminOrganizationProjectModelPermissionUpdateParamsMode = "allow_list"` - - `User ProjectAPIKeyOwnerUser` + - `const AdminOrganizationProjectModelPermissionUpdateParamsModeDenyList AdminOrganizationProjectModelPermissionUpdateParamsMode = "deny_list"` - The user that owns a project API key. + - `ModelIDs param.Field[[]string]` - - `ID string` + The model IDs included in this permissions policy. - The identifier, which can be referenced in API endpoints +### Returns - - `CreatedAt int64` +- `type ProjectModelPermissions struct{…}` - The Unix timestamp (in seconds) of when the user was created. + Represents the model allowlist or denylist policy for a project. - - `Email string` + - `Mode ProjectModelPermissionsMode` - The email address of the user. + Whether the project uses an allowlist or a denylist. - - `Name string` + - `const ProjectModelPermissionsModeAllowList ProjectModelPermissionsMode = "allow_list"` - The name of the user. + - `const ProjectModelPermissionsModeDenyList ProjectModelPermissionsMode = "deny_list"` - - `Role string` + - `ModelIDs []string` - The user's project role. + The model IDs included in the model permissions policy. - - `RedactedValue string` + - `Object ProjectModelPermissions` - The redacted value of the API key + The object type, which is always `project.model_permissions`. + + - `const ProjectModelPermissionsProjectModelPermissions ProjectModelPermissions = "project.model_permissions"` ### Example @@ -12017,15 +14271,18 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - projectAPIKey, err := client.Admin.Organization.Projects.APIKeys.Get( + projectModelPermissions, err := client.Admin.Organization.Projects.ModelPermissions.Update( context.TODO(), "project_id", - "api_key_id", + openai.AdminOrganizationProjectModelPermissionUpdateParams{ + Mode: openai.AdminOrganizationProjectModelPermissionUpdateParamsModeAllowList, + ModelIDs: []string{"string"}, + }, ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", projectAPIKey.ID) + fmt.Printf("%+v\n", projectModelPermissions.ModelIDs) } ``` @@ -12033,59 +14290,41 @@ func main() { ```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 - -`client.Admin.Organization.Projects.APIKeys.Delete(ctx, projectID, apiKeyID) (*AdminOrganizationProjectAPIKeyDeleteResponse, error)` +## Delete project model permissions -**delete** `/organization/projects/{project_id}/api_keys/{api_key_id}` +`client.Admin.Organization.Projects.ModelPermissions.Delete(ctx, projectID) (*ProjectModelPermissionsDeleted, error)` -Deletes an API key from the project. +**delete** `/organization/projects/{project_id}/model_permissions` -Returns confirmation of the key deletion, or an error if the key belonged to -a service account. +Deletes model permissions for a project. ### Parameters - `projectID string` -- `apiKeyID string` - ### Returns -- `type AdminOrganizationProjectAPIKeyDeleteResponse struct{…}` +- `type ProjectModelPermissionsDeleted struct{…}` - - `ID string` + Confirmation payload returned after deleting project model permissions. - `Deleted bool` - - `Object OrganizationProjectAPIKeyDeleted` + Whether the project model permissions were deleted. - - `const OrganizationProjectAPIKeyDeletedOrganizationProjectAPIKeyDeleted OrganizationProjectAPIKeyDeleted = "organization.project.api_key.deleted"` + - `Object ProjectModelPermissionsDeleted` + + The object type, which is always `project.model_permissions.deleted`. + + - `const ProjectModelPermissionsDeletedProjectModelPermissionsDeleted ProjectModelPermissionsDeleted = "project.model_permissions.deleted"` ### Example @@ -12104,15 +14343,11 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - apiKey, err := client.Admin.Organization.Projects.APIKeys.Delete( - context.TODO(), - "project_id", - "api_key_id", - ) + projectModelPermissionsDeleted, err := client.Admin.Organization.Projects.ModelPermissions.Delete(context.TODO(), "project_id") if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", apiKey.ID) + fmt.Printf("%+v\n", projectModelPermissionsDeleted.Deleted) } ``` @@ -12120,171 +14355,112 @@ func main() { ```json { - "id": "id", "deleted": true, - "object": "organization.project.api_key.deleted" + "object": "project.model_permissions.deleted" } ``` ## Domain Types -### Project API Key - -- `type ProjectAPIKey struct{…}` - - Represents an individual API key in a project. - - - `ID string` - - The identifier, which can be referenced in API endpoints - - - `CreatedAt int64` - - The Unix timestamp (in seconds) of when the API key was created - - - `LastUsedAt int64` - - The Unix timestamp (in seconds) of when the API key was last used. - - - `Name string` - - The name of the API key - - - `Object OrganizationProjectAPIKey` - - The object type, which is always `organization.project.api_key` - - - `const OrganizationProjectAPIKeyOrganizationProjectAPIKey OrganizationProjectAPIKey = "organization.project.api_key"` - - - `Owner ProjectAPIKeyOwner` - - - `ServiceAccount ProjectAPIKeyOwnerServiceAccount` - - The service account that owns a project API key. - - - `ID string` - - The identifier, which can be referenced in API endpoints - - - `CreatedAt int64` - - The Unix timestamp (in seconds) of when the service account was created. - - - `Name string` - - The name of the service account. - - - `Role string` +### Project Model Permissions - The service account's project role. +- `type ProjectModelPermissions struct{…}` - - `Type string` + Represents the model allowlist or denylist policy for a project. - `user` or `service_account` + - `Mode ProjectModelPermissionsMode` - - `const ProjectAPIKeyOwnerTypeUser ProjectAPIKeyOwnerType = "user"` + Whether the project uses an allowlist or a denylist. - - `const ProjectAPIKeyOwnerTypeServiceAccount ProjectAPIKeyOwnerType = "service_account"` + - `const ProjectModelPermissionsModeAllowList ProjectModelPermissionsMode = "allow_list"` - - `User ProjectAPIKeyOwnerUser` + - `const ProjectModelPermissionsModeDenyList ProjectModelPermissionsMode = "deny_list"` - The user that owns a project API key. + - `ModelIDs []string` - - `ID string` + The model IDs included in the model permissions policy. - The identifier, which can be referenced in API endpoints + - `Object ProjectModelPermissions` - - `CreatedAt int64` + The object type, which is always `project.model_permissions`. - The Unix timestamp (in seconds) of when the user was created. + - `const ProjectModelPermissionsProjectModelPermissions ProjectModelPermissions = "project.model_permissions"` - - `Email string` +### Project Model Permissions Deleted - The email address of the user. +- `type ProjectModelPermissionsDeleted struct{…}` - - `Name string` + Confirmation payload returned after deleting project model permissions. - The name of the user. + - `Deleted bool` - - `Role string` + Whether the project model permissions were deleted. - The user's project role. + - `Object ProjectModelPermissionsDeleted` - - `RedactedValue string` + The object type, which is always `project.model_permissions.deleted`. - The redacted value of the API key + - `const ProjectModelPermissionsDeletedProjectModelPermissionsDeleted ProjectModelPermissionsDeleted = "project.model_permissions.deleted"` -# Rate Limits +# Hosted Tool Permissions -## List project rate limits +## Retrieve project hosted tool permissions -`client.Admin.Organization.Projects.RateLimits.ListRateLimits(ctx, projectID, query) (*ConversationCursorPage[ProjectRateLimit], error)` +`client.Admin.Organization.Projects.HostedToolPermissions.Get(ctx, projectID) (*ProjectHostedToolPermissions, error)` -**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 - `projectID string` -- `query AdminOrganizationProjectRateLimitListRateLimitsParams` - - - `After param.Field[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 param.Field[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 param.Field[int64]` - - A limit on the number of objects to be returned. The default is 100. - ### Returns -- `type ProjectRateLimit struct{…}` +- `type ProjectHostedToolPermissions struct{…}` - Represents a project rate limit config. + Represents hosted tool permissions for a project. - - `ID string` + - `CodeInterpreter ProjectHostedToolPermissionsCodeInterpreter` - The identifier, which can be referenced in API endpoints. + Permission state for a single hosted tool on a project. - - `MaxRequestsPer1Minute int64` + - `Enabled bool` - The maximum requests per minute. + Whether the hosted tool is enabled for the project. - - `MaxTokensPer1Minute int64` + - `FileSearch ProjectHostedToolPermissionsFileSearch` - 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 ProjectRateLimit` + - `ImageGeneration ProjectHostedToolPermissionsImageGeneration` - The object type, which is always `project.rate_limit` + Permission state for a single hosted tool on a project. - - `const ProjectRateLimitProjectRateLimit ProjectRateLimit = "project.rate_limit"` + - `Enabled bool` - - `Batch1DayMaxInputTokens int64` + Whether the hosted tool is enabled for the project. - The maximum batch input tokens per day. Only present for relevant models. + - `Mcp ProjectHostedToolPermissionsMcp` - - `MaxAudioMegabytesPer1Minute int64` + Permission state for a single hosted tool on a project. - The maximum audio megabytes per minute. Only present for relevant models. + - `Enabled bool` - - `MaxImagesPer1Minute int64` + Whether the hosted tool is enabled for the project. - The maximum images per minute. Only present for relevant models. + - `WebSearch ProjectHostedToolPermissionsWebSearch` - - `MaxRequestsPer1Day int64` + 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 @@ -12303,17 +14479,11 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - page, err := client.Admin.Organization.Projects.RateLimits.ListRateLimits( - context.TODO(), - "project_id", - openai.AdminOrganizationProjectRateLimitListRateLimitsParams{ - - }, - ) + projectHostedToolPermissions, err := client.Admin.Organization.Projects.HostedToolPermissions.Get(context.TODO(), "project_id") if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", page) + fmt.Printf("%+v\n", projectHostedToolPermissions.CodeInterpreter) } ``` @@ -12321,109 +14491,123 @@ func main() { ```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 -`client.Admin.Organization.Projects.RateLimits.UpdateRateLimit(ctx, projectID, rateLimitID, body) (*ProjectRateLimit, error)` +`client.Admin.Organization.Projects.HostedToolPermissions.Update(ctx, projectID, body) (*ProjectHostedToolPermissions, error)` -**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 - `projectID string` -- `rateLimitID string` +- `body AdminOrganizationProjectHostedToolPermissionUpdateParams` -- `body AdminOrganizationProjectRateLimitUpdateRateLimitParams` + - `CodeInterpreter param.Field[AdminOrganizationProjectHostedToolPermissionUpdateParamsCodeInterpreter]` - - `Batch1DayMaxInputTokens param.Field[int64]` + The code interpreter permission update. - The maximum batch input tokens per day. Only relevant for certain models. + - `Enabled bool` - - `MaxAudioMegabytesPer1Minute param.Field[int64]` + Whether to enable the hosted tool for the project. - The maximum audio megabytes per minute. Only relevant for certain models. + - `FileSearch param.Field[AdminOrganizationProjectHostedToolPermissionUpdateParamsFileSearch]` - - `MaxImagesPer1Minute param.Field[int64]` + The file search permission update. - The maximum images per minute. Only relevant for certain models. + - `Enabled bool` - - `MaxRequestsPer1Day param.Field[int64]` + Whether to enable the hosted tool for the project. - The maximum requests per day. Only relevant for certain models. + - `ImageGeneration param.Field[AdminOrganizationProjectHostedToolPermissionUpdateParamsImageGeneration]` - - `MaxRequestsPer1Minute param.Field[int64]` + The image generation permission update. - The maximum requests per minute. + - `Enabled bool` - - `MaxTokensPer1Minute param.Field[int64]` + Whether to enable the hosted tool for the project. - The maximum tokens per minute. + - `Mcp param.Field[AdminOrganizationProjectHostedToolPermissionUpdateParamsMcp]` + + The MCP permission update. + + - `Enabled bool` + + Whether to enable the hosted tool for the project. + + - `WebSearch param.Field[AdminOrganizationProjectHostedToolPermissionUpdateParamsWebSearch]` + + The web search permission update. + + - `Enabled bool` + + Whether to enable the hosted tool for the project. ### Returns -- `type ProjectRateLimit struct{…}` +- `type ProjectHostedToolPermissions struct{…}` - Represents a project rate limit config. + Represents hosted tool permissions for a project. - - `ID string` + - `CodeInterpreter ProjectHostedToolPermissionsCodeInterpreter` - The identifier, which can be referenced in API endpoints. + Permission state for a single hosted tool on a project. - - `MaxRequestsPer1Minute int64` + - `Enabled bool` - The maximum requests per minute. + Whether the hosted tool is enabled for the project. - - `MaxTokensPer1Minute int64` + - `FileSearch ProjectHostedToolPermissionsFileSearch` - 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 ProjectRateLimit` + - `ImageGeneration ProjectHostedToolPermissionsImageGeneration` - The object type, which is always `project.rate_limit` + Permission state for a single hosted tool on a project. - - `const ProjectRateLimitProjectRateLimit ProjectRateLimit = "project.rate_limit"` + - `Enabled bool` - - `Batch1DayMaxInputTokens int64` + Whether the hosted tool is enabled for the project. - The maximum batch input tokens per day. Only present for relevant models. + - `Mcp ProjectHostedToolPermissionsMcp` - - `MaxAudioMegabytesPer1Minute int64` + Permission state for a single hosted tool on a project. - The maximum audio megabytes per minute. Only present for relevant models. + - `Enabled bool` - - `MaxImagesPer1Minute int64` + Whether the hosted tool is enabled for the project. - The maximum images per minute. Only present for relevant models. + - `WebSearch ProjectHostedToolPermissionsWebSearch` - - `MaxRequestsPer1Day int64` + 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 @@ -12442,18 +14626,17 @@ func main() { client := openai.NewClient( option.WithAdminAPIKey("My Admin API Key"), ) - projectRateLimit, err := client.Admin.Organization.Projects.RateLimits.UpdateRateLimit( + projectHostedToolPermissions, err := client.Admin.Organization.Projects.HostedToolPermissions.Update( context.TODO(), "project_id", - "rate_limit_id", - openai.AdminOrganizationProjectRateLimitUpdateRateLimitParams{ + openai.AdminOrganizationProjectHostedToolPermissionUpdateParams{ }, ) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", projectRateLimit.ID) + fmt.Printf("%+v\n", projectHostedToolPermissions.CodeInterpreter) } ``` @@ -12461,63 +14644,71 @@ func main() { ```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 -- `type ProjectRateLimit struct{…}` +- `type ProjectHostedToolPermissions struct{…}` - Represents a project rate limit config. + Represents hosted tool permissions for a project. - - `ID string` + - `CodeInterpreter ProjectHostedToolPermissionsCodeInterpreter` - The identifier, which can be referenced in API endpoints. + Permission state for a single hosted tool on a project. - - `MaxRequestsPer1Minute int64` + - `Enabled bool` - The maximum requests per minute. + Whether the hosted tool is enabled for the project. - - `MaxTokensPer1Minute int64` + - `FileSearch ProjectHostedToolPermissionsFileSearch` - 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 ProjectRateLimit` + - `ImageGeneration ProjectHostedToolPermissionsImageGeneration` - The object type, which is always `project.rate_limit` + Permission state for a single hosted tool on a project. - - `const ProjectRateLimitProjectRateLimit ProjectRateLimit = "project.rate_limit"` + - `Enabled bool` - - `Batch1DayMaxInputTokens int64` + Whether the hosted tool is enabled for the project. - The maximum batch input tokens per day. Only present for relevant models. + - `Mcp ProjectHostedToolPermissionsMcp` - - `MaxAudioMegabytesPer1Minute int64` + Permission state for a single hosted tool on a project. - The maximum audio megabytes per minute. Only present for relevant models. + - `Enabled bool` - - `MaxImagesPer1Minute int64` + Whether the hosted tool is enabled for the project. - The maximum images per minute. Only present for relevant models. + - `WebSearch ProjectHostedToolPermissionsWebSearch` - - `MaxRequestsPer1Day int64` + 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