{"openapi":"3.1.0","info":{"title":"D1 Prediction API","description":"Synchronous structured predictions. Reuse Idempotency-Key for retries. Prices are USD decimal strings.","version":"1.0.0"},"paths":{"/v1/predictions":{"post":{"tags":["Predictions"],"summary":"Create a prediction","description":"Answer typed questions about a shared text or JSON-object context.\n\nA successful response includes ordered answers and the actual charge. Both\nare durably saved before returning 200. Reuse the same Idempotency-Key and\nrequest after a timeout to recover the result without another charge.","operationId":"predict_v1_predictions_post","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Optional, recommended unique operation key (at most 200 characters). Keep the same key and request for retries after a lost response. Changed content conflicts; accepted terminal results replay for 24 hours by default, followed by a tombstone until 30 days from acceptance. Never recycle a key for a new logical operation.","title":"Idempotency-Key"},"description":"Optional, recommended unique operation key (at most 200 characters). Keep the same key and request for retries after a lost response. Changed content conflicts; accepted terminal results replay for 24 hours by default, followed by a tombstone until 30 days from acceptance. Never recycle a key for a new logical operation."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictionInput"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictionResponse"}}}},"400":{"description":"Malformed or ambiguous JSON.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Missing, invalid, or revoked API key.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"402":{"description":"Insufficient available credit.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Account is waitlisted or suspended.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Resource not found.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"Operation conflict, in-progress request, expired replay, or cancellation.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"413":{"description":"Request exceeds a body, input, or model limit.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"415":{"description":"Unsupported media type or content encoding.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"422":{"description":"Request validation failed or model is unavailable.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Account request, token, concurrency, or read limit exceeded.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Unexpected service error; replay a prediction to resolve uncertainty.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"Invalid model output; no charge is settled.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"Service paused, capacity exhausted, or dependency unavailable.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"504":{"description":"Prediction deadline exceeded; replay using the same operation key.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/predictions/estimate":{"post":{"tags":["Predictions"],"summary":"Estimate a prediction","description":"Validate and meter a prediction without running inference or charging credit.\n\nThe estimate is advisory. It does not reserve credit or lock the model or price\nfor a later prediction. USD amounts are exact decimal strings.","operationId":"estimate_v1_predictions_estimate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictionInput"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EstimateResponse"}}}},"400":{"description":"Malformed or ambiguous JSON.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Missing, invalid, or revoked API key.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"402":{"description":"Insufficient available credit.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Account is waitlisted or suspended.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Resource not found.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"Operation conflict, in-progress request, expired replay, or cancellation.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"413":{"description":"Request exceeds a body, input, or model limit.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"415":{"description":"Unsupported media type or content encoding.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"422":{"description":"Request validation failed or model is unavailable.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Account request, token, concurrency, or read limit exceeded.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Unexpected service error; replay a prediction to resolve uncertainty.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"Invalid model output; no charge is settled.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"Service paused, capacity exhausted, or dependency unavailable.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"504":{"description":"Prediction deadline exceeded; replay using the same operation key.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/models":{"get":{"tags":["Models"],"summary":"List models","description":"Discover available models, their capabilities, effective limits, and price.\n\nCheck simulated before interpreting answers: simulated models return sample\nresults for integration testing. An empty models list means prediction is not\navailable in this deployment. Model IDs are opaque.","operationId":"models_v1_models_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelsResponse"}}}},"400":{"description":"Malformed or ambiguous JSON.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Missing, invalid, or revoked API key.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"402":{"description":"Insufficient available credit.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Account is waitlisted or suspended.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Resource not found.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"Operation conflict, in-progress request, expired replay, or cancellation.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"413":{"description":"Request exceeds a body, input, or model limit.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"415":{"description":"Unsupported media type or content encoding.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"422":{"description":"Request validation failed or model is unavailable.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Account request, token, concurrency, or read limit exceeded.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Unexpected service error; replay a prediction to resolve uncertainty.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"Invalid model output; no charge is settled.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"Service paused, capacity exhausted, or dependency unavailable.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"504":{"description":"Prediction deadline exceeded; replay using the same operation key.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/balance":{"get":{"tags":["Account"],"summary":"Get balance","description":"Read available credit, reservations, and expiring promotional grants.\n\nAvailable credit excludes holds and expired grants. All USD amounts are exact\ndecimal strings with nine fractional digits; use decimal or integer arithmetic.","operationId":"get_balance_v1_balance_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BalanceResponse"}}}},"400":{"description":"Malformed or ambiguous JSON.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Missing, invalid, or revoked API key.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"402":{"description":"Insufficient available credit.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Account is waitlisted or suspended.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Resource not found.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"Operation conflict, in-progress request, expired replay, or cancellation.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"413":{"description":"Request exceeds a body, input, or model limit.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"415":{"description":"Unsupported media type or content encoding.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"422":{"description":"Request validation failed or model is unavailable.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Account request, token, concurrency, or read limit exceeded.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Unexpected service error; replay a prediction to resolve uncertainty.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"Invalid model output; no charge is settled.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"Service paused, capacity exhausted, or dependency unavailable.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"504":{"description":"Prediction deadline exceeded; replay using the same operation key.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1.0}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/usage":{"get":{"tags":["Account"],"summary":"List usage","description":"List accepted predictions and their charges, newest first.\n\nUsage contains metadata, never input context or answers. Pass next_cursor\nunchanged with the same filters to continue; null ends pagination. Start is\ninclusive and end is exclusive. Supply timezone-aware ISO 8601 timestamps.","operationId":"get_usage_v1_usage_get","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}},{"name":"start","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Start"}},{"name":"end","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"End"}},{"name":"model","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Page_UsageRecord_"}}}},"400":{"description":"Malformed or ambiguous JSON.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Missing, invalid, or revoked API key.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"402":{"description":"Insufficient available credit.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Account is waitlisted or suspended.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Resource not found.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"Operation conflict, in-progress request, expired replay, or cancellation.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"413":{"description":"Request exceeds a body, input, or model limit.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"415":{"description":"Unsupported media type or content encoding.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"422":{"description":"Request validation failed or model is unavailable.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Account request, token, concurrency, or read limit exceeded.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Unexpected service error; replay a prediction to resolve uncertainty.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"Invalid model output; no charge is settled.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"Service paused, capacity exhausted, or dependency unavailable.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"504":{"description":"Prediction deadline exceeded; replay using the same operation key.","headers":{"X-Request-ID":{"description":"Server request identifier for support and correlation.","schema":{"type":"string"}},"Retry-After":{"description":"When present, wait this many seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}}},"components":{"schemas":{"BalanceResponse":{"properties":{"currency":{"type":"string","const":"USD","title":"Currency"},"available_usd":{"type":"string","pattern":"^\\d+\\.\\d{9}$","title":"Available Usd"},"reserved_usd":{"type":"string","pattern":"^\\d+\\.\\d{9}$","title":"Reserved Usd"},"paid_usd":{"type":"string","pattern":"^\\d+\\.\\d{9}$","title":"Paid Usd"},"promotional_usd":{"type":"string","pattern":"^\\d+\\.\\d{9}$","title":"Promotional Usd"},"financial_shortfall_usd":{"type":"string","pattern":"^\\d+\\.\\d{9}$","title":"Financial Shortfall Usd"},"expiring_grants":{"items":{"$ref":"#/components/schemas/ExpiringGrant"},"type":"array","title":"Expiring Grants"}},"additionalProperties":false,"type":"object","required":["currency","available_usd","reserved_usd","paid_usd","promotional_usd","financial_shortfall_usd","expiring_grants"],"title":"BalanceResponse"},"BinaryAnswer":{"properties":{"id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Id"},"type":{"type":"string","const":"binary","title":"Type","default":"binary"},"probability_true":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Probability True"}},"additionalProperties":false,"type":"object","required":["id","probability_true"],"title":"BinaryAnswer"},"BinaryQuestion":{"properties":{"id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Id"},"prompt":{"type":"string","maxLength":262144,"minLength":1,"title":"Prompt"},"type":{"type":"string","const":"binary","title":"Type"}},"additionalProperties":false,"type":"object","required":["id","prompt","type"],"title":"BinaryQuestion"},"ChoiceAnswer":{"properties":{"id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Id"},"type":{"type":"string","const":"choice","title":"Type","default":"choice"},"options":{"items":{"$ref":"#/components/schemas/OptionProbability"},"type":"array","title":"Options"},"selected":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Selected"}},"additionalProperties":false,"type":"object","required":["id","options","selected"],"title":"ChoiceAnswer"},"ChoiceQuestion":{"properties":{"id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Id"},"prompt":{"type":"string","maxLength":262144,"minLength":1,"title":"Prompt"},"type":{"type":"string","const":"choice","title":"Type"},"options":{"items":{"$ref":"#/components/schemas/Option"},"type":"array","maxItems":32,"minItems":2,"title":"Options"}},"additionalProperties":false,"type":"object","required":["id","prompt","type","options"],"title":"ChoiceQuestion"},"ErrorDetail":{"properties":{"code":{"type":"string","title":"Code"},"message":{"type":"string","title":"Message"},"request_id":{"type":"string","title":"Request Id"}},"additionalProperties":false,"type":"object","required":["code","message","request_id"],"title":"ErrorDetail"},"ErrorEnvelope":{"properties":{"error":{"$ref":"#/components/schemas/ErrorDetail"}},"additionalProperties":false,"type":"object","required":["error"],"title":"ErrorEnvelope"},"EstimateResponse":{"properties":{"model":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Model"},"input_tokens":{"type":"integer","minimum":0.0,"title":"Input Tokens"},"estimated_cost_usd":{"type":"string","pattern":"^\\d+\\.\\d{9}$","title":"Estimated Cost Usd"},"metering_version":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Metering Version"},"pricing_version":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Pricing Version"}},"additionalProperties":false,"type":"object","required":["model","input_tokens","estimated_cost_usd","metering_version","pricing_version"],"title":"EstimateResponse"},"ExpiringGrant":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"amount_usd":{"type":"string","pattern":"^\\d+\\.\\d{9}$","title":"Amount Usd"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"}},"additionalProperties":false,"type":"object","required":["id","amount_usd","expires_at"],"title":"ExpiringGrant"},"JsonValue":{},"ModelsResponse":{"properties":{"default":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default"},"models":{"items":{"$ref":"#/components/schemas/PublicModel"},"type":"array","title":"Models"}},"additionalProperties":false,"type":"object","required":["default","models"],"title":"ModelsResponse"},"Option":{"properties":{"id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Id"},"description":{"type":"string","maxLength":262144,"minLength":1,"title":"Description"}},"additionalProperties":false,"type":"object","required":["id","description"],"title":"Option"},"OptionProbability":{"properties":{"id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Id"},"probability":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Probability"}},"additionalProperties":false,"type":"object","required":["id","probability"],"title":"OptionProbability"},"Page_UsageRecord_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/UsageRecord"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"additionalProperties":false,"type":"object","required":["items","next_cursor"],"title":"Page[UsageRecord]"},"PredictionInput":{"properties":{"model":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Model","default":"default"},"context":{"anyOf":[{"type":"string"},{"additionalProperties":{"$ref":"#/components/schemas/JsonValue"},"type":"object"}],"title":"Context"},"questions":{"items":{"oneOf":[{"$ref":"#/components/schemas/BinaryQuestion"},{"$ref":"#/components/schemas/ChoiceQuestion"},{"$ref":"#/components/schemas/ScoreQuestion"}],"discriminator":{"propertyName":"type","mapping":{"binary":"#/components/schemas/BinaryQuestion","choice":"#/components/schemas/ChoiceQuestion","score":"#/components/schemas/ScoreQuestion"}}},"type":"array","maxItems":16,"minItems":1,"title":"Questions"}},"additionalProperties":false,"type":"object","required":["context","questions"],"title":"PredictionInput"},"PredictionResponse":{"properties":{"request_id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Request Id"},"model":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Model"},"answers":{"items":{"oneOf":[{"$ref":"#/components/schemas/BinaryAnswer"},{"$ref":"#/components/schemas/ChoiceAnswer"},{"$ref":"#/components/schemas/ScoreAnswer"}],"discriminator":{"propertyName":"type","mapping":{"binary":"#/components/schemas/BinaryAnswer","choice":"#/components/schemas/ChoiceAnswer","score":"#/components/schemas/ScoreAnswer"}}},"type":"array","title":"Answers"},"usage":{"$ref":"#/components/schemas/Usage"}},"additionalProperties":false,"type":"object","required":["request_id","model","answers","usage"],"title":"PredictionResponse"},"PublicModel":{"properties":{"id":{"type":"string","title":"Id"},"simulated":{"type":"boolean","title":"Simulated"},"capabilities":{"items":{"type":"string","enum":["binary","choice","score"]},"type":"array","title":"Capabilities"},"limits":{"additionalProperties":{"type":"integer"},"type":"object","title":"Limits"},"metering_version":{"type":"string","title":"Metering Version"},"pricing_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pricing Version"},"price_usd_per_million_input_tokens":{"type":"string","pattern":"^\\d+\\.\\d{9}$","title":"Price Usd Per Million Input Tokens"},"score":{"$ref":"#/components/schemas/ScoreSemantics"}},"additionalProperties":false,"type":"object","required":["id","simulated","capabilities","limits","metering_version","pricing_version","price_usd_per_million_input_tokens","score"],"title":"PublicModel"},"ScoreAnswer":{"properties":{"id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Id"},"type":{"type":"string","const":"score","title":"Type","default":"score"},"value":{"type":"number","title":"Value"}},"additionalProperties":false,"type":"object","required":["id","value"],"title":"ScoreAnswer"},"ScoreQuestion":{"properties":{"id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Id"},"prompt":{"type":"string","maxLength":262144,"minLength":1,"title":"Prompt"},"type":{"type":"string","const":"score","title":"Type"},"levels":{"items":{"type":"string","maxLength":262144,"minLength":1},"type":"array","maxItems":10,"minItems":2,"title":"Levels"}},"additionalProperties":false,"type":"object","required":["id","prompt","type","levels"],"title":"ScoreQuestion"},"ScoreSemantics":{"properties":{"semantics":{"type":"string","title":"Semantics"},"minimum":{"anyOf":[{"type":"integer"},{"type":"number"}],"title":"Minimum"},"maximum":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"string"}],"title":"Maximum"}},"additionalProperties":false,"type":"object","required":["semantics","minimum","maximum"],"title":"ScoreSemantics"},"Usage":{"properties":{"input_tokens":{"type":"integer","minimum":0.0,"title":"Input Tokens"},"cost_usd":{"type":"string","pattern":"^\\d+\\.\\d{9}$","title":"Cost Usd"},"metering_version":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Metering Version"},"pricing_version":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_.-]+$","title":"Pricing Version"}},"additionalProperties":false,"type":"object","required":["input_tokens","cost_usd","metering_version","pricing_version"],"title":"Usage"},"UsageRecord":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"request_id":{"type":"string","title":"Request Id"},"model":{"type":"string","title":"Model"},"question_count":{"type":"integer","minimum":0.0,"title":"Question Count"},"input_tokens":{"type":"integer","minimum":0.0,"title":"Input Tokens"},"status":{"type":"string","title":"Status"},"charge_usd":{"type":"string","pattern":"^\\d+\\.\\d{9}$","title":"Charge Usd"},"pricing_version":{"type":"string","title":"Pricing Version"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At"}},"additionalProperties":false,"type":"object","required":["id","request_id","model","question_count","input_tokens","status","charge_usd","pricing_version","created_at","completed_at"],"title":"UsageRecord"}},"securitySchemes":{"APIKey":{"type":"http","scheme":"bearer"}}},"security":[{"APIKey":[]}]}