### GET /replays Source: https://aigateway.sh/openapi.json API endpoint for GET /replays ```markdown ### Responses #### 200 - Replay list Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/replays" ``` ``` -------------------------------- ### GET /files Source: https://aigateway.sh/openapi.json API endpoint for GET /files ```markdown ### Parameters - **purpose** (string, query, optional) ### Responses #### 200 - File list Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/files?purpose=string" ``` ``` -------------------------------- ### GET /models Source: https://aigateway.sh/openapi.json API endpoint for GET /models ```markdown ### Parameters - **modality** (string (text|image|audio-stt|audio-tts|video|embedding|rerank|moderation), query, optional) - **provider** (string, query, optional) (example: "anthropic") ### Responses #### 200 - OpenAI-shaped model list with pricing + capabilities Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/models?modality=text&provider=anthropic" ``` ``` -------------------------------- ### GET /files/jobs/{jobId}/{filename}/signed Source: https://aigateway.sh/openapi.json Returns a publicly fetchable URL on media.aigateway.sh, valid until expires_at. Max expiry 7 days. ```markdown ### Parameters - **jobId** (string, path, required) - **filename** (string, path, required) - **expires_in** (integer, query, optional) ### Responses #### 200 - Signed URL - **url** (string) - **expires_at** (integer) ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/files/jobs/{jobId}/{filename}/signed?expires_in=3600" ``` ``` -------------------------------- ### GET /balance Source: https://aigateway.sh/openapi.json API endpoint for GET /balance ```markdown ### Responses #### 200 - Balance - **cents** (integer) - **usd** (number) ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/balance" ``` ``` -------------------------------- ### GET /replays/{id} Source: https://aigateway.sh/openapi.json API endpoint for GET /replays/{id} ```markdown ### Parameters - **id** (string, path, required) ### Responses #### 200 - Replay record Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/replays/{id}" ``` ``` -------------------------------- ### GET /files/{id} Source: https://aigateway.sh/openapi.json API endpoint for GET /files/{id} ```markdown ### Parameters - **id** (string, path, required) ### Responses #### 200 - File metadata Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/files/{id}" ``` ``` -------------------------------- ### GET /realtime Source: https://aigateway.sh/openapi.json WebSocket endpoint (connect with wss://). URL: wss://api.aigateway.sh/v1/realtime?model=deepgram/nova-3&encoding=linear16&sample_rate=16000&interim_results=true. Auth via ?api_key= (browsers) or Authorization: Bearer (servers). Stream raw audio frames; receive {type:"Results",...} messages then a final {type:"Metadata"}. End with {"type":"CloseStream"}. Billed per audio-minute. Models: deepgram/nova-3, deepgram/flux. ```markdown ### Responses #### 101 - Switching Protocols — WebSocket established Switching Protocols — WebSocket established #### 426 - Upgrade Required — connect with wss:// Upgrade Required — connect with wss:// ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/realtime" ``` ``` -------------------------------- ### GET /batches Source: https://aigateway.sh/openapi.json API endpoint for GET /batches ```markdown ### Parameters - **limit** (integer, query, optional) ### Responses #### 200 - Batch list Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/batches?limit=20" ``` ``` -------------------------------- ### POST /audio/transcriptions Source: https://aigateway.sh/openapi.json Synchronous by default. Set async:true (then poll GET /v1/jobs/{id}) or pass a webhook_url to run as a batch job — best for long recordings (Deepgram Nova 3 / Flux). For live transcription, open the WebSocket at /v1/realtime. ```markdown ### Request Body **Content-Type:** multipart/form-data - **model** (string) (required) (example: "deepgram/nova-3") - **file** (string (binary)) (required) - **language** (string) - **async** (boolean): Run as an async job; returns 202 with a job id. - **webhook_url** (string (uri)): POST the signed result here when ready (implies async). **Content-Type:** application/json - **model** (string) (required) (example: "deepgram/nova-3") - **audio_url** (string (uri)) (required) - **language** (string) - **async** (boolean): Run as an async job; returns 202 with a job id. - **webhook_url** (string (uri)): POST the signed result here when ready (implies async). ### Responses #### 200 - Transcription result (sync) Empty response body #### 202 - Accepted — async job created; poll GET /v1/jobs/{id} or await the webhook Empty response body ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/audio/transcriptions" \ -H "Content-Type: application/json" \ -d '{ "model": "deepgram/nova-3", "file": "string", "language": "string", "async": "true", "webhook_url": "string" }' ``` ``` -------------------------------- ### GET /usage/by-tag Source: https://aigateway.sh/openapi.json API endpoint for GET /usage/by-tag ```markdown ### Parameters - **month** (string, query, optional) (example: "2026-04") ### Responses #### 200 - Aggregated usage per tag Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/usage/by-tag?month=2026-04" ``` ``` -------------------------------- ### GET /files/{id}/content Source: https://aigateway.sh/openapi.json API endpoint for GET /files/{id}/content ```markdown ### Parameters - **id** (string, path, required) ### Responses #### 200 - Raw file bytes Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/files/{id}/content" ``` ``` -------------------------------- ### GET /usage/by-sub-account Source: https://aigateway.sh/openapi.json API endpoint for GET /usage/by-sub-account ```markdown ### Parameters - **month** (string, query, optional) (example: "2026-04") ### Responses #### 200 - Aggregated usage per customer Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/usage/by-sub-account?month=2026-04" ``` ``` -------------------------------- ### POST /videos/generations Source: https://aigateway.sh/openapi.json Returns 202 with a job id. Poll GET /jobs/{id} or pass webhook_url. ```markdown ### Request Body **Content-Type:** application/json - **prompt** (string) (required) - **model** (string) - **duration** (number) - **aspect_ratio** (string) - **resolution** (string) - **image_url** (string (uri)) - **webhook_url** (string (uri)) ### Responses #### 202 - Job accepted **JobAccepted** - **id** (string) (required) (example: "job_abc123") - **status** (string (queued)) (required) ("queued") - **object** (string (job)) (required) ("job") ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/videos/generations" \ -H "Content-Type: application/json" \ -d '{ "prompt": "string", "model": "string", "duration": "0", "aspect_ratio": "string", "resolution": "string", "image_url": "string", "webhook_url": "string" }' ``` ``` -------------------------------- ### GET /models/{id} Source: https://aigateway.sh/openapi.json API endpoint for GET /models/{id} ```markdown ### Parameters - **id** (string, path, required) (example: "anthropic/claude-opus-4.7") ### Responses #### 200 - Single-model record Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/models/{id}" ``` ``` -------------------------------- ### GET /evals Source: https://aigateway.sh/openapi.json API endpoint for GET /evals ```markdown ### Responses #### 200 - Eval list Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/evals" ``` ``` -------------------------------- ### GET /sub-accounts Source: https://aigateway.sh/openapi.json API endpoint for GET /sub-accounts ```markdown ### Responses #### 200 - Sub-account list Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/sub-accounts" ``` ``` -------------------------------- ### GET /jobs/{id} Source: https://aigateway.sh/openapi.json API endpoint for GET /jobs/{id} ```markdown ### Parameters - **id** (string, path, required) ### Responses #### 200 - Job status + result **Job** - **id** (string) (required) - **status** (string (queued|processing|completed|failed)) (required) ("queued"|"processing"|"completed"|"failed") - **modality** (string) - **model** (string) - **created_at** (integer) - **updated_at** (integer) - **error** (object) - **message** (string) - **code** (string) - **result_file_id** (string) - **result_url** (string (uri)) - **webhook_url** (string (uri)) - **webhook_delivered** (boolean) - **attempts** (integer) ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/jobs/{id}" ``` ``` -------------------------------- ### GET /health/providers Source: https://aigateway.sh/openapi.json API endpoint for GET /health/providers ```markdown ### Responses #### 200 - p50, p95, error rate per upstream Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/health/providers" ``` ``` -------------------------------- ### GET /batches/{id} Source: https://aigateway.sh/openapi.json API endpoint for GET /batches/{id} ```markdown ### Parameters - **id** (string, path, required) ### Responses #### 200 - Batch record Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/batches/{id}" ``` ``` -------------------------------- ### GET /webhook-secret Source: https://aigateway.sh/openapi.json API endpoint for GET /webhook-secret ```markdown ### Responses #### 200 - Signing secret Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/webhook-secret" ``` ``` -------------------------------- ### GET /sub-accounts/{id} Source: https://aigateway.sh/openapi.json API endpoint for GET /sub-accounts/{id} ```markdown ### Parameters - **id** (string, path, required) ### Responses #### 200 - Sub-account record Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/sub-accounts/{id}" ``` ``` -------------------------------- ### GET /evals/{id} Source: https://aigateway.sh/openapi.json API endpoint for GET /evals/{id} ```markdown ### Parameters - **id** (string, path, required) ### Responses #### 200 - Eval result + winner_model Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/evals/{id}" ``` ``` -------------------------------- ### GET /sub-accounts/{id}/usage Source: https://aigateway.sh/openapi.json API endpoint for GET /sub-accounts/{id}/usage ```markdown ### Parameters - **id** (string, path, required) - **month** (string, query, optional) (example: "2026-04") ### Responses #### 200 - Usage report Empty response body ### Example Usage ```bash curl -X GET "https://api.aigateway.sh/v1/sub-accounts/{id}/usage?month=2026-04" ``` ``` -------------------------------- ### POST /chat/completions Source: https://aigateway.sh/openapi.json Drop-in replacement for OpenAI's /v1/chat/completions. Supports streaming via SSE, tool calling, vision, JSON mode, and reasoning models with normalized `reasoning_content` deltas. Set `model:"auto"` (or `auto/text`, or omit it) to use the Auto Router; bias the pick with the `x-routing` header and cap cost with `baseline_model`. Routed responses return `X-Routing-*` and `X-Auto-*` headers showing the selected model and dollars saved. ```markdown ### Request Body **Content-Type:** application/json - **model** (string) (required): Provider-qualified slug, or "auto" / "auto/" to let the Auto Router pick the cheapest model in a curated pool that clears the quality floor (never above your baseline). Featured: anthropic/claude-opus-4.8, minimax/m3, google/gemini-3.1-pro, anthropic/claude-sonnet-4.6, openai/gpt-5.5, google/gemini-2.5-pro, moonshot/kimi-k2.6, xai/grok-4.20-multi-agent-0309, openai/gpt-5.4-mini, alibaba/qwen3.5-397b-a17b. Fetch full list from /models. Catalog: 1000+. (example: "anthropic/claude-opus-4.8") - **baseline_model** (string): Auto Router only: the model you'd otherwise call. The router routes DOWN from it, so it doubles as a hard cost ceiling — you never pay more than calling it directly. Defaults to the premium model for the modality. Used only when model is "auto" / "auto/" or omitted. (example: "anthropic/claude-opus-4.8") - **messages** (array (object)) (required) Array items: - **role** (string (system|user|assistant|tool)) (required) ("system"|"user"|"assistant"|"tool") - **content** (string) (required) - **stream** (boolean) - **temperature** (number) - **max_tokens** (integer) - **tools** (array) - **tool_choice** (string) - **response_format** (object) - **webhook_url** (string (uri)): If set, delivery flips to async-job mode (202 + signed callback) ### Responses #### 200 - Chat completion (SSE if stream=true) Empty response body #### 400 - response - **error** (object) (required) - **message** (string) (required) - **type** (string (invalid_request_error|authentication_error|budget_exceeded|model_not_found|rate_limit_error|provider_error|timeout_error)) (required) ("invalid_request_error"|"authentication_error"|"budget_exceeded"|"model_not_found"|"rate_limit_error"|"provider_error"|"timeout_error") - **code** (integer) #### 401 - response - **error** (object) (required) - **message** (string) (required) - **type** (string (invalid_request_error|authentication_error|budget_exceeded|model_not_found|rate_limit_error|provider_error|timeout_error)) (required) ("invalid_request_error"|"authentication_error"|"budget_exceeded"|"model_not_found"|"rate_limit_error"|"provider_error"|"timeout_error") - **code** (integer) #### 402 - response - **error** (object) (required) - **message** (string) (required) - **type** (string (invalid_request_error|authentication_error|budget_exceeded|model_not_found|rate_limit_error|provider_error|timeout_error)) (required) ("invalid_request_error"|"authentication_error"|"budget_exceeded"|"model_not_found"|"rate_limit_error"|"provider_error"|"timeout_error") - **code** (integer) #### 404 - response - **error** (object) (required) - **message** (string) (required) - **type** (string (invalid_request_error|authentication_error|budget_exceeded|model_not_found|rate_limit_error|provider_error|timeout_error)) (required) ("invalid_request_error"|"authentication_error"|"budget_exceeded"|"model_not_found"|"rate_limit_error"|"provider_error"|"timeout_error") - **code** (integer) #### 429 - response - **error** (object) (required) - **message** (string) (required) - **type** (string (invalid_request_error|authentication_error|budget_exceeded|model_not_found|rate_limit_error|provider_error|timeout_error)) (required) ("invalid_request_error"|"authentication_error"|"budget_exceeded"|"model_not_found"|"rate_limit_error"|"provider_error"|"timeout_error") - **code** (integer) ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/chat/completions" \ -H "Content-Type: application/json" \ -d '{ "model": "anthropic/claude-opus-4.8", "baseline_model": "anthropic/claude-opus-4.8", "messages": [ { "role": "system", "content": "value" } ], "stream": "false", "temperature": "0", "max_tokens": "0", "tools": "item1,item2", "tool_choice": "value", "response_format": "value", "webhook_url": "string" }' ``` ``` -------------------------------- ### POST /batches Source: https://aigateway.sh/openapi.json Submits a JSONL file (uploaded via /files with purpose=batch) for batched inference at 50% off. SLA 24h. ```markdown ### Request Body **Content-Type:** application/json - **input_file_id** (string) (required) - **endpoint** (string) (required) (example: "/v1/chat/completions") ### Responses #### 200 - Batch record **Batch** - **id** (string) - **object** (string (batch)) ("batch") - **endpoint** (string) - **input_file_id** (string) - **completion_window** (string) (example: "24h") - **status** (string (validating|queued|in_progress|finalizing|completed|failed|expired)) ("validating"|"queued"|"in_progress"|"finalizing"|"completed"|"failed"|"expired") - **output_file_id** (string) - **error_file_id** (string) - **request_counts** (object) - **processing** (integer) - **completed** (integer) - **failed** (integer) - **created_at** (integer) - **expires_at** (integer) - **completed_at** (integer) ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/batches" \ -H "Content-Type: application/json" \ -d '{ "input_file_id": "string", "endpoint": "/v1/chat/completions" }' ``` ``` -------------------------------- ### Schema: File Source: https://aigateway.sh/openapi.json Schema definition for File ```markdown ## Schema: File Schema definition for File **Type:** object - **id** (string) (example: "file-abc") - **object** (string (file)) ("file") - **bytes** (integer) - **created_at** (integer) - **filename** (string) - **purpose** (string) ``` -------------------------------- ### POST /sub-accounts Source: https://aigateway.sh/openapi.json Mints a scoped key for one of your end customers. Spend cap, RPM, default tag, isolated analytics. ```markdown ### Request Body **Content-Type:** application/json - **name** (string) (required) - **external_ref** (string) - **spend_cap_cents** (integer) (required) - **rate_limit_rpm** (integer) - **default_tag** (string) ### Responses #### 200 - Sub-account record (key shown once) Empty response body ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/sub-accounts" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "external_ref": "string", "spend_cap_cents": "0", "rate_limit_rpm": "0", "default_tag": "string" }' ``` ``` -------------------------------- ### POST /audio/music Source: https://aigateway.sh/openapi.json API endpoint for POST /audio/music ```markdown ### Request Body **Content-Type:** application/json - **prompt** (string) (required) - **model** (string) - **duration** (number) - **aspect_ratio** (string) - **resolution** (string) - **image_url** (string (uri)) - **webhook_url** (string (uri)) ### Responses #### 202 - Job accepted **JobAccepted** - **id** (string) (required) (example: "job_abc123") - **status** (string (queued)) (required) ("queued") - **object** (string (job)) (required) ("job") ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/audio/music" \ -H "Content-Type: application/json" \ -d '{ "prompt": "string", "model": "string", "duration": "0", "aspect_ratio": "string", "resolution": "string", "image_url": "string", "webhook_url": "string" }' ``` ``` -------------------------------- ### Schema: Batch Source: https://aigateway.sh/openapi.json Schema definition for Batch ```markdown ## Schema: Batch Schema definition for Batch **Type:** object - **id** (string) - **object** (string (batch)) ("batch") - **endpoint** (string) - **input_file_id** (string) - **completion_window** (string) (example: "24h") - **status** (string (validating|queued|in_progress|finalizing|completed|failed|expired)) ("validating"|"queued"|"in_progress"|"finalizing"|"completed"|"failed"|"expired") - **output_file_id** (string) - **error_file_id** (string) - **request_counts** (object) - **processing** (integer) - **completed** (integer) - **failed** (integer) - **created_at** (integer) - **expires_at** (integer) - **completed_at** (integer) ``` -------------------------------- ### POST /files Source: https://aigateway.sh/openapi.json API endpoint for POST /files ```markdown ### Request Body **Content-Type:** multipart/form-data - **file** (string (binary)) (required) - **purpose** (string (batch|batch_output|fine-tune|assistants)) (required) ("batch"|"batch_output"|"fine-tune"|"assistants") ### Responses #### 200 - File metadata **File** - **id** (string) (example: "file-abc") - **object** (string (file)) ("file") - **bytes** (integer) - **created_at** (integer) - **filename** (string) - **purpose** (string) ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/files" \ -H "Content-Type: application/json" \ -d '{ "file": "string", "purpose": "batch" }' ``` ``` -------------------------------- ### POST /replays Source: https://aigateway.sh/openapi.json API endpoint for POST /replays ```markdown ### Request Body **Content-Type:** application/json - **source_request_id** (string) (required) - **target_model** (string) (required) - **shadow** (boolean) ### Responses #### 200 - Side-by-side cost / latency / output diff Empty response body ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/replays" \ -H "Content-Type: application/json" \ -d '{ "source_request_id": "string", "target_model": "string", "shadow": "false" }' ``` ``` -------------------------------- ### API Overview: AIgateway Source: https://aigateway.sh/openapi.json OpenAI-compatible endpoints for chat, embeddings, images, audio, video, translation, classification, OCR, rerank, moderation, plus aggregator-native primitives (sub-accounts, evals, replays, batches, files, signed URLs, webhooks). Catalog: 1000+ models across 85+ labs. Change `base_url` on the OpenAI SDK to https://api.aigateway.sh/v1 and every existing integration works. ```yaml # AIgateway # Version: 1 OpenAI-compatible endpoints for chat, embeddings, images, audio, video, translation, classification, OCR, rerank, moderation, plus aggregator-native primitives (sub-accounts, evals, replays, batches, files, signed URLs, webhooks). Catalog: 1000+ models across 85+ labs. Change `base_url` on the OpenAI SDK to https://api.aigateway.sh/v1 and every existing integration works. # Base URL: https://api.aigateway.sh/v1 ``` -------------------------------- ### Schema: AsyncJobRequest Source: https://aigateway.sh/openapi.json Schema definition for AsyncJobRequest ```markdown ## Schema: AsyncJobRequest Schema definition for AsyncJobRequest **Type:** object - **prompt** (string) (required) - **model** (string) - **duration** (number) - **aspect_ratio** (string) - **resolution** (string) - **image_url** (string (uri)) - **webhook_url** (string (uri)) ``` -------------------------------- ### POST /evals Source: https://aigateway.sh/openapi.json Run an eval across candidate models on your dataset. Returns an id you can use as `model: 'eval:'` to always route to the current winner. ```markdown ### Request Body **Content-Type:** application/json - **name** (string) (required) - **candidate_models** (array (string)) (required) - **dataset** (array (object)) (required) - **metric** (string (quality|cost|speed)) (required) ("quality"|"cost"|"speed") ### Responses #### 200 - Eval run started Empty response body ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/evals" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "candidate_models": [ "string" ], "dataset": [ "value" ], "metric": "quality" }' ``` ``` -------------------------------- ### POST /audio/speech Source: https://aigateway.sh/openapi.json API endpoint for POST /audio/speech ```markdown ### Request Body **Content-Type:** application/json - **model** (string) (required) (example: "deepgram/aura-2-en") - **input** (string) (required) - **voice** (string) - **response_format** (string (mp3|opus|aac|flac)) ("mp3"|"opus"|"aac"|"flac") ### Responses #### 200 - Audio binary stream Empty response body ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/audio/speech" \ -H "Content-Type: application/json" \ -d '{ "model": "deepgram/aura-2-en", "input": "string", "voice": "string", "response_format": "mp3" }' ``` ``` -------------------------------- ### POST /detections Source: https://aigateway.sh/openapi.json API endpoint for POST /detections ```markdown ### Request Body **Content-Type:** application/json - **image_url** (string (uri)) - **image_b64** (string) - **model** (string) (example: "facebook/detr-resnet-50") ### Responses #### 200 - Bounding boxes + labels Empty response body ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/detections" \ -H "Content-Type: application/json" \ -d '{ "image_url": "string", "image_b64": "string", "model": "facebook/detr-resnet-50" }' ``` ``` -------------------------------- ### Schema: WebhookEvent Source: https://aigateway.sh/openapi.json Schema definition for WebhookEvent ```markdown ## Schema: WebhookEvent Schema definition for WebhookEvent **Type:** object - **id** (string) (required) (example: "evt_01jx...") - **type** (string (job.completed|job.failed|balance.low|balance.exhausted|usage.threshold.exceeded|usage.daily.summary|subaccount.created|subaccount.spend.exceeded|model.added|model.deprecated|key.rotated)) (required) ("job.completed"|"job.failed"|"balance.low"|"balance.exhausted"|"usage.threshold.exceeded"|"usage.daily.summary"|"subaccount.created"|"subaccount.spend.exceeded"|"model.added"|"model.deprecated"|"key.rotated") - **occurred_at** (integer) (required): Unix seconds - **data** (object) (required): Event-type-specific payload ``` -------------------------------- ### POST /budgets Source: https://aigateway.sh/openapi.json API endpoint for POST /budgets ```markdown ### Request Body **Content-Type:** application/json - **tag** (string) (required) - **cap_cents** (integer) (required) ### Responses #### 200 - Budget created Empty response body ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/budgets" \ -H "Content-Type: application/json" \ -d '{ "tag": "string", "cap_cents": "0" }' ``` ``` -------------------------------- ### Schema: Job Source: https://aigateway.sh/openapi.json Schema definition for Job ```markdown ## Schema: Job Schema definition for Job **Type:** object - **id** (string) (required) - **status** (string (queued|processing|completed|failed)) (required) ("queued"|"processing"|"completed"|"failed") - **modality** (string) - **model** (string) - **created_at** (integer) - **updated_at** (integer) - **error** (object) - **message** (string) - **code** (string) - **result_file_id** (string) - **result_url** (string (uri)) - **webhook_url** (string (uri)) - **webhook_delivered** (boolean) - **attempts** (integer) ``` -------------------------------- ### DELETE /cache Source: https://aigateway.sh/openapi.json Drops every entry in the exact-match KV cache and the semantic Vectorize cache for the authenticated account. ```markdown ### Responses #### 200 - Purged Empty response body ### Example Usage ```bash curl -X DELETE "https://api.aigateway.sh/v1/cache" ``` ``` -------------------------------- ### POST /3d/generations Source: https://aigateway.sh/openapi.json API endpoint for POST /3d/generations ```markdown ### Request Body **Content-Type:** application/json - **prompt** (string) (required) - **model** (string) - **duration** (number) - **aspect_ratio** (string) - **resolution** (string) - **image_url** (string (uri)) - **webhook_url** (string (uri)) ### Responses #### 202 - Job accepted **JobAccepted** - **id** (string) (required) (example: "job_abc123") - **status** (string (queued)) (required) ("queued") - **object** (string (job)) (required) ("job") ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/3d/generations" \ -H "Content-Type: application/json" \ -d '{ "prompt": "string", "model": "string", "duration": "0", "aspect_ratio": "string", "resolution": "string", "image_url": "string", "webhook_url": "string" }' ``` ``` -------------------------------- ### Schema: JobAccepted Source: https://aigateway.sh/openapi.json Schema definition for JobAccepted ```markdown ## Schema: JobAccepted Schema definition for JobAccepted **Type:** object - **id** (string) (required) (example: "job_abc123") - **status** (string (queued)) (required) ("queued") - **object** (string (job)) (required) ("job") ``` -------------------------------- ### POST /moderations Source: https://aigateway.sh/openapi.json API endpoint for POST /moderations ```markdown ### Request Body **Content-Type:** application/json - **model** (string) (example: "meta/llama-guard-3-8b") - **input** (string) (required) ### Responses #### 200 - Per-category safety flags Empty response body ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/moderations" \ -H "Content-Type: application/json" \ -d '{ "model": "meta/llama-guard-3-8b", "input": "value" }' ``` ``` -------------------------------- ### DELETE /files/{id} Source: https://aigateway.sh/openapi.json API endpoint for DELETE /files/{id} ```markdown ### Parameters - **id** (string, path, required) ### Responses #### 200 - Deleted Empty response body ### Example Usage ```bash curl -X DELETE "https://api.aigateway.sh/v1/files/{id}" ``` ``` -------------------------------- ### Schema: ChatCompletionRequest Source: https://aigateway.sh/openapi.json Schema definition for ChatCompletionRequest ```markdown ## Schema: ChatCompletionRequest Schema definition for ChatCompletionRequest **Type:** object - **model** (string) (required): Provider-qualified slug, or "auto" / "auto/" to let the Auto Router pick the cheapest model in a curated pool that clears the quality floor (never above your baseline). Featured: anthropic/claude-opus-4.8, minimax/m3, google/gemini-3.1-pro, anthropic/claude-sonnet-4.6, openai/gpt-5.5, google/gemini-2.5-pro, moonshot/kimi-k2.6, xai/grok-4.20-multi-agent-0309, openai/gpt-5.4-mini, alibaba/qwen3.5-397b-a17b. Fetch full list from /models. Catalog: 1000+. (example: "anthropic/claude-opus-4.8") - **baseline_model** (string): Auto Router only: the model you'd otherwise call. The router routes DOWN from it, so it doubles as a hard cost ceiling — you never pay more than calling it directly. Defaults to the premium model for the modality. Used only when model is "auto" / "auto/" or omitted. (example: "anthropic/claude-opus-4.8") - **messages** (array (object)) (required) Array items: - **role** (string (system|user|assistant|tool)) (required) ("system"|"user"|"assistant"|"tool") - **content** (string) (required) - **stream** (boolean) - **temperature** (number) - **max_tokens** (integer) - **tools** (array) - **tool_choice** (string) - **response_format** (object) - **webhook_url** (string (uri)): If set, delivery flips to async-job mode (202 + signed callback) ``` -------------------------------- ### POST /embeddings Source: https://aigateway.sh/openapi.json API endpoint for POST /embeddings ```markdown ### Request Body **Content-Type:** application/json - **model** (string) (required) (example: "baai/bge-m3") - **input** (string) (required) ### Responses #### 200 - Embedding vectors Empty response body ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/embeddings" \ -H "Content-Type: application/json" \ -d '{ "model": "baai/bge-m3", "input": "value" }' ``` ``` -------------------------------- ### POST /rerank Source: https://aigateway.sh/openapi.json API endpoint for POST /rerank ```markdown ### Request Body **Content-Type:** application/json - **query** (string) (required) - **documents** (array (string)) (required) - **model** (string) (example: "baai/bge-reranker-base") ### Responses #### 200 - Documents ordered by relevance Empty response body ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/rerank" \ -H "Content-Type: application/json" \ -d '{ "query": "string", "documents": [ "string" ], "model": "baai/bge-reranker-base" }' ``` ``` -------------------------------- ### POST /images/generations Source: https://aigateway.sh/openapi.json API endpoint for POST /images/generations ```markdown ### Request Body **Content-Type:** application/json - **model** (string) (required) (example: "black-forest-labs/flux-2-klein-9b") - **prompt** (string) (required) - **size** (string) (example: "1024x1024") - **quality** (string (standard|hd)) ("standard"|"hd") - **style** (string) - **response_format** (string (url|b64_json)) ("url"|"b64_json") - **n** (integer) ### Responses #### 200 - Image URL(s) or base64 Empty response body ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/images/generations" \ -H "Content-Type: application/json" \ -d '{ "model": "black-forest-labs/flux-2-klein-9b", "prompt": "string", "size": "1024x1024", "quality": "standard", "style": "string", "response_format": "url", "n": "1" }' ``` ``` -------------------------------- ### POST /webhook-secret/rotate Source: https://aigateway.sh/openapi.json API endpoint for POST /webhook-secret/rotate ```markdown ### Responses #### 200 - New secret Empty response body ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/webhook-secret/rotate" ``` ``` -------------------------------- ### POST /batches/{id}/cancel Source: https://aigateway.sh/openapi.json API endpoint for POST /batches/{id}/cancel ```markdown ### Parameters - **id** (string, path, required) ### Responses #### 200 - Cancelled Empty response body ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/batches/{id}/cancel" ``` ``` -------------------------------- ### Security: bearerAuth Source: https://aigateway.sh/openapi.json Security scheme: bearerAuth ```markdown ## Security: bearerAuth **Description:** Security scheme: bearerAuth **Type:** http **Scheme:** bearer **Bearer Format:** sk-aig-... ``` -------------------------------- ### POST /translations Source: https://aigateway.sh/openapi.json API endpoint for POST /translations ```markdown ### Request Body **Content-Type:** application/json - **text** (string) (required) - **source_lang** (string) (required) (example: "en") - **target_lang** (string) (required) (example: "fr") - **model** (string) (example: "meta/m2m100-1.2b") ### Responses #### 200 - Translated text Empty response body ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/translations" \ -H "Content-Type: application/json" \ -d '{ "text": "string", "source_lang": "en", "target_lang": "fr", "model": "meta/m2m100-1.2b" }' ``` ``` -------------------------------- ### POST /ocr Source: https://aigateway.sh/openapi.json API endpoint for POST /ocr ```markdown ### Request Body **Content-Type:** application/json - **image_url** (string (uri)) - **image_b64** (string) - **model** (string) (example: "microsoft/trocr-base-printed") ### Responses #### 200 - Extracted text Empty response body ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/ocr" \ -H "Content-Type: application/json" \ -d '{ "image_url": "string", "image_b64": "string", "model": "microsoft/trocr-base-printed" }' ``` ``` -------------------------------- ### PATCH /sub-accounts/{id} Source: https://aigateway.sh/openapi.json API endpoint for PATCH /sub-accounts/{id} ```markdown ### Parameters - **id** (string, path, required) ### Responses #### 200 - Updated record Empty response body ### Example Usage ```bash curl -X PATCH "https://api.aigateway.sh/v1/sub-accounts/{id}" ``` ``` -------------------------------- ### DELETE /jobs/{id} Source: https://aigateway.sh/openapi.json API endpoint for DELETE /jobs/{id} ```markdown ### Parameters - **id** (string, path, required) ### Responses #### 200 - Cancelled Empty response body ### Example Usage ```bash curl -X DELETE "https://api.aigateway.sh/v1/jobs/{id}" ``` ``` -------------------------------- ### POST /classifications Source: https://aigateway.sh/openapi.json API endpoint for POST /classifications ```markdown ### Request Body **Content-Type:** application/json - **input** (string) (required) - **model** (string) (example: "huggingface/distilbert-sst-2") ### Responses #### 200 - Label + score per input Empty response body ### Example Usage ```bash curl -X POST "https://api.aigateway.sh/v1/classifications" \ -H "Content-Type: application/json" \ -d '{ "input": "value", "model": "huggingface/distilbert-sst-2" }' ``` ``` -------------------------------- ### DELETE /sub-accounts/{id} Source: https://aigateway.sh/openapi.json API endpoint for DELETE /sub-accounts/{id} ```markdown ### Parameters - **id** (string, path, required) ### Responses #### 200 - Deleted Empty response body ### Example Usage ```bash curl -X DELETE "https://api.aigateway.sh/v1/sub-accounts/{id}" ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.