On this page
runs.usage
Read metered usage and cost of one run
Request
GET /api/v1/runs/{run_id}/usage
- MCP:
runs_usage - SDK:
client.runs.usage(SDK path arguments usepath; MCP usesparams). - Minimum API key role: viewer.
- Idempotency: none.
Use the request schema below. Read IDs from earlier operation results.
Input schema
json
{
"parameters": [
{
"name": "run_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"requestBody": null
}
Responses
json
{
"200": {
"description": "Read metered usage and cost of one run",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RunsUsageResponse200"
}
}
}
},
"4XX": {
"description": "Typed error (ApiError)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
},
"5XX": {
"description": "Typed error (ApiError)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
}
}
Referenced schemas
json
{
"components": {
"schemas": {
"RunsUsageResponse200": {
"type": "object",
"properties": {
"run_id": {
"type": "string",
"format": "uuid"
},
"connected_ms": {
"type": "integer",
"minimum": 0,
"nullable": true
},
"llm_input_tokens": {
"type": "integer",
"minimum": 0,
"nullable": true
},
"llm_output_tokens": {
"type": "integer",
"minimum": 0,
"nullable": true
},
"stt_ms": {
"type": "integer",
"minimum": 0,
"nullable": true
},
"tts_characters": {
"type": "integer",
"minimum": 0,
"nullable": true
},
"measurements": {
"type": "integer",
"minimum": 0
},
"cost": {
"type": "object",
"properties": {
"currency": {
"type": "string",
"enum": [
"USD"
]
},
"amount": {
"allOf": [
{
"type": "string",
"pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,12})?$"
}
],
"nullable": true
},
"completeness": {
"type": "string",
"enum": [
"complete",
"partial",
"unpriced"
]
}
},
"required": [
"currency",
"amount",
"completeness"
],
"additionalProperties": false
}
},
"required": [
"run_id",
"connected_ms",
"llm_input_tokens",
"llm_output_tokens",
"stt_ms",
"tts_characters",
"measurements",
"cost"
],
"additionalProperties": false
},
"ApiError": {
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string",
"enum": [
"unauthenticated",
"forbidden",
"not_found",
"conflict",
"invalid_request",
"idempotency_conflict",
"policy_denied",
"capability_unavailable",
"provider_unavailable",
"knowledge_unavailable",
"publication_invalid",
"run_not_active",
"rate_limited",
"outcome_unknown",
"internal"
]
},
"message": {
"type": "string"
},
"retryable": {
"type": "boolean"
},
"outcome": {
"type": "string",
"enum": [
"none",
"unknown"
]
},
"details": {
"type": "object",
"additionalProperties": {}
}
},
"required": [
"code",
"message",
"retryable",
"outcome"
],
"additionalProperties": false
}
},
"required": [
"error"
],
"additionalProperties": false
}
}
}
}
Errors and recovery
See API error handling and Troubleshooting.
Related guides
Content version e19fc599Markdown source