Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .castiron.stats.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
schema_version: 1
generation_id: 246f879d-8464-4b41-bb24-d89bc1e8df3c
openapi_spec_hash: 0ce316f78a89857b9483e1ec86e095ea
openapi_transformed_spec_hash: 45b9b080467ec914b61d840811bed260
config_hash: 036100415594abcf279907b22cc8d2f1
codegen_sha: cc041f0d27315d1a33d649dd1e5fb6f2ec04c72b
codegen_hash: 52084edd6ec47c7ad6066c4f16600f52381ceb96fcad79a85380928a81299e80
generation_id: 4f4dbc91-5b78-46d8-97f7-15096d8e430c
openapi_spec_hash: 85300592bd12a4d6666b4f2972c5b340
openapi_transformed_spec_hash: a7e0ebe69483471b43a3667b70c53fca
config_hash: 4bd03da3ce58c2786da57469e6022f83
codegen_sha: 3a70cedb841472aff4cc80602656795087f0c1b0
codegen_hash: 90a067163c95f062e08d68c3eac2947ba43ca99c22e8d9c353bff40bab06b6c6
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1413,11 +1413,11 @@ Types:
```python
from openai.types.admin.organization import (
CostQuantityUnit,
UsageCostsResponse,
UsageAudioSpeechesResponse,
UsageAudioTranscriptionsResponse,
UsageCodeInterpreterSessionsResponse,
UsageCompletionsResponse,
UsageCostsResponse,
UsageDecisionsResponse,
UsageEmbeddingsResponse,
UsageFileSearchCallsResponse,
Expand Down
71 changes: 60 additions & 11 deletions api_reference/openapi.transformed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11106,12 +11106,14 @@ paths:
required: true
schema:
type: integer
example: 1796256000
- name: end_time
in: query
description: End time (Unix seconds) of the query time range, exclusive.
required: false
schema:
type: integer
example: 1796342400
- name: bucket_width
in: query
description: Width of each time bucket in response. Currently only `1d` is supported, default to `1d`.
Expand Down Expand Up @@ -11147,7 +11149,7 @@ paths:
type: string
- name: group_by
in: query
description: Group the costs by the specified fields. Supported fields include `project_id`, `user_id`, `line_item`, `api_key_id`, and `api_source`. Support for combining `user_id` with `project_id` grouping or the `project_ids` filter depends on the organization and requested time range. Unsupported combinations return HTTP 400. When grouped by `api_source`, results use `agents_api` for attributed Agents API activity and `unlabeled` for all other activity. Without source grouping, `api_source` is null.
description: Group the costs by the specified fields. Supported fields include `project_id`, `user_id`, `line_item`, `api_key_id`, `api_source`, and `completion_window`. Support for combining `user_id` with `project_id` grouping or the `project_ids` filter depends on the organization and requested time range. Unsupported combinations return HTTP 400. When grouped by `api_source`, results use `agents_api` for attributed Agents API activity and `unlabeled` for all other activity. Without source grouping, `api_source` is null. When grouped by `completion_window`, results use `2h`, `8h`, or `unlabeled` when no known or applicable window is available. Without window grouping, `completion_window` is null. Unlabeled does not imply Standard traffic. The field may be omitted when completion-window reporting is unavailable. Batch's 24h window and legacy Flex scheduling are not included. Existing line item names and exact-name filters are unchanged. Keep the same grouping and filters when following `next_page`.
required: false
schema:
type: array
Expand All @@ -11159,6 +11161,7 @@ paths:
- line_item
- api_key_id
- api_source
- completion_window
- name: limit
in: query
description: |
Expand All @@ -11178,7 +11181,26 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/CostsResponseWithDimensions'
allOf:
- $ref: '#/components/schemas/CostsResponseWithDimensions'
example:
object: page
data:
- object: bucket
start_time: 1796256000
end_time: 1796342400
results:
- object: organization.costs.result
amount:
value: 0.06
currency: usd
line_item: null
model: null
token_type: null
completion_window: null
project_id: null
has_more: false
next_page: null
'400':
description: The request parameters are invalid or the requested operation cannot be performed.
content:
Expand All @@ -11199,7 +11221,7 @@ paths:
- title: Total costs
request:
curl: |
curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1" \
curl "https://api.openai.com/v1/organization/costs?start_time=1796256000&end_time=1796342400" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
response: |
Expand All @@ -11208,8 +11230,8 @@ paths:
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"start_time": 1796256000,
"end_time": 1796342400,
"results": [
{
"object": "organization.costs.result",
Expand All @@ -11220,6 +11242,7 @@ paths:
"line_item": null,
"model": null,
"token_type": null,
"completion_window": null,
"project_id": null,
"api_key_id": null,
"quantity": null,
Expand All @@ -11231,10 +11254,10 @@ paths:
"has_more": false,
"next_page": null
}
- title: Costs by line item
- title: Costs by line item and completion window
request:
curl: |
curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1&group_by=line_item" \
curl "https://api.openai.com/v1/organization/costs?start_time=1796256000&end_time=1796342400&group_by=line_item&group_by=completion_window" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
response: |
Expand All @@ -11243,8 +11266,8 @@ paths:
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"start_time": 1796256000,
"end_time": 1796342400,
"results": [
{
"object": "organization.costs.result",
Expand All @@ -11255,6 +11278,7 @@ paths:
"line_item": "gpt-6.2-astra, input_tokens",
"model": "gpt-6.2-astra",
"token_type": "input",
"completion_window": "2h",
"project_id": null,
"api_key_id": null,
"quantity": 10000,
Expand Down Expand Up @@ -17073,7 +17097,7 @@ paths:
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`, `api_source` or any combination of them. When grouped by `api_source`, results use `agents_api` for attributed Agents API activity and `unlabeled` for all other activity. Without source grouping, `api_source` is null.
description: Group the usage data by the specified fields. Supported fields include `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier`, `api_source`, `completion_window` or any combination of them. When grouped by `api_source`, results use `agents_api` for attributed Agents API activity and `unlabeled` for all other activity. Without source grouping, `api_source` is null. When grouped by `completion_window`, results use `2h`, `8h`, or `unlabeled` when no known or applicable window is available. Without window grouping, `completion_window` is null. Unlabeled does not imply Standard traffic. The field may be omitted when completion-window reporting is unavailable. Completion window is separate from `service_tier`; Batch's 24h window and legacy Flex scheduling are not included. Keep the same grouping and filters when following `next_page`.
required: false
schema:
type: array
Expand All @@ -17087,6 +17111,7 @@ paths:
- batch
- service_tier
- api_source
- completion_window
- name: limit
in: query
description: |
Expand Down Expand Up @@ -74322,6 +74347,8 @@ components:
type: object
description: The aggregated completions usage details of the specific time bucket.
properties:
completion_window:
$ref: '#/components/schemas/completion_window'
api_source:
description: When grouped by `api_source`, `agents_api` identifies attributed Agents API activity and `unlabeled` includes all records without published source attribution, including historical and unknown origins. Unlabeled does not imply direct API usage. Without source grouping, this field is null.
anyOf:
Expand Down Expand Up @@ -74448,7 +74475,8 @@ components:
"api_key_id": "key_abc",
"model": "gpt-6.2-astra",
"batch": false,
"service_tier": "default"
"service_tier": "default",
"completion_window": null
}
UsageEmbeddingsResult:
type: object
Expand Down Expand Up @@ -116606,6 +116634,11 @@ components:
- results
PublicOrganizationCostResultModel:
properties:
completion_window:
anyOf:
- description: The background completion window for this result. When group_by includes completion_window, the value is 2h, 8h, or unlabeled if the window is unknown or does not apply. Otherwise, the value is null.
$ref: '#/components/schemas/ReportedCompletionWindow'
- type: 'null'
api_source:
anyOf:
- type: string
Expand Down Expand Up @@ -117365,6 +117398,17 @@ components:
- next
- has_more
additionalProperties: false
ReportedCompletionWindow:
type: string
enum:
- 2h
- 8h
- unlabeled
completion_window:
anyOf:
- description: The background completion window for this result. When group_by includes completion_window, the value is 2h, 8h, or unlabeled if the window is unknown or does not apply. Otherwise, the value is null.
$ref: '#/components/schemas/ReportedCompletionWindow'
- type: 'null'
CostsResultWithDimensions:
type: object
description: The aggregated costs details of the specific time bucket.
Expand Down Expand Up @@ -117427,6 +117471,11 @@ components:
- type: string
description: 'The billed token category: `input`, `output`, `input_cached`, `input_cache_write_30m`, `input_cache_write_12h`, or `total`. For inference charges, `input` excludes separately billed cache reads and writes. For Scale Tier purchases, these categories describe purchased capacity. Null when line_item is null or when the category is unknown or inapplicable. Additional values may be introduced in the future.'
- type: 'null'
completion_window:
anyOf:
- description: The background completion window for this result. When group_by includes completion_window, the value is 2h, 8h, or unlabeled if the window is unknown or does not apply. Otherwise, the value is null.
$ref: '#/components/schemas/ReportedCompletionWindow'
- type: 'null'
required:
- object
x-oaiMeta:
Expand Down
32 changes: 16 additions & 16 deletions scripts/castiron/generated-files.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": {
"api.md": {
"mode": "100644",
"sha256": "023cc38670f9e15c47e8592fb4c04b1c879f7178060446775ae3f57f22d25d83"
"sha256": "359777878b88a838a484de3e737ea0c3d7aedb57d68214c06a66eb78bcab22ef"
},
"src/openai/__init__.py": {
"mode": "100644",
Expand Down Expand Up @@ -219,7 +219,7 @@
},
"src/openai/resources/admin/organization/usage.py": {
"mode": "100644",
"sha256": "ec767c61744615ac7899a3155c14f8342226e077973b87656189927bd01f8b84"
"sha256": "0b87f2d4e0c26109a1c27f69ddb18b5d72e7a82a08432abeae601d9eb911ae43"
},
"src/openai/resources/admin/organization/users/__init__.py": {
"mode": "100644",
Expand Down Expand Up @@ -1451,39 +1451,39 @@
},
"src/openai/types/admin/organization/usage_audio_speeches_response.py": {
"mode": "100644",
"sha256": "be0b5d71e86f5b631dcb7f058910c28d963181112de32c53a9b891f6405aee3c"
"sha256": "28b7377a115339600eca741d86b625c26f5206257e084946a33c312879829660"
},
"src/openai/types/admin/organization/usage_audio_transcriptions_params.py": {
"mode": "100644",
"sha256": "b697947fcc5ae0189edd801b45d2ab886684bc130d879485c84a20d2d72a9736"
},
"src/openai/types/admin/organization/usage_audio_transcriptions_response.py": {
"mode": "100644",
"sha256": "73f935a7c8a2943b4f6791f50da7152c383c69cd063fe886b51a179fe80ee196"
"sha256": "0d15bf9e1842d078ce8141a963f24f6647997628a8e153544f92525aaa63d59a"
},
"src/openai/types/admin/organization/usage_code_interpreter_sessions_params.py": {
"mode": "100644",
"sha256": "24e367735b8c09cfe11ad50276df8edb6438094bad7252f477fcf698062be7a6"
},
"src/openai/types/admin/organization/usage_code_interpreter_sessions_response.py": {
"mode": "100644",
"sha256": "c4d16ba26fcc203831645cad0493427983e25f35924d5ab067664ba548c2fef0"
"sha256": "2e8481a9774be583792b04f123a2ff4df76c0bc9ea0619db0a5af888895891f1"
},
"src/openai/types/admin/organization/usage_completions_params.py": {
"mode": "100644",
"sha256": "69497b03766e90c60209eec3f43e0e912d49a6466bfb6403eb1974df659408e9"
"sha256": "3877a857c7f355b3df42cadaa4809ed1c3b8cc43b0c7b7ad3da57e105af92f42"
},
"src/openai/types/admin/organization/usage_completions_response.py": {
"mode": "100644",
"sha256": "b067bb58f59a51dc4cc7cdb6ff811c25a103b62c8ddbf2fa00f9070dab42b179"
"sha256": "6c21e8b6066ecfafabbb6db73b83f4a7a4ea4bc559b7b2b3e58b12b699e5f152"
},
"src/openai/types/admin/organization/usage_costs_params.py": {
"mode": "100644",
"sha256": "524d5d4553f5985167250036d224f75da568c8aa86913ff014995c2748f021cb"
"sha256": "a5fa71036218c6260c5830e79b74bbf29406f6601748722f49672d22b20eec2e"
},
"src/openai/types/admin/organization/usage_costs_response.py": {
"mode": "100644",
"sha256": "291441b12df73417c2c1a385c8e2492c801f3760f0bcc75338de721bdeb3552d"
"sha256": "e17ee4d954b6f9abcfeec619bc3c5d19b4bef00dddf7414a77183ab158ba11e3"
},
"src/openai/types/admin/organization/usage_decisions_params.py": {
"mode": "100644",
Expand All @@ -1499,47 +1499,47 @@
},
"src/openai/types/admin/organization/usage_embeddings_response.py": {
"mode": "100644",
"sha256": "8237167123c50b07038996c660575ce48b0c1455fa6d654b390b5c44899b2270"
"sha256": "f5104baaf4cb8824914c9d861dbdd00ee323294c573d4635771312a6e9fcc4c3"
},
"src/openai/types/admin/organization/usage_file_search_calls_params.py": {
"mode": "100644",
"sha256": "f181fd0f06998d0dad849b87e379172fe998ef19202cc472fd366058572d35de"
},
"src/openai/types/admin/organization/usage_file_search_calls_response.py": {
"mode": "100644",
"sha256": "9b274a94aa5d05a815aae5c356c5d72c338a04833e995283acfc5addc3a8ea09"
"sha256": "ef77c22b8c75d1408fd2c2e738fb7863f049f562c59a95e44dadd4199c656108"
},
"src/openai/types/admin/organization/usage_images_params.py": {
"mode": "100644",
"sha256": "5e32690be57a178b9d6e8ab12009f941d25b05bfc633e207ca90514d896b1ca4"
},
"src/openai/types/admin/organization/usage_images_response.py": {
"mode": "100644",
"sha256": "be86ff8f13e0420cecf2b6f500f97ec1e1831f82edf4d1292f54152d5cfdcb17"
"sha256": "43df8179d9298d28475566b0b4f3cc25a60cdd45096b8a138cadabb96700c77a"
},
"src/openai/types/admin/organization/usage_moderations_params.py": {
"mode": "100644",
"sha256": "b836fb081b0dd59c4acd548ee6b4af797603d14b1fc6db93c4b0ab0e7e0159e3"
},
"src/openai/types/admin/organization/usage_moderations_response.py": {
"mode": "100644",
"sha256": "e63e527408f23e6e43059c5aeb04380233eb03a28be42679e29a8a420feb7a3d"
"sha256": "b0471c8fda033e9b137b48820df2deba90103dcb8342011db5e9219c52468295"
},
"src/openai/types/admin/organization/usage_vector_stores_params.py": {
"mode": "100644",
"sha256": "6f0beb8491a755b9484960e129d313556ea3817ce516c842821784c2996a7c90"
},
"src/openai/types/admin/organization/usage_vector_stores_response.py": {
"mode": "100644",
"sha256": "fb5a4478701a61369cf0c87c615d7b5b41b18e5394b83f469fc805565e3251e4"
"sha256": "40fe67627acd8986d133a016de2ce8e62b7f673af3547fcace9f65c28f9337eb"
},
"src/openai/types/admin/organization/usage_web_search_calls_params.py": {
"mode": "100644",
"sha256": "695ebfee4a029417fc3c9c8ba591d34040ba80e250d5f5cfa09deeb21cc8352f"
},
"src/openai/types/admin/organization/usage_web_search_calls_response.py": {
"mode": "100644",
"sha256": "fe8f464c0045fddf327041b4e2e00ff50ba2e212b6142a94676ae475ae076faa"
"sha256": "c8ac69d751e2fccffcb48ed7fc9f64eb74c2f7406a9d6b08b5835592a69ababf"
},
"src/openai/types/admin/organization/user_delete_response.py": {
"mode": "100644",
Expand Down Expand Up @@ -7899,7 +7899,7 @@
},
"tests/api_resources/admin/organization/test_usage.py": {
"mode": "100644",
"sha256": "67935642b6d09060b7bdd1b15c4d5e8881c6bc96b11934f5ff772bf82860a675"
"sha256": "b75cac81c4de2f67a7bbd4d1e950162b98e87d98a41ac44cb3a4c3bf46156272"
},
"tests/api_resources/admin/organization/test_users.py": {
"mode": "100644",
Expand Down
Loading
Loading