openapi: 3.0.0 info: title: OpenAI Assistants Usage API description: The Assistants API allows you to build AI assistants within your own applications. An Assistant has instructions and can leverage models, tools, and knowledge to respond to user queries. The Assistants API currently supports three types of tools - Code Interpreter, Retrieval, and Function calling. In the future, we plan to release more OpenAI-built tools, and allow you to provide your own tools on our platform. version: 2.0.0 termsOfService: https://openai.com/policies/terms-of-use contact: name: OpenAI Support url: https://help.openai.com/ license: name: MIT url: https://github.com/openai/openai-openapi/blob/master/LICENSE servers: - url: https://api.openai.com/v1 security: - ApiKeyAuth: [] tags: - name: Usage paths: /organization/costs: get: security: - AdminApiKeyAuth: [] summary: Get costs details for the organization. operationId: usage-costs tags: - Usage parameters: - name: start_time in: query description: Start time (Unix seconds) of the query time range, inclusive. required: true schema: type: integer - name: end_time in: query description: End time (Unix seconds) of the query time range, exclusive. required: false schema: type: integer - name: bucket_width in: query description: Width of each time bucket in response. Currently only `1d` is supported, default to `1d`. required: false schema: type: string enum: - 1d default: 1d - name: project_ids in: query description: Return only costs for these projects. required: false schema: type: array items: type: string - name: api_key_ids in: query description: Return only costs for these API keys. required: false schema: type: array items: type: string - name: group_by in: query description: Group the costs by the specified fields. Support fields include `project_id`, `line_item`, `api_key_id` and any combination of them. required: false schema: type: array items: type: string enum: - project_id - line_item - api_key_id - name: limit in: query description: 'A limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7. ' required: false schema: type: integer default: 7 - name: page in: query description: A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. schema: type: string responses: '200': description: Costs data retrieved successfully. content: application/json: schema: $ref: '#/components/schemas/UsageResponse' x-oaiMeta: name: Costs group: usage-costs examples: request: curl: 'curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1" \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ' node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.admin.organization.usage.costs({ start_time: 0 });\n\nconsole.log(response.data);" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n admin_api_key=os.environ.get(\"OPENAI_ADMIN_KEY\"), # This is the default and can be omitted\n)\nresponse = client.admin.organization.usage.costs(\n start_time=0,\n)\nprint(response.data)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.Costs(context.TODO(), openai.AdminOrganizationUsageCostsParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.admin.organization.usage.UsageCostsParams;\nimport com.openai.models.admin.organization.usage.UsageCostsResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n UsageCostsParams params = UsageCostsParams.builder()\n .startTime(0L)\n .build();\n UsageCostsResponse response = client.admin().organization().usage().costs(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") response = openai.admin.organization.usage.costs(start_time: 0) puts(response)' response: "{\n \"object\": \"page\",\n \"data\": [\n {\n \"object\": \"bucket\",\n \"start_time\": 1730419200,\n \"end_time\": 1730505600,\n \"results\": [\n {\n \"object\": \"organization.costs.result\",\n \"amount\": {\n \"value\": 0.06,\n \"currency\": \"usd\"\n },\n \"line_item\": null,\n \"project_id\": null,\n \"api_key_id\": null,\n \"quantity\": null\n }\n ]\n }\n ],\n \"has_more\": false,\n \"next_page\": null\n}\n" /organization/usage/audio_speeches: get: security: - AdminApiKeyAuth: [] summary: Get audio speeches usage details for the organization. operationId: usage-audio-speeches tags: - Usage parameters: - name: start_time in: query description: Start time (Unix seconds) of the query time range, inclusive. required: true schema: type: integer - name: end_time in: query description: End time (Unix seconds) of the query time range, exclusive. required: false schema: type: integer - name: bucket_width in: query description: Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. required: false schema: type: string enum: - 1m - 1h - 1d default: 1d - name: project_ids in: query description: Return only usage for these projects. required: false schema: type: array items: type: string - name: user_ids in: query description: Return only usage for these users. required: false schema: type: array items: type: string - name: api_key_ids in: query description: Return only usage for these API keys. required: false schema: type: array items: type: string - name: models in: query description: Return only usage for these models. required: false schema: type: array items: type: string - name: group_by in: query description: Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model` or any combination of them. required: false schema: type: array items: type: string enum: - project_id - user_id - api_key_id - model - name: limit in: query description: '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 ' required: false schema: type: integer - name: page in: query description: A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. schema: type: string responses: '200': description: Usage data retrieved successfully. content: application/json: schema: $ref: '#/components/schemas/UsageResponse' x-oaiMeta: name: Audio speeches group: usage-audio-speeches examples: request: curl: 'curl "https://api.openai.com/v1/organization/usage/audio_speeches?start_time=1730419200&limit=1" \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ' node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.admin.organization.usage.audioSpeeches({ start_time: 0 });\n\nconsole.log(response.data);" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n admin_api_key=os.environ.get(\"OPENAI_ADMIN_KEY\"), # This is the default and can be omitted\n)\nresponse = client.admin.organization.usage.audio_speeches(\n start_time=0,\n)\nprint(response.data)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.AudioSpeeches(context.TODO(), openai.AdminOrganizationUsageAudioSpeechesParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.admin.organization.usage.UsageAudioSpeechesParams;\nimport com.openai.models.admin.organization.usage.UsageAudioSpeechesResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n UsageAudioSpeechesParams params = UsageAudioSpeechesParams.builder()\n .startTime(0L)\n .build();\n UsageAudioSpeechesResponse response = client.admin().organization().usage().audioSpeeches(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") response = openai.admin.organization.usage.audio_speeches(start_time: 0) puts(response)' response: "{\n \"object\": \"page\",\n \"data\": [\n {\n \"object\": \"bucket\",\n \"start_time\": 1730419200,\n \"end_time\": 1730505600,\n \"results\": [\n {\n \"object\": \"organization.usage.audio_speeches.result\",\n \"characters\": 45,\n \"num_model_requests\": 1,\n \"project_id\": null,\n \"user_id\": null,\n \"api_key_id\": null,\n \"model\": null\n }\n ]\n }\n ],\n \"has_more\": false,\n \"next_page\": null\n}\n" /organization/usage/audio_transcriptions: get: security: - AdminApiKeyAuth: [] summary: Get audio transcriptions usage details for the organization. operationId: usage-audio-transcriptions tags: - Usage parameters: - name: start_time in: query description: Start time (Unix seconds) of the query time range, inclusive. required: true schema: type: integer - name: end_time in: query description: End time (Unix seconds) of the query time range, exclusive. required: false schema: type: integer - name: bucket_width in: query description: Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. required: false schema: type: string enum: - 1m - 1h - 1d default: 1d - name: project_ids in: query description: Return only usage for these projects. required: false schema: type: array items: type: string - name: user_ids in: query description: Return only usage for these users. required: false schema: type: array items: type: string - name: api_key_ids in: query description: Return only usage for these API keys. required: false schema: type: array items: type: string - name: models in: query description: Return only usage for these models. required: false schema: type: array items: type: string - name: group_by in: query description: Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model` or any combination of them. required: false schema: type: array items: type: string enum: - project_id - user_id - api_key_id - model - name: limit in: query description: '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 ' required: false schema: type: integer - name: page in: query description: A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. schema: type: string responses: '200': description: Usage data retrieved successfully. content: application/json: schema: $ref: '#/components/schemas/UsageResponse' x-oaiMeta: name: Audio transcriptions group: usage-audio-transcriptions examples: request: curl: 'curl "https://api.openai.com/v1/organization/usage/audio_transcriptions?start_time=1730419200&limit=1" \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ' node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.admin.organization.usage.audioTranscriptions({ start_time: 0 });\n\nconsole.log(response.data);" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n admin_api_key=os.environ.get(\"OPENAI_ADMIN_KEY\"), # This is the default and can be omitted\n)\nresponse = client.admin.organization.usage.audio_transcriptions(\n start_time=0,\n)\nprint(response.data)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.AudioTranscriptions(context.TODO(), openai.AdminOrganizationUsageAudioTranscriptionsParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.admin.organization.usage.UsageAudioTranscriptionsParams;\nimport com.openai.models.admin.organization.usage.UsageAudioTranscriptionsResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n UsageAudioTranscriptionsParams params = UsageAudioTranscriptionsParams.builder()\n .startTime(0L)\n .build();\n UsageAudioTranscriptionsResponse response = client.admin().organization().usage().audioTranscriptions(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") response = openai.admin.organization.usage.audio_transcriptions(start_time: 0) puts(response)' response: "{\n \"object\": \"page\",\n \"data\": [\n {\n \"object\": \"bucket\",\n \"start_time\": 1730419200,\n \"end_time\": 1730505600,\n \"results\": [\n {\n \"object\": \"organization.usage.audio_transcriptions.result\",\n \"seconds\": 20,\n \"num_model_requests\": 1,\n \"project_id\": null,\n \"user_id\": null,\n \"api_key_id\": null,\n \"model\": null\n }\n ]\n }\n ],\n \"has_more\": false,\n \"next_page\": null\n}\n" /organization/usage/code_interpreter_sessions: get: security: - AdminApiKeyAuth: [] summary: Get code interpreter sessions usage details for the organization. operationId: usage-code-interpreter-sessions tags: - Usage parameters: - name: start_time in: query description: Start time (Unix seconds) of the query time range, inclusive. required: true schema: type: integer - name: end_time in: query description: End time (Unix seconds) of the query time range, exclusive. required: false schema: type: integer - name: bucket_width in: query description: Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. required: false schema: type: string enum: - 1m - 1h - 1d default: 1d - name: project_ids in: query description: Return only usage for these projects. required: false schema: type: array items: type: string - name: group_by in: query description: Group the usage data by the specified fields. Support fields include `project_id`. required: false schema: type: array items: type: string enum: - project_id - name: limit in: query description: '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 ' required: false schema: type: integer - name: page in: query description: A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. schema: type: string responses: '200': description: Usage data retrieved successfully. content: application/json: schema: $ref: '#/components/schemas/UsageResponse' x-oaiMeta: name: Code interpreter sessions group: usage-code-interpreter-sessions examples: request: curl: 'curl "https://api.openai.com/v1/organization/usage/code_interpreter_sessions?start_time=1730419200&limit=1" \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ' node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.admin.organization.usage.codeInterpreterSessions({ start_time: 0 });\n\nconsole.log(response.data);" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n admin_api_key=os.environ.get(\"OPENAI_ADMIN_KEY\"), # This is the default and can be omitted\n)\nresponse = client.admin.organization.usage.code_interpreter_sessions(\n start_time=0,\n)\nprint(response.data)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.CodeInterpreterSessions(context.TODO(), openai.AdminOrganizationUsageCodeInterpreterSessionsParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.admin.organization.usage.UsageCodeInterpreterSessionsParams;\nimport com.openai.models.admin.organization.usage.UsageCodeInterpreterSessionsResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n UsageCodeInterpreterSessionsParams params = UsageCodeInterpreterSessionsParams.builder()\n .startTime(0L)\n .build();\n UsageCodeInterpreterSessionsResponse response = client.admin().organization().usage().codeInterpreterSessions(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") response = openai.admin.organization.usage.code_interpreter_sessions(start_time: 0) puts(response)' response: "{\n \"object\": \"page\",\n \"data\": [\n {\n \"object\": \"bucket\",\n \"start_time\": 1730419200,\n \"end_time\": 1730505600,\n \"results\": [\n {\n \"object\": \"organization.usage.code_interpreter_sessions.result\",\n \"num_sessions\": 1,\n \"project_id\": null\n }\n ]\n }\n ],\n \"has_more\": false,\n \"next_page\": null\n}\n" /organization/usage/completions: get: security: - AdminApiKeyAuth: [] summary: Get completions usage details for the organization. operationId: usage-completions tags: - Usage parameters: - name: start_time in: query description: Start time (Unix seconds) of the query time range, inclusive. required: true schema: type: integer - name: end_time in: query description: End time (Unix seconds) of the query time range, exclusive. required: false schema: type: integer - name: bucket_width in: query description: Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. required: false schema: type: string enum: - 1m - 1h - 1d default: 1d - name: project_ids in: query description: Return only usage for these projects. required: false schema: type: array items: type: string - name: user_ids in: query description: Return only usage for these users. required: false schema: type: array items: type: string - name: api_key_ids in: query description: Return only usage for these API keys. required: false schema: type: array items: type: string - name: models in: query description: Return only usage for these models. required: false schema: type: array items: type: string - name: batch in: query description: 'If `true`, return batch jobs only. If `false`, return non-batch jobs only. By default, return both. ' required: false schema: type: boolean - name: group_by in: query description: Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier` or any combination of them. required: false schema: type: array items: type: string enum: - project_id - user_id - api_key_id - model - batch - service_tier - name: limit in: query description: '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 ' required: false schema: type: integer - name: page in: query description: A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. schema: type: string responses: '200': description: Usage data retrieved successfully. content: application/json: schema: $ref: '#/components/schemas/UsageResponse' x-oaiMeta: name: Completions group: usage-completions examples: request: curl: 'curl "https://api.openai.com/v1/organization/usage/completions?start_time=1730419200&limit=1" \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ' node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.admin.organization.usage.completions({ start_time: 0 });\n\nconsole.log(response.data);" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n admin_api_key=os.environ.get(\"OPENAI_ADMIN_KEY\"), # This is the default and can be omitted\n)\nresponse = client.admin.organization.usage.completions(\n start_time=0,\n)\nprint(response.data)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.Completions(context.TODO(), openai.AdminOrganizationUsageCompletionsParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.admin.organization.usage.UsageCompletionsParams;\nimport com.openai.models.admin.organization.usage.UsageCompletionsResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n UsageCompletionsParams params = UsageCompletionsParams.builder()\n .startTime(0L)\n .build();\n UsageCompletionsResponse response = client.admin().organization().usage().completions(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") response = openai.admin.organization.usage.completions(start_time: 0) puts(response)' response: "{\n \"object\": \"page\",\n \"data\": [\n {\n \"object\": \"bucket\",\n \"start_time\": 1730419200,\n \"end_time\": 1730505600,\n \"results\": [\n {\n \"object\": \"organization.usage.completions.result\",\n \"input_tokens\": 1000,\n \"output_tokens\": 500,\n \"input_cached_tokens\": 800,\n \"input_audio_tokens\": 0,\n \"output_audio_tokens\": 0,\n \"num_model_requests\": 5,\n \"project_id\": null,\n \"user_id\": null,\n \"api_key_id\": null,\n \"model\": null,\n \"batch\": null,\n \"service_tier\": null\n }\n ]\n }\n ],\n \"has_more\": true,\n \"next_page\": \"page_AAAAAGdGxdEiJdKOAAAAAGcqsYA=\"\n}\n" /organization/usage/embeddings: get: security: - AdminApiKeyAuth: [] summary: Get embeddings usage details for the organization. operationId: usage-embeddings tags: - Usage parameters: - name: start_time in: query description: Start time (Unix seconds) of the query time range, inclusive. required: true schema: type: integer - name: end_time in: query description: End time (Unix seconds) of the query time range, exclusive. required: false schema: type: integer - name: bucket_width in: query description: Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. required: false schema: type: string enum: - 1m - 1h - 1d default: 1d - name: project_ids in: query description: Return only usage for these projects. required: false schema: type: array items: type: string - name: user_ids in: query description: Return only usage for these users. required: false schema: type: array items: type: string - name: api_key_ids in: query description: Return only usage for these API keys. required: false schema: type: array items: type: string - name: models in: query description: Return only usage for these models. required: false schema: type: array items: type: string - name: group_by in: query description: Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model` or any combination of them. required: false schema: type: array items: type: string enum: - project_id - user_id - api_key_id - model - name: limit in: query description: '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 ' required: false schema: type: integer - name: page in: query description: A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. schema: type: string responses: '200': description: Usage data retrieved successfully. content: application/json: schema: $ref: '#/components/schemas/UsageResponse' x-oaiMeta: name: Embeddings group: usage-embeddings examples: request: curl: 'curl "https://api.openai.com/v1/organization/usage/embeddings?start_time=1730419200&limit=1" \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ' node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.admin.organization.usage.embeddings({ start_time: 0 });\n\nconsole.log(response.data);" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n admin_api_key=os.environ.get(\"OPENAI_ADMIN_KEY\"), # This is the default and can be omitted\n)\nresponse = client.admin.organization.usage.embeddings(\n start_time=0,\n)\nprint(response.data)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.Embeddings(context.TODO(), openai.AdminOrganizationUsageEmbeddingsParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.admin.organization.usage.UsageEmbeddingsParams;\nimport com.openai.models.admin.organization.usage.UsageEmbeddingsResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n UsageEmbeddingsParams params = UsageEmbeddingsParams.builder()\n .startTime(0L)\n .build();\n UsageEmbeddingsResponse response = client.admin().organization().usage().embeddings(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") response = openai.admin.organization.usage.embeddings(start_time: 0) puts(response)' response: "{\n \"object\": \"page\",\n \"data\": [\n {\n \"object\": \"bucket\",\n \"start_time\": 1730419200,\n \"end_time\": 1730505600,\n \"results\": [\n {\n \"object\": \"organization.usage.embeddings.result\",\n \"input_tokens\": 16,\n \"num_model_requests\": 2,\n \"project_id\": null,\n \"user_id\": null,\n \"api_key_id\": null,\n \"model\": null\n }\n ]\n }\n ],\n \"has_more\": false,\n \"next_page\": null\n}\n" /organization/usage/images: get: security: - AdminApiKeyAuth: [] summary: Get images usage details for the organization. operationId: usage-images tags: - Usage parameters: - name: start_time in: query description: Start time (Unix seconds) of the query time range, inclusive. required: true schema: type: integer - name: end_time in: query description: End time (Unix seconds) of the query time range, exclusive. required: false schema: type: integer - name: bucket_width in: query description: Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. required: false schema: type: string enum: - 1m - 1h - 1d default: 1d - name: sources in: query description: Return only usages for these sources. Possible values are `image.generation`, `image.edit`, `image.variation` or any combination of them. required: false schema: type: array items: type: string enum: - image.generation - image.edit - image.variation - name: sizes in: query description: Return only usages for these image sizes. Possible values are `256x256`, `512x512`, `1024x1024`, `1792x1792`, `1024x1792` or any combination of them. required: false schema: type: array items: type: string enum: - 256x256 - 512x512 - 1024x1024 - 1792x1792 - 1024x1792 - name: project_ids in: query description: Return only usage for these projects. required: false schema: type: array items: type: string - name: user_ids in: query description: Return only usage for these users. required: false schema: type: array items: type: string - name: api_key_ids in: query description: Return only usage for these API keys. required: false schema: type: array items: type: string - name: models in: query description: Return only usage for these models. required: false schema: type: array items: type: string - name: group_by in: query description: Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model`, `size`, `source` or any combination of them. required: false schema: type: array items: type: string enum: - project_id - user_id - api_key_id - model - size - source - name: limit in: query description: '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 ' required: false schema: type: integer - name: page in: query description: A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. schema: type: string responses: '200': description: Usage data retrieved successfully. content: application/json: schema: $ref: '#/components/schemas/UsageResponse' x-oaiMeta: name: Images group: usage-images examples: request: curl: 'curl "https://api.openai.com/v1/organization/usage/images?start_time=1730419200&limit=1" \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ' node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.admin.organization.usage.images({ start_time: 0 });\n\nconsole.log(response.data);" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n admin_api_key=os.environ.get(\"OPENAI_ADMIN_KEY\"), # This is the default and can be omitted\n)\nresponse = client.admin.organization.usage.images(\n start_time=0,\n)\nprint(response.data)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.Images(context.TODO(), openai.AdminOrganizationUsageImagesParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.admin.organization.usage.UsageImagesParams;\nimport com.openai.models.admin.organization.usage.UsageImagesResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n UsageImagesParams params = UsageImagesParams.builder()\n .startTime(0L)\n .build();\n UsageImagesResponse response = client.admin().organization().usage().images(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") response = openai.admin.organization.usage.images(start_time: 0) puts(response)' response: "{\n \"object\": \"page\",\n \"data\": [\n {\n \"object\": \"bucket\",\n \"start_time\": 1730419200,\n \"end_time\": 1730505600,\n \"results\": [\n {\n \"object\": \"organization.usage.images.result\",\n \"images\": 2,\n \"num_model_requests\": 2,\n \"size\": null,\n \"source\": null,\n \"project_id\": null,\n \"user_id\": null,\n \"api_key_id\": null,\n \"model\": null\n }\n ]\n }\n ],\n \"has_more\": false,\n \"next_page\": null\n}\n" /organization/usage/moderations: get: security: - AdminApiKeyAuth: [] summary: Get moderations usage details for the organization. operationId: usage-moderations tags: - Usage parameters: - name: start_time in: query description: Start time (Unix seconds) of the query time range, inclusive. required: true schema: type: integer - name: end_time in: query description: End time (Unix seconds) of the query time range, exclusive. required: false schema: type: integer - name: bucket_width in: query description: Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. required: false schema: type: string enum: - 1m - 1h - 1d default: 1d - name: project_ids in: query description: Return only usage for these projects. required: false schema: type: array items: type: string - name: user_ids in: query description: Return only usage for these users. required: false schema: type: array items: type: string - name: api_key_ids in: query description: Return only usage for these API keys. required: false schema: type: array items: type: string - name: models in: query description: Return only usage for these models. required: false schema: type: array items: type: string - name: group_by in: query description: Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model` or any combination of them. required: false schema: type: array items: type: string enum: - project_id - user_id - api_key_id - model - name: limit in: query description: '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 ' required: false schema: type: integer - name: page in: query description: A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. schema: type: string responses: '200': description: Usage data retrieved successfully. content: application/json: schema: $ref: '#/components/schemas/UsageResponse' x-oaiMeta: name: Moderations group: usage-moderations examples: request: curl: 'curl "https://api.openai.com/v1/organization/usage/moderations?start_time=1730419200&limit=1" \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ' node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.admin.organization.usage.moderations({ start_time: 0 });\n\nconsole.log(response.data);" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n admin_api_key=os.environ.get(\"OPENAI_ADMIN_KEY\"), # This is the default and can be omitted\n)\nresponse = client.admin.organization.usage.moderations(\n start_time=0,\n)\nprint(response.data)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.Moderations(context.TODO(), openai.AdminOrganizationUsageModerationsParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.admin.organization.usage.UsageModerationsParams;\nimport com.openai.models.admin.organization.usage.UsageModerationsResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n UsageModerationsParams params = UsageModerationsParams.builder()\n .startTime(0L)\n .build();\n UsageModerationsResponse response = client.admin().organization().usage().moderations(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") response = openai.admin.organization.usage.moderations(start_time: 0) puts(response)' response: "{\n \"object\": \"page\",\n \"data\": [\n {\n \"object\": \"bucket\",\n \"start_time\": 1730419200,\n \"end_time\": 1730505600,\n \"results\": [\n {\n \"object\": \"organization.usage.moderations.result\",\n \"input_tokens\": 16,\n \"num_model_requests\": 2,\n \"project_id\": null,\n \"user_id\": null,\n \"api_key_id\": null,\n \"model\": null\n }\n ]\n }\n ],\n \"has_more\": false,\n \"next_page\": null\n}\n" /organization/usage/vector_stores: get: security: - AdminApiKeyAuth: [] summary: Get vector stores usage details for the organization. operationId: usage-vector-stores tags: - Usage parameters: - name: start_time in: query description: Start time (Unix seconds) of the query time range, inclusive. required: true schema: type: integer - name: end_time in: query description: End time (Unix seconds) of the query time range, exclusive. required: false schema: type: integer - name: bucket_width in: query description: Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`. required: false schema: type: string enum: - 1m - 1h - 1d default: 1d - name: project_ids in: query description: Return only usage for these projects. required: false schema: type: array items: type: string - name: group_by in: query description: Group the usage data by the specified fields. Support fields include `project_id`. required: false schema: type: array items: type: string enum: - project_id - name: limit in: query description: '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 ' required: false schema: type: integer - name: page in: query description: A cursor for use in pagination. Corresponding to the `next_page` field from the previous response. schema: type: string responses: '200': description: Usage data retrieved successfully. content: application/json: schema: $ref: '#/components/schemas/UsageResponse' x-oaiMeta: name: Vector stores group: usage-vector-stores examples: request: curl: 'curl "https://api.openai.com/v1/organization/usage/vector_stores?start_time=1730419200&limit=1" \ -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" ' node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.admin.organization.usage.vectorStores({ start_time: 0 });\n\nconsole.log(response.data);" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n admin_api_key=os.environ.get(\"OPENAI_ADMIN_KEY\"), # This is the default and can be omitted\n)\nresponse = client.admin.organization.usage.vector_stores(\n start_time=0,\n)\nprint(response.data)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tresponse, err := client.Admin.Organization.Usage.VectorStores(context.TODO(), openai.AdminOrganizationUsageVectorStoresParams{\n\t\tStartTime: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.admin.organization.usage.UsageVectorStoresParams;\nimport com.openai.models.admin.organization.usage.UsageVectorStoresResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n UsageVectorStoresParams params = UsageVectorStoresParams.builder()\n .startTime(0L)\n .build();\n UsageVectorStoresResponse response = client.admin().organization().usage().vectorStores(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") response = openai.admin.organization.usage.vector_stores(start_time: 0) puts(response)' response: "{\n \"object\": \"page\",\n \"data\": [\n {\n \"object\": \"bucket\",\n \"start_time\": 1730419200,\n \"end_time\": 1730505600,\n \"results\": [\n {\n \"object\": \"organization.usage.vector_stores.result\",\n \"usage_bytes\": 1024,\n \"project_id\": null\n }\n ]\n }\n ],\n \"has_more\": false,\n \"next_page\": null\n}\n" components: schemas: UsageImagesResult: type: object description: The aggregated images usage details of the specific time bucket. properties: object: type: string enum: - organization.usage.images.result x-stainless-const: true images: type: integer description: The number of images processed. num_model_requests: type: integer description: The count of requests made to the model. source: anyOf: - type: string description: When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. - type: 'null' size: anyOf: - type: string description: When `group_by=size`, this field provides the image size of the grouped usage result. - type: 'null' project_id: anyOf: - type: string description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - type: 'null' user_id: anyOf: - type: string description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. - type: 'null' api_key_id: anyOf: - type: string description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - type: 'null' model: anyOf: - type: string description: When `group_by=model`, this field provides the model name of the grouped usage result. - type: 'null' required: - object - images - num_model_requests x-oaiMeta: name: Images usage object example: "{\n \"object\": \"organization.usage.images.result\",\n \"images\": 2,\n \"num_model_requests\": 2,\n \"size\": \"1024x1024\",\n \"source\": \"image.generation\",\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"dall-e-3\"\n}\n" UsageResponse: type: object properties: object: type: string enum: - page x-stainless-const: true data: type: array items: $ref: '#/components/schemas/UsageTimeBucket' has_more: type: boolean next_page: anyOf: - type: string - type: 'null' required: - object - data - has_more - next_page UsageAudioTranscriptionsResult: type: object description: The aggregated audio transcriptions usage details of the specific time bucket. properties: object: type: string enum: - organization.usage.audio_transcriptions.result x-stainless-const: true seconds: type: integer format: int64 description: The number of seconds processed. num_model_requests: type: integer description: The count of requests made to the model. project_id: anyOf: - type: string description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - type: 'null' user_id: anyOf: - type: string description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. - type: 'null' api_key_id: anyOf: - type: string description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - type: 'null' model: anyOf: - type: string description: When `group_by=model`, this field provides the model name of the grouped usage result. - type: 'null' required: - object - seconds - num_model_requests x-oaiMeta: name: Audio transcriptions usage object example: "{\n \"object\": \"organization.usage.audio_transcriptions.result\",\n \"seconds\": 10,\n \"num_model_requests\": 1,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"tts-1\"\n}\n" UsageModerationsResult: type: object description: The aggregated moderations usage details of the specific time bucket. properties: object: type: string enum: - organization.usage.moderations.result x-stainless-const: true input_tokens: type: integer description: The aggregated number of input tokens used. num_model_requests: type: integer description: The count of requests made to the model. project_id: anyOf: - type: string description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - type: 'null' user_id: anyOf: - type: string description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. - type: 'null' api_key_id: anyOf: - type: string description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - type: 'null' model: anyOf: - type: string description: When `group_by=model`, this field provides the model name of the grouped usage result. - type: 'null' required: - object - input_tokens - num_model_requests x-oaiMeta: name: Moderations usage object example: "{\n \"object\": \"organization.usage.moderations.result\",\n \"input_tokens\": 20,\n \"num_model_requests\": 2,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"text-moderation\"\n}\n" UsageCompletionsResult: type: object description: The aggregated completions usage details of the specific time bucket. properties: object: type: string enum: - organization.usage.completions.result x-stainless-const: true input_tokens: type: integer description: The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens. input_cached_tokens: type: integer description: 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. output_tokens: type: integer description: The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens. input_audio_tokens: type: integer description: The aggregated number of audio input tokens used, including cached tokens. output_audio_tokens: type: integer description: The aggregated number of audio output tokens used. num_model_requests: type: integer description: The count of requests made to the model. project_id: anyOf: - type: string description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - type: 'null' user_id: anyOf: - type: string description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. - type: 'null' api_key_id: anyOf: - type: string description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - type: 'null' model: anyOf: - type: string description: When `group_by=model`, this field provides the model name of the grouped usage result. - type: 'null' batch: anyOf: - type: boolean description: When `group_by=batch`, this field tells whether the grouped usage result is batch or not. - type: 'null' service_tier: anyOf: - type: string description: When `group_by=service_tier`, this field provides the service tier of the grouped usage result. - type: 'null' required: - object - input_tokens - output_tokens - num_model_requests x-oaiMeta: name: Completions usage object example: "{\n \"object\": \"organization.usage.completions.result\",\n \"input_tokens\": 5000,\n \"output_tokens\": 1000,\n \"input_cached_tokens\": 4000,\n \"input_audio_tokens\": 300,\n \"output_audio_tokens\": 200,\n \"num_model_requests\": 5,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"batch\": false,\n \"service_tier\": \"default\"\n}\n" UsageVectorStoresResult: type: object description: The aggregated vector stores usage details of the specific time bucket. properties: object: type: string enum: - organization.usage.vector_stores.result x-stainless-const: true usage_bytes: type: integer description: The vector stores usage in bytes. project_id: anyOf: - type: string description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - type: 'null' required: - object - usage_bytes x-oaiMeta: name: Vector stores usage object example: "{\n \"object\": \"organization.usage.vector_stores.result\",\n \"usage_bytes\": 1024,\n \"project_id\": \"proj_abc\"\n}\n" UsageAudioSpeechesResult: type: object description: The aggregated audio speeches usage details of the specific time bucket. properties: object: type: string enum: - organization.usage.audio_speeches.result x-stainless-const: true characters: type: integer description: The number of characters processed. num_model_requests: type: integer description: The count of requests made to the model. project_id: anyOf: - type: string description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - type: 'null' user_id: anyOf: - type: string description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. - type: 'null' api_key_id: anyOf: - type: string description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - type: 'null' model: anyOf: - type: string description: When `group_by=model`, this field provides the model name of the grouped usage result. - type: 'null' required: - object - characters - num_model_requests x-oaiMeta: name: Audio speeches usage object example: "{\n \"object\": \"organization.usage.audio_speeches.result\",\n \"characters\": 45,\n \"num_model_requests\": 1,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"tts-1\"\n}\n" UsageCodeInterpreterSessionsResult: type: object description: The aggregated code interpreter sessions usage details of the specific time bucket. properties: object: type: string enum: - organization.usage.code_interpreter_sessions.result x-stainless-const: true num_sessions: type: integer description: The number of code interpreter sessions. project_id: anyOf: - type: string description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - type: 'null' required: - object - num_sessions x-oaiMeta: name: Code interpreter sessions usage object example: "{\n \"object\": \"organization.usage.code_interpreter_sessions.result\",\n \"num_sessions\": 1,\n \"project_id\": \"proj_abc\"\n}\n" UsageTimeBucket: type: object properties: object: type: string enum: - bucket x-stainless-const: true start_time: type: integer end_time: type: integer results: type: array items: oneOf: - $ref: '#/components/schemas/UsageCompletionsResult' - $ref: '#/components/schemas/UsageEmbeddingsResult' - $ref: '#/components/schemas/UsageModerationsResult' - $ref: '#/components/schemas/UsageImagesResult' - $ref: '#/components/schemas/UsageAudioSpeechesResult' - $ref: '#/components/schemas/UsageAudioTranscriptionsResult' - $ref: '#/components/schemas/UsageVectorStoresResult' - $ref: '#/components/schemas/UsageCodeInterpreterSessionsResult' - $ref: '#/components/schemas/CostsResult' discriminator: propertyName: object required: - object - start_time - end_time - results CostsResult: type: object description: The aggregated costs details of the specific time bucket. properties: object: type: string enum: - organization.costs.result x-stainless-const: true amount: type: object description: The monetary value in its associated currency. properties: value: type: number description: The numeric value of the cost. currency: type: string description: Lowercase ISO-4217 currency e.g. "usd" line_item: anyOf: - type: string description: When `group_by=line_item`, this field provides the line item of the grouped costs result. - type: 'null' project_id: anyOf: - type: string description: When `group_by=project_id`, this field provides the project ID of the grouped costs result. - type: 'null' api_key_id: anyOf: - type: string description: When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. - type: 'null' quantity: anyOf: - type: number description: When `group_by=line_item`, this field provides the quantity of the grouped costs result. - type: 'null' required: - object x-oaiMeta: name: Costs object example: "{\n \"object\": \"organization.costs.result\",\n \"amount\": {\n \"value\": 0.06,\n \"currency\": \"usd\"\n },\n \"line_item\": \"Image models\",\n \"project_id\": \"proj_abc\",\n \"quantity\": 10000\n}\n" UsageEmbeddingsResult: type: object description: The aggregated embeddings usage details of the specific time bucket. properties: object: type: string enum: - organization.usage.embeddings.result x-stainless-const: true input_tokens: type: integer description: The aggregated number of input tokens used. num_model_requests: type: integer description: The count of requests made to the model. project_id: anyOf: - type: string description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - type: 'null' user_id: anyOf: - type: string description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. - type: 'null' api_key_id: anyOf: - type: string description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - type: 'null' model: anyOf: - type: string description: When `group_by=model`, this field provides the model name of the grouped usage result. - type: 'null' required: - object - input_tokens - num_model_requests x-oaiMeta: name: Embeddings usage object example: "{\n \"object\": \"organization.usage.embeddings.result\",\n \"input_tokens\": 20,\n \"num_model_requests\": 2,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"text-embedding-ada-002-v2\"\n}\n" securitySchemes: ApiKeyAuth: type: http scheme: bearer x-oaiMeta: groups: - id: audio title: Audio description: 'Learn how to turn audio into text or text into audio. Related guide: [Speech to text](/docs/guides/speech-to-text) ' sections: - type: endpoint key: createSpeech path: createSpeech - type: endpoint key: createTranscription path: createTranscription - type: endpoint key: createTranslation path: createTranslation - id: chat title: Chat description: 'Given a list of messages comprising a conversation, the model will return a response. Related guide: [Chat Completions](/docs/guides/text-generation) ' sections: - type: endpoint key: createChatCompletion path: create - type: object key: CreateChatCompletionResponse path: object - type: object key: CreateChatCompletionStreamResponse path: streaming - id: embeddings title: Embeddings description: 'Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms. Related guide: [Embeddings](/docs/guides/embeddings) ' sections: - type: endpoint key: createEmbedding path: create - type: object key: Embedding path: object - id: fine-tuning title: Fine-tuning description: 'Manage fine-tuning jobs to tailor a model to your specific training data. Related guide: [Fine-tune models](/docs/guides/fine-tuning) ' sections: - type: endpoint key: createFineTuningJob path: create - type: endpoint key: listPaginatedFineTuningJobs path: list - type: endpoint key: listFineTuningEvents path: list-events - type: endpoint key: retrieveFineTuningJob path: retrieve - type: endpoint key: cancelFineTuningJob path: cancel - type: object key: FineTuningJob path: object - type: object key: FineTuningJobEvent path: event-object - id: files title: Files description: 'Files are used to upload documents that can be used with features like [Assistants](/docs/api-reference/assistants) and [Fine-tuning](/docs/api-reference/fine-tuning). ' sections: - type: endpoint key: createFile path: create - type: endpoint key: listFiles path: list - type: endpoint key: retrieveFile path: retrieve - type: endpoint key: deleteFile path: delete - type: endpoint key: downloadFile path: retrieve-contents - type: object key: OpenAIFile path: object - id: images title: Images description: 'Given a prompt and/or an input image, the model will generate a new image. Related guide: [Image generation](/docs/guides/images) ' sections: - type: endpoint key: createImage path: create - type: endpoint key: createImageEdit path: createEdit - type: endpoint key: createImageVariation path: createVariation - type: object key: Image path: object - id: models title: Models description: 'List and describe the various models available in the API. You can refer to the [Models](/docs/models) documentation to understand what models are available and the differences between them. ' sections: - type: endpoint key: listModels path: list - type: endpoint key: retrieveModel path: retrieve - type: endpoint key: deleteModel path: delete - type: object key: Model path: object - id: moderations title: Moderations description: 'Given a input text, outputs if the model classifies it as violating OpenAI''s content policy. Related guide: [Moderations](/docs/guides/moderation) ' sections: - type: endpoint key: createModeration path: create - type: object key: CreateModerationResponse path: object - id: assistants title: Assistants beta: true description: 'Build assistants that can call models and use tools to perform tasks. [Get started with the Assistants API](/docs/assistants) ' sections: - type: endpoint key: createAssistant path: createAssistant - type: endpoint key: createAssistantFile path: createAssistantFile - type: endpoint key: listAssistants path: listAssistants - type: endpoint key: listAssistantFiles path: listAssistantFiles - type: endpoint key: getAssistant path: getAssistant - type: endpoint key: getAssistantFile path: getAssistantFile - type: endpoint key: modifyAssistant path: modifyAssistant - type: endpoint key: deleteAssistant path: deleteAssistant - type: endpoint key: deleteAssistantFile path: deleteAssistantFile - type: object key: AssistantObject path: object - type: object key: AssistantFileObject path: file-object - id: threads title: Threads beta: true description: 'Create threads that assistants can interact with. Related guide: [Assistants](/docs/assistants/overview) ' sections: - type: endpoint key: createThread path: createThread - type: endpoint key: getThread path: getThread - type: endpoint key: modifyThread path: modifyThread - type: endpoint key: deleteThread path: deleteThread - type: object key: ThreadObject path: object - id: messages title: Messages beta: true description: 'Create messages within threads Related guide: [Assistants](/docs/assistants/overview) ' sections: - type: endpoint key: createMessage path: createMessage - type: endpoint key: listMessages path: listMessages - type: endpoint key: listMessageFiles path: listMessageFiles - type: endpoint key: getMessage path: getMessage - type: endpoint key: getMessageFile path: getMessageFile - type: endpoint key: modifyMessage path: modifyMessage - type: object key: MessageObject path: object - type: object key: MessageFileObject path: file-object - id: runs title: Runs beta: true description: 'Represents an execution run on a thread. Related guide: [Assistants](/docs/assistants/overview) ' sections: - type: endpoint key: createRun path: createRun - type: endpoint key: createThreadAndRun path: createThreadAndRun - type: endpoint key: listRuns path: listRuns - type: endpoint key: listRunSteps path: listRunSteps - type: endpoint key: getRun path: getRun - type: endpoint key: getRunStep path: getRunStep - type: endpoint key: modifyRun path: modifyRun - type: endpoint key: submitToolOuputsToRun path: submitToolOutputs - type: endpoint key: cancelRun path: cancelRun - type: object key: RunObject path: object - type: object key: RunStepObject path: step-object - id: completions title: Completions legacy: true description: 'Given a prompt, the model will return one or more predicted completions along with the probabilities of alternative tokens at each position. Most developer should use our [Chat Completions API](/docs/guides/text-generation/text-generation-models) to leverage our best and newest models. Most models that support the legacy Completions endpoint [will be shut off on January 4th, 2024](/docs/deprecations/2023-07-06-gpt-and-embeddings). ' sections: - type: endpoint key: createCompletion path: create - type: object key: CreateCompletionResponse path: object