Skip to content
Merged
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: 93febdd4-7ee3-455a-80bc-7c0baaf435a3
openapi_spec_hash: 6360b32c319a170c2a744c89fa04012c
openapi_transformed_spec_hash: fcef9a169b4e86d9f5123af6a63e4549
config_hash: c60e0807b14344bdca86985565f3bfee
codegen_sha: 09adc241feb32e4c5cc176e2fe4d72e7fe4b160e
codegen_hash: 9946018fdf557a53e2d0569e8d951d6bd0e31ab55445447d8813c9a588babeab
generation_id: cb93d63d-df7f-4872-980c-3bf38c3d5c02
openapi_spec_hash: fcc1b2f84098b3b64394ac39260fb04b
openapi_transformed_spec_hash: 33f32c1a9bba55a5cc6e39789e9b7dcd
config_hash: 3a5d490bd74541b3de242f261148388e
codegen_sha: 7ce661f2c9c9e0cc02f57cbada97dd79ead73588
codegen_hash: 3568f468e352dc201761a2fa26782100d073b72740cb6c99705a2547de6a6785
295 changes: 294 additions & 1 deletion api_reference/openapi.transformed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11184,7 +11184,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/UsageResponse'
$ref: '#/components/schemas/CostsResponseWithDimensions'
'400':
description: The request parameters are invalid or the requested operation cannot be performed.
content:
Expand All @@ -11202,6 +11202,7 @@ paths:
x-oaiMeta:
group: usage-costs
examples:
- title: Total costs
request:
curl: |
curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1" \
Expand All @@ -11223,6 +11224,8 @@ paths:
"currency": "usd"
},
"line_item": null,
"model": null,
"token_type": null,
"project_id": null,
"api_key_id": null,
"quantity": null,
Expand All @@ -11234,6 +11237,41 @@ paths:
"has_more": false,
"next_page": null
}
- title: Costs by line item
request:
curl: |
curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1&group_by=line_item" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
response: |
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.costs.result",
"amount": {
"value": 0.06,
"currency": "usd"
},
"line_item": "gpt-6.2-astra, input_tokens",
"model": "gpt-6.2-astra",
"token_type": "input",
"project_id": null,
"api_key_id": null,
"quantity": 10000,
"quantity_unit": "tokens"
}
]
}
],
"has_more": false,
"next_page": null
}
/organization/data_retention:
get:
security:
Expand Down Expand Up @@ -115235,6 +115273,261 @@ components:
- $ref: '#/components/schemas/CreateSpendLimitParams'
description: The monthly hard spend limit for the initial API key. You cannot set a spend limit when `create_service_account_only` is `true`.
- type: 'null'
OrganizationCostAmountModel:
properties:
value:
type: number
currency:
type: string
type: object
required:
- value
- currency
OrganizationCostQuantityUnit:
anyOf:
- type: string
- type: string
enum:
- tokens
- 1000_tokens
- duration_seconds
- duration_minutes
- duration_hours
- gibibyte_hours
- images
- characters
PublicOrganizationCostBucketModel:
properties:
object:
type: string
enum:
- bucket
default: bucket
x-stainless-const: true
start_time:
type: integer
end_time:
type: integer
results:
items:
$ref: '#/components/schemas/PublicOrganizationCostResultModel'
type: array
type: object
required:
- object
- start_time
- end_time
- results
PublicOrganizationCostResultModel:
properties:
api_source:
anyOf:
- type: string
description: API source (agents_api or unlabeled) when grouped by api_source; otherwise null. Unlabeled includes records without published source attribution.
- type: 'null'
object:
type: string
enum:
- organization.costs.result
default: organization.costs.result
x-stainless-const: true
amount:
$ref: '#/components/schemas/OrganizationCostAmountModel'
line_item:
anyOf:
- type: string
- type: 'null'
model:
anyOf:
- type: string
description: The model associated with the billed product, including purchased capacity. This may differ from the model ID used in a request, including fine-tuned model IDs. Null when line_item is null or a model association is unavailable or not applicable.
- type: 'null'
token_type:
anyOf:
- 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'
project_id:
anyOf:
- type: string
- type: 'null'
user_id:
anyOf:
- type: string
- type: 'null'
api_key_id:
anyOf:
- type: string
- type: 'null'
quantity:
anyOf:
- type: number
- type: 'null'
quantity_unit:
anyOf:
- $ref: '#/components/schemas/OrganizationCostQuantityUnit'
- type: 'null'
type: object
required:
- object
- amount
- line_item
- project_id
PublicOrganizationCostsResource:
properties:
object:
type: string
enum:
- page
default: page
x-stainless-const: true
data:
items:
$ref: '#/components/schemas/PublicOrganizationCostBucketModel'
type: array
has_more:
type: boolean
next_page:
anyOf:
- type: string
- type: 'null'
type: object
required:
- object
- data
- has_more
- next_page
CostsResultWithDimensions:
type: object
description: The aggregated costs details of the specific time bucket.
properties:
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:
- type: string
enum:
- agents_api
- unlabeled
- type: 'null'
object:
type: string
const: organization.costs.result
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'
user_id:
anyOf:
- type: string
description: When `group_by=user_id`, this field provides the user 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'
quantity_unit:
$ref: '#/components/schemas/CostsResult/properties/quantity_unit'
model:
anyOf:
- type: string
description: The model associated with the billed product, including purchased capacity. This may differ from the model ID used in a request, including fine-tuned model IDs. Null when line_item is null or a model association is unavailable or not applicable.
- type: 'null'
token_type:
anyOf:
- 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'
required:
- object
x-oaiMeta:
name: Costs object
example: |
{
"object": "organization.costs.result",
"amount": {
"value": 0.06,
"currency": "usd"
},
"line_item": "gpt-6.2-astra, input_tokens",
"project_id": "proj_abc",
"quantity": 10000,
"quantity_unit": "tokens"
}
CostsTimeBucketWithDimensions:
type: object
properties:
object:
type: string
const: bucket
start_time:
type: integer
end_time:
type: integer
results:
type: array
items:
discriminator:
propertyName: object
anyOf:
- $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/UsageFileSearchCallsResult'
- $ref: '#/components/schemas/UsageWebSearchCallsResult'
- $ref: '#/components/schemas/CostsResultWithDimensions'
required:
- object
- start_time
- end_time
- results
CostsResponseWithDimensions:
type: object
properties:
object:
type: string
const: page
data:
type: array
items:
$ref: '#/components/schemas/CostsTimeBucketWithDimensions'
has_more:
type: boolean
next_page:
anyOf:
- type: string
- type: 'null'
required:
- object
- data
- has_more
- next_page
DecisionPromptCacheBreakpoint:
type: object
properties:
Expand Down
Loading
Loading