{"openapi":"3.1.0","info":{"title":"PineRouter API","version":"1","description":"PineRouter: one API key for every AI model. Docs: https://pinerouter.ai/docs/llms.txt"},"servers":[{"url":"https://pinerouter.ai"}],"security":[{"bearer":[]}],"paths":{"/v1/chat/completions":{"post":{"tags":["Chat"],"summary":"Chat Completions","description":"Creates a model response from a conversation. Streaming and non-streaming.\n\nCompatible with OpenAI's Chat Completions API.\n","operationId":"createchatcompletion","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","messages"],"properties":{"model":{"type":"string","description":"Model id","examples":["gpt-5-2"]},"messages":{"type":"array","items":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string","enum":["system","user","assistant","tool","developer"],"description":"Message role"},"content":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","image_url","input_audio","file","video_url"]},"text":{"type":"string"},"image_url":{"type":"object","properties":{"url":{"type":"string","description":"Image URL or base64"},"detail":{"type":"string","enum":["low","high","auto"]}}},"input_audio":{"type":"object","properties":{"data":{"type":"string","description":"Base64-encoded audio data"},"format":{"type":"string","enum":["wav","mp3"]}}},"file":{"type":"object","properties":{"filename":{"type":"string"},"file_data":{"type":"string"},"file_id":{"type":"string"}}},"video_url":{"type":"object","properties":{"url":{"type":"string"}}}}}}],"description":"Message content"},"name":{"type":"string","description":"Sender name"},"tool_calls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","examples":["function"]},"function":{"type":"object","properties":{"name":{"type":"string"},"arguments":{"type":"string"}}}}}},"tool_call_id":{"type":"string","description":"Tool call id (for tool role messages)"},"reasoning_content":{"type":"string","description":"Reasoning content"}}},"description":"Conversation messages"},"temperature":{"type":"number","minimum":0,"maximum":2,"default":1,"description":"Sampling temperature"},"top_p":{"type":"number","minimum":0,"maximum":1,"default":1,"description":"Nucleus sampling (top_p)"},"n":{"type":"integer","minimum":1,"default":1,"description":"Number of results"},"stream":{"type":"boolean","default":false,"description":"Stream the response"},"stream_options":{"type":"object","properties":{"include_usage":{"type":"boolean"}}},"stop":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Stop sequences"},"max_tokens":{"type":"integer","description":"Maximum tokens to generate"},"max_completion_tokens":{"type":"integer","description":"Maximum completion tokens"},"presence_penalty":{"type":"number","minimum":-2,"maximum":2,"default":0},"frequency_penalty":{"type":"number","minimum":-2,"maximum":2,"default":0},"logit_bias":{"type":"object","additionalProperties":{"type":"number"},"properties":{}},"user":{"type":"string"},"tools":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","examples":["function"]},"function":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"parameters":{"type":"object","description":"Parameters as a JSON Schema","properties":{}}}}}}},"tool_choice":{"oneOf":[{"type":"string","enum":["none","auto","required"]},{"type":"object","properties":{"type":{"type":"string"},"function":{"type":"object","properties":{"name":{"type":"string"}}}}}]},"response_format":{"type":"object","properties":{"type":{"type":"string","enum":["text","json_object","json_schema"]},"json_schema":{"type":"object","description":"JSON Schema definition","properties":{}}}},"seed":{"type":"integer"},"reasoning_effort":{"type":"string","enum":["low","medium","high"],"description":"Reasoning effort (for reasoning models)"},"modalities":{"type":"array","items":{"type":"string","enum":["text","audio"]}},"audio":{"type":"object","properties":{"voice":{"type":"string"},"format":{"type":"string"}}}}},"example":{"model":"gpt-5-2","messages":[{"role":"user","content":"Explain DNS in one sentence."}],"max_tokens":200}}}},"security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Response created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","examples":["chat.completion"]},"created":{"type":"integer"},"model":{"type":"string"},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"message":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string","enum":["system","user","assistant","tool","developer"],"description":"Message role"},"content":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","image_url","input_audio","file","video_url"]},"text":{"type":"string"},"image_url":{"type":"object","properties":{"url":{"type":"string","description":"Image URL or base64"},"detail":{"type":"string","enum":["low","high","auto"]}}},"input_audio":{"type":"object","properties":{"data":{"type":"string","description":"Base64-encoded audio data"},"format":{"type":"string","enum":["wav","mp3"]}}},"file":{"type":"object","properties":{"filename":{"type":"string"},"file_data":{"type":"string"},"file_id":{"type":"string"}}},"video_url":{"type":"object","properties":{"url":{"type":"string"}}}}}}],"description":"Message content"},"name":{"type":"string","description":"Sender name"},"tool_calls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","examples":["function"]},"function":{"type":"object","properties":{"name":{"type":"string"},"arguments":{"type":"string"}}}}}},"tool_call_id":{"type":"string","description":"Tool call id (for tool role messages)"},"reasoning_content":{"type":"string","description":"Reasoning content"}}},"finish_reason":{"type":"string","enum":["stop","length","tool_calls","content_filter"]}}}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer","description":"Prompt tokens"},"completion_tokens":{"type":"integer","description":"Completion tokens"},"total_tokens":{"type":"integer","description":"Total tokens"},"prompt_tokens_details":{"type":"object","properties":{"cached_tokens":{"type":"integer"},"text_tokens":{"type":"integer"},"audio_tokens":{"type":"integer"},"image_tokens":{"type":"integer"}}},"completion_tokens_details":{"type":"object","properties":{"text_tokens":{"type":"integer"},"audio_tokens":{"type":"integer"},"reasoning_tokens":{"type":"integer"}}}}},"system_fingerprint":{"type":"string"}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"type":{"type":"string","description":"Error type"},"param":{"type":["string","null"],"description":"Related parameters"},"code":{"type":["string","null"],"description":"Error code"}}}}}}}},"401":{"description":"Missing, wrong, disabled or expired key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"Invalid token (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"403":{"description":"Balance too low, or the key may not use this model or IP","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"This token has no access to model gpt-5-2 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"type":{"type":"string","description":"Error type"},"param":{"type":["string","null"],"description":"Related parameters"},"code":{"type":["string","null"],"description":"Error code"}}}}},"example":{"error":{"code":"","message":"You have reached the request limit: maximum 60 requests in 1 minutes (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","example":60}}}},"500":{"description":"Error on our side or the model's. Safe to retry with backoff.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"bad_response_status_code","message":"bad response status code 500 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error","param":""}}}}}}}},"/v1/responses":{"post":{"tags":["Chat"],"summary":"Responses","description":"OpenAI Responses API: creates a model response.\nSupports multi-turn conversations, tool calls and reasoning.\n","operationId":"createresponse","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model"],"properties":{"model":{"type":"string"},"input":{"description":"Input: a string or an array of messages","oneOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{}}}]},"instructions":{"type":"string"},"max_output_tokens":{"type":"integer"},"temperature":{"type":"number"},"top_p":{"type":"number"},"stream":{"type":"boolean"},"tools":{"type":"array","items":{"type":"object","properties":{}}},"tool_choice":{"oneOf":[{"type":"string"},{"type":"object","properties":{}}]},"reasoning":{"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high"]},"summary":{"type":"string"}}},"previous_response_id":{"type":"string"},"truncation":{"type":"string","enum":["auto","disabled"]}}},"example":{"model":"gpt-5-5","input":"Explain DNS in one sentence."}}}},"security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Response created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","examples":["response"]},"created_at":{"type":"integer"},"status":{"type":"string","enum":["completed","failed","in_progress","incomplete"]},"model":{"type":"string"},"output":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"status":{"type":"string"},"role":{"type":"string"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"text":{"type":"string"}}}}}}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer","description":"Prompt tokens"},"completion_tokens":{"type":"integer","description":"Completion tokens"},"total_tokens":{"type":"integer","description":"Total tokens"},"prompt_tokens_details":{"type":"object","properties":{"cached_tokens":{"type":"integer"},"text_tokens":{"type":"integer"},"audio_tokens":{"type":"integer"},"image_tokens":{"type":"integer"}}},"completion_tokens_details":{"type":"object","properties":{"text_tokens":{"type":"integer"},"audio_tokens":{"type":"integer"},"reasoning_tokens":{"type":"integer"}}}}}}}}}},"401":{"description":"Missing, wrong, disabled or expired key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"Invalid token (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"403":{"description":"Balance too low, or the key may not use this model or IP","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"This token has no access to model gpt-5-2 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"429":{"description":"Rate limit: 120 requests a minute per account, 60 of them successful","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"You have reached the request limit: maximum 60 requests in 1 minutes (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","example":60}}}},"500":{"description":"Error on our side or the model's. Safe to retry with backoff.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"bad_response_status_code","message":"bad response status code 500 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error","param":""}}}}}}}},"/v1/messages":{"post":{"tags":["Chat"],"summary":"Claude Messages","description":"A request in Anthropic's Claude Messages format.\nSend the `anthropic-version` header.\n","operationId":"createmessage","parameters":[{"name":"anthropic-version","in":"header","required":true,"description":"Anthropic API version","schema":{"type":"string","examples":["2023-06-01"]}},{"name":"x-api-key","in":"header","required":false,"description":"Anthropic API key (optional; a Bearer token also works)","schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","required":["model","messages","max_tokens"],"properties":{"model":{"type":"string","examples":["gpt-5-2"]},"messages":{"type":"array","items":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string","enum":["user","assistant"]},"content":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","image","tool_use","tool_result"]},"text":{"type":"string"},"source":{"type":"object","properties":{"type":{"type":"string","enum":["base64","url"]},"media_type":{"type":"string"},"data":{"type":"string"},"url":{"type":"string"}}},"id":{"type":"string"},"name":{"type":"string"},"input":{"type":"object","properties":{}},"tool_use_id":{"type":"string"},"content":{"type":"string"}}}}]}}}},"system":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{}}}]},"max_tokens":{"type":"integer","minimum":1},"temperature":{"type":"number","minimum":0,"maximum":1},"top_p":{"type":"number"},"top_k":{"type":"integer"},"stream":{"type":"boolean"},"stop_sequences":{"type":"array","items":{"type":"string"}},"tools":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"input_schema":{"type":"object","properties":{}}}}},"tool_choice":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["auto","any","tool"]},"name":{"type":"string"}}}]},"thinking":{"type":"object","properties":{"type":{"type":"string","enum":["enabled","disabled"]},"budget_tokens":{"type":"integer"}}},"metadata":{"type":"object","properties":{"user_id":{"type":"string"}}}}},"example":{"model":"gpt-5-2","max_tokens":200,"messages":[{"role":"user","content":"Explain DNS in one sentence."}]}}}},"security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Response created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","examples":["message"]},"role":{"type":"string","examples":["assistant"]},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"text":{"type":"string"}}}},"model":{"type":"string"},"stop_reason":{"type":"string","enum":["end_turn","max_tokens","stop_sequence","tool_use"]},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"},"cache_creation_input_tokens":{"type":"integer"},"cache_read_input_tokens":{"type":"integer"}}}}}}}},"401":{"description":"Missing, wrong, disabled or expired key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"Invalid token (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"403":{"description":"Balance too low, or the key may not use this model or IP","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"This token has no access to model gpt-5-2 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"429":{"description":"Rate limit: 120 requests a minute per account, 60 of them successful","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"You have reached the request limit: maximum 60 requests in 1 minutes (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","example":60}}}},"500":{"description":"Error on our side or the model's. Safe to retry with backoff.","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","example":"error"},"error":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"}},"required":["type","message"]}},"required":["type","error"]},"example":{"type":"error","error":{"type":"api_error","message":"bad response status code 500 (request id: 20261102053704107200635868d9d6m7EOL5JK)"}}}}}}}},"/v1/models":{"get":{"tags":["Models"],"summary":"List models","description":"Lists the models your key may use.\n\nThe format follows the request headers:\n- `x-api-key` and `anthropic-version` headers: Anthropic format\n- `x-goog-api-key` header or `key` query parameter: Gemini format\n- otherwise: OpenAI format\n","operationId":"listmodels","parameters":[{"name":"key","in":"query","required":false,"description":"API key, Google style (for the Gemini format)","schema":{"type":"string"}},{"name":"x-api-key","in":"header","required":false,"description":"API key, Anthropic style (for the Claude format)","schema":{"type":"string"}},{"name":"anthropic-version","in":"header","required":false,"description":"Anthropic API version","schema":{"type":"string","examples":["2023-06-01"]}},{"name":"x-goog-api-key","in":"header","required":false,"description":"API key, Google style (for the Gemini format)","schema":{"type":"string"}}],"security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Model list","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","examples":["list"]},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Model id","examples":["gpt-5-2"]},"object":{"type":"string","description":"Object type","examples":["model"]},"created":{"type":"integer","description":"Created at (Unix seconds)"},"owned_by":{"type":"string","description":"Model owner","examples":["openai"]}}}}}}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"type":{"type":"string","description":"Error type"},"param":{"type":["string","null"],"description":"Related parameters"},"code":{"type":["string","null"],"description":"Error code"}}}}},"example":{"error":{"code":"","message":"Invalid token (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"403":{"description":"Balance too low, or the key may not use this model or IP","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"This token has no access to model gpt-5-2 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"429":{"description":"Rate limit: 120 requests a minute per account, 60 of them successful","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"You have reached the request limit: maximum 60 requests in 1 minutes (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","example":60}}}},"500":{"description":"Error on our side or the model's. Safe to retry with backoff.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"bad_response_status_code","message":"bad response status code 500 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error","param":""}}}}}}}},"/v1/jobs":{"post":{"summary":"Start a job","description":"Starts a job on any image, video, audio or tool model. `input` takes the fields listed on the model's page; fields you leave out use their defaults. Files go in as public https links.","operationId":"createJob","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string","description":"Model id from the Models page.","example":"z-image"},"input":{"type":"object","description":"The model's fields, as listed on its page.","additionalProperties":true,"example":{"prompt":"A red paper boat on a calm lake","aspect_ratio":"1:1"}},"webhook_url":{"type":"string","format":"uri","description":"Optional public https URL. When the job succeeds or fails we POST the job to it, signed per the Standard Webhooks spec (webhook-id, webhook-timestamp, webhook-signature: HMAC-SHA256 with your API key as the secret). Retried after 1, 5, 15 and 60 minutes.","example":"https://your.app/hooks/jobs"}}},"example":{"model":"z-image","input":{"prompt":"A red paper boat on a calm lake","aspect_ratio":"1:1"}}}}},"responses":{"200":{"description":"Job started","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","example":200},"msg":{"type":"string","example":"success"},"data":{"type":"object","properties":{"id":{"type":"string","example":"task_abc123"},"status":{"type":"string","enum":["queued","running","succeeded","failed"],"example":"queued"},"taskId":{"type":"string","description":"Same as id (older name)."},"state":{"type":"string","description":"Older status name: waiting, queuing, generating, success, fail."}}}}}}}},"400":{"description":"Invalid request or refused by the content rules","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","example":400},"msg":{"type":"string"}}}}}},"401":{"description":"Missing, wrong, disabled or expired key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"Invalid token (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"403":{"description":"Balance too low, or the key may not use this model","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"The HTTP status again."},"msg":{"type":"string"},"data":{"type":"null"}},"required":["code","msg"]},"example":{"code":403,"msg":"This token has no access to model z-image","data":null}}}},"429":{"description":"Rate limit: 120 requests a minute per account, 60 of them successful","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"You have reached the request limit: maximum 60 requests in 1 minutes (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","example":60}}}},"500":{"description":"Error on our side or the model's. Safe to retry with backoff.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"The HTTP status again."},"msg":{"type":"string"},"data":{"type":"null"}},"required":["code","msg"]},"example":{"code":500,"msg":"Task request failed","data":null}}}}}}},"/v1/jobs/{taskId}":{"get":{"summary":"Get a job","description":"Status and result of a job. Poll every 3 to 10 seconds until `data.state` is `success` or `fail`. On success, `data.resultJson` is a JSON string with `resultUrls`, the links to your files (kept for 7 days).","operationId":"getJob","parameters":[{"name":"taskId","in":"path","required":true,"schema":{"type":"string"},"description":"The `taskId` from Start a job.","example":"task_abc123"}],"responses":{"200":{"description":"Job status","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","example":200},"msg":{"type":"string","example":"success"},"data":{"type":"object","properties":{"id":{"type":"string","example":"task_abc123"},"model":{"type":"string","example":"z-image"},"status":{"type":"string","enum":["queued","running","succeeded","failed"],"example":"succeeded"},"outputs":{"type":"array","items":{"type":"string","format":"uri"},"description":"File links when status is succeeded. Kept 7 days.","example":["https://files.example.com/outputs/abc.png"]},"error":{"type":"string","description":"Why the job failed, when status is failed. A failed job costs nothing."},"taskId":{"type":"string","description":"Same as id (older name)."},"state":{"type":"string","description":"Older status name."},"resultJson":{"type":"string","description":"Older field: JSON string with resultUrls."},"failMsg":{"type":"string","description":"Older field: same as error."}}}}}}}},"401":{"description":"Missing, wrong, disabled or expired key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"Invalid token (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"403":{"description":"Balance too low, or the key may not use this model","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"The HTTP status again."},"msg":{"type":"string"},"data":{"type":"null"}},"required":["code","msg"]},"example":{"code":403,"msg":"This token has no access to model z-image","data":null}}}},"404":{"description":"No job with this id on your account","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"The HTTP status again."},"msg":{"type":"string"},"data":{"type":"null"}},"required":["code","msg"]},"example":{"code":404,"msg":"Task not found","data":null}}}},"429":{"description":"Rate limit: 120 requests a minute per account, 60 of them successful","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"You have reached the request limit: maximum 60 requests in 1 minutes (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","example":60}}}},"500":{"description":"Error on our side or the model's. Safe to retry with backoff.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"The HTTP status again."},"msg":{"type":"string"},"data":{"type":"null"}},"required":["code","msg"]},"example":{"code":500,"msg":"Task request failed","data":null}}}}}}},"/v1/images/generations":{"post":{"tags":["Images"],"summary":"Create image","description":"Creates an image from a prompt.","operationId":"post-v1-images-generations","parameters":[],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","description":"The model id, from the Models page."},"prompt":{"type":"string","description":"Text description of the image you want."},"n":{"type":"integer","description":"Number of images, where the model supports it."},"size":{"type":"string","description":"Size of the image, `WIDTHxHEIGHT`; mapped to the nearest aspect ratio and resolution the model offers."},"background":{"type":"string","description":"Sets transparency for the image background, where the model supports it: `transparent`, `opaque` or `auto` (default). With `auto` the model picks the best background.\n\nFor `transparent`, use an output format that supports transparency: `png` (default) or `webp`."},"quality":{"type":"string","description":"Image quality, where the model supports it."},"stream":{"type":"string"},"style":{"type":"string"},"user":{"type":"string"}},"required":["prompt"]},"example":{"model":"nano-banana-pro","prompt":"A matte ceramic mug on a beige backdrop, studio light","size":"1024x1024"}}}},"security":[{"Bearer":[]}],"responses":{"200":{"description":"Response","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"integer"},"data":{"type":"array","items":{"type":"object","properties":{"b64_json":{"type":"string"},"url":{"type":"string"}},"required":["url"]}},"usage":{"type":"object","properties":{"total_tokens":{"type":"integer"},"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"},"input_tokens_details":{"type":"object","properties":{"text_tokens":{"type":"integer"},"image_tokens":{"type":"integer"}},"required":["text_tokens","image_tokens"]}},"required":["total_tokens","input_tokens","output_tokens","input_tokens_details"]}},"required":["created","data","usage"]},"example":{"data":[{"url":"https://files.example.com/abc.png"}]}}}},"401":{"description":"Missing, wrong, disabled or expired key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"Invalid token (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"403":{"description":"Balance too low, or the key may not use this model or IP","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"This token has no access to model gpt-5-2 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"429":{"description":"Rate limit: 120 requests a minute per account, 60 of them successful","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"You have reached the request limit: maximum 60 requests in 1 minutes (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","example":60}}}},"500":{"description":"Error on our side or the model's. Safe to retry with backoff."}}}},"/v1/images/edits":{"post":{"tags":["Images"],"summary":"Edit image","description":"Creates an edited or extended image from an original image and a prompt.\n\n","operationId":"post-v1-images-edits","parameters":[],"requestBody":{"required":false,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"image":{"description":"The image to edit, as a file or link.","type":"string","format":"binary","examples":["cmMtdXBsb2FkLTE2ODc4MzMzNDc3NTEtMjA=/31225951_59371037e9_small.png"]},"mask":{"description":"An extra image whose fully transparent areas mark where to edit. Same size as the image.","type":"string","format":"binary","examples":[[]]},"prompt":{"description":"Text description of the image you want.","type":"string","examples":["A cute baby sea otter wearing a beret."]},"n":{"description":"Number of images, where the model supports it.","type":"string","examples":["1"]},"size":{"description":"Size of the image, `WIDTHxHEIGHT`; mapped to the nearest size the model offers.","type":"string","examples":["1024x1024"]},"response_format":{"description":"Format of the returned images: `url` or `b64_json`.","type":"string","examples":["url"]},"user":{"description":"A unique id for your end user; helps detect abuse.","type":"string","examples":[""]},"model":{"type":"string","examples":["google/nano-banana-edit"]}},"required":["image","prompt"]}}}},"security":[{"Bearer":[]}],"responses":{"200":{"description":"Response","content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"401":{"description":"Missing, wrong, disabled or expired key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"Invalid token (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"403":{"description":"Balance too low, or the key may not use this model or IP","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"This token has no access to model gpt-5-2 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"429":{"description":"Rate limit: 120 requests a minute per account, 60 of them successful","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"You have reached the request limit: maximum 60 requests in 1 minutes (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","example":60}}}},"500":{"description":"Error on our side or the model's. Safe to retry with backoff."}}}},"/v1/files":{"post":{"summary":"Upload a file","operationId":"uploadFile","description":"Upload an image, video or audio file to use as a job input. Returns a public https link, kept 1 day. Images up to 10 MB, video and audio up to 50 MB.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"200":{"description":"Uploaded","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","example":"file"},"url":{"type":"string","format":"uri","example":"https://files.example.com/uploads/6f1c.png"},"bytes":{"type":"integer","example":48213},"content_type":{"type":"string","example":"image/png"},"expires_at":{"type":"integer","description":"Unix time when the file is deleted."}}}}}},"400":{"description":"No file, or not an image, video or audio file"},"401":{"description":"Missing or wrong API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string","example":"invalid_api_key"},"code":{"type":"string","example":"invalid_api_key"}}}}}}}},"413":{"description":"File too large"}}}},"/v1/videos":{"post":{"tags":["Videos"],"summary":"Create video","description":"OpenAI-compatible video generation.\n\nStarts a video job; poll it with the video id.\n","operationId":"createvideo","parameters":[],"requestBody":{"required":false,"content":{"multipart/form-data":{"schema":{"type":"object","description":"Video generation request","properties":{"model":{"type":"string","description":"Model or style id","examples":["grok-imagine/text-to-video"]},"prompt":{"type":"string","description":"Text prompt","examples":["The astronaut stands up and walks away"]},"image":{"type":"string","description":"Image input (URL or base64)","examples":["https://example.com/image.jpg"]},"duration":{"type":"number","description":"Video length (seconds)","examples":[5]},"width":{"type":"integer","description":"Video width","examples":[1280]},"height":{"type":"integer","description":"Video height","examples":[720]},"fps":{"type":"integer","description":"Video frame rate","examples":[30]},"seed":{"type":"integer","description":"Random seed","examples":[20231234]},"n":{"type":"integer","description":"Number of videos","examples":[1]},"response_format":{"type":"string","description":"Response format","examples":["url"]},"user":{"type":"string","description":"User id","examples":["user-1234"]},"metadata":{"type":"object","description":"Extra parameters (for example negative_prompt, style, quality_level)","additionalProperties":true,"properties":{}}}}}}},"security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Video job created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Video id"},"object":{"type":"string","description":"Object type"},"model":{"type":"string","description":"Model used"},"status":{"type":"string","description":"Job status"},"progress":{"type":"integer","description":"Progress (percent)"},"created_at":{"type":"integer","description":"Created at (Unix seconds)"},"seconds":{"type":"string","description":"Video length"},"completed_at":{"type":"integer","description":"Completed at (Unix seconds)"},"expires_at":{"type":"integer","description":"Expires at (Unix seconds)"},"size":{"type":"string","description":"Video size"},"error":{"type":"object","description":"Video error","properties":{"message":{"type":"string","description":"Error message"},"code":{"type":"string","description":"Error code"}}},"metadata":{"type":"object","description":"Extra metadata","additionalProperties":true,"properties":{}}},"required":["id","object","model","status","progress","created_at","seconds"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"type":{"type":"string","description":"Error type"},"param":{"type":["string","null"],"description":"Related parameters"},"code":{"type":["string","null"],"description":"Error code"}}}}}}}},"401":{"description":"Missing, wrong, disabled or expired key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"Invalid token (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"403":{"description":"Balance too low, or the key may not use this model or IP","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"This token has no access to model grok-imagine/text-to-video (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"429":{"description":"Rate limit: 120 requests a minute per account, 60 of them successful","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"You have reached the request limit: maximum 60 requests in 1 minutes (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","example":60}}}},"500":{"description":"Error on our side or the model's. Safe to retry with backoff."}}}},"/v1/videos/{task_id}":{"get":{"tags":["Videos"],"summary":"Get video job status","description":"OpenAI-compatible video job status.\n\nReturns the job's status in detail.\n","operationId":"getvideo","parameters":[{"name":"task_id","in":"path","required":true,"description":"Video job id","schema":{"type":"string"}}],"security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Video job status","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string"},"model":{"type":"string"},"status":{"type":"string"},"progress":{"type":"integer"},"created_at":{"type":"integer"},"seconds":{"type":"string"}},"required":["id","object","model","status","progress","created_at","seconds"]},"example":{"id":"task_abc123","object":"video","model":"grok-imagine/text-to-video","status":"in_progress","progress":40,"created_at":1793600000,"seconds":"6"}}}},"401":{"description":"Missing, wrong, disabled or expired key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"Invalid token (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"403":{"description":"Balance too low, or the key may not use this model or IP","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"This token has no access to model grok-imagine/text-to-video (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"404":{"description":"Job not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"type":{"type":"string","description":"Error type"},"param":{"type":["string","null"],"description":"Related parameters"},"code":{"type":["string","null"],"description":"Error code"}}}}}}}},"429":{"description":"Rate limit: 120 requests a minute per account, 60 of them successful","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"You have reached the request limit: maximum 60 requests in 1 minutes (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","example":60}}}},"500":{"description":"Error on our side or the model's. Safe to retry with backoff."}}}},"/v1/videos/{task_id}/content":{"get":{"tags":["Videos"],"summary":"Get video content","description":"Returns the video file of a finished video job.\n\nStreams the file.\n","operationId":"getvideocontent","parameters":[{"name":"task_id","in":"path","required":true,"description":"Video job id","schema":{"type":"string"}}],"security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Video content","content":{"video/mp4":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"Missing, wrong, disabled or expired key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"Invalid token (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"403":{"description":"Balance too low, or the key may not use this model or IP","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"This token has no access to model grok-imagine/text-to-video (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"404":{"description":"Video not found or not finished","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"type":{"type":"string","description":"Error type"},"param":{"type":["string","null"],"description":"Related parameters"},"code":{"type":["string","null"],"description":"Error code"}}}}}}}},"429":{"description":"Rate limit: 120 requests a minute per account, 60 of them successful","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"You have reached the request limit: maximum 60 requests in 1 minutes (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","example":60}}}},"500":{"description":"Error on our side or the model's. Safe to retry with backoff."}}}},"/v1/audio/speech":{"post":{"tags":["Audio"],"summary":"Text to speech","description":"Turns text into audio","operationId":"createspeech","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input","voice"],"properties":{"model":{"type":"string","examples":["tts-1"]},"input":{"type":"string","description":"Text to convert","maxLength":4096},"voice":{"type":"string","enum":["alloy","echo","fable","onyx","nova","shimmer"]},"response_format":{"type":"string","enum":["mp3","opus","aac","flac","wav","pcm"],"default":"mp3"},"speed":{"type":"number","minimum":0.25,"maximum":4,"default":1}}}}}},"security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Audio generated","content":{"audio/mpeg":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"Missing, wrong, disabled or expired key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"Invalid token (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"403":{"description":"Balance too low, or the key may not use this model or IP","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"This token has no access to model gpt-5-2 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"429":{"description":"Rate limit: 120 requests a minute per account, 60 of them successful","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"You have reached the request limit: maximum 60 requests in 1 minutes (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","example":60}}}},"500":{"description":"Error on our side or the model's. Safe to retry with backoff.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"bad_response_status_code","message":"bad response status code 500 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error","param":""}}}}}}}},"/v1/audio/transcriptions":{"post":{"tags":["Audio"],"summary":"Audio transcription","description":"Turns audio into text","operationId":"createtranscription","parameters":[],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Audio file"},"model":{"type":"string","examples":["whisper-1"]},"language":{"type":"string","description":"ISO-639-1 language code"},"prompt":{"type":"string"},"response_format":{"type":"string","enum":["json","text","srt","verbose_json","vtt"],"default":"json"},"temperature":{"type":"number"},"timestamp_granularities":{"type":"array","items":{"type":"string","enum":["word","segment"]}}},"required":["file","model"]}}}},"security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Transcribed","content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"}}}}}},"401":{"description":"Missing, wrong, disabled or expired key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"Invalid token (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"403":{"description":"Balance too low, or the key may not use this model or IP","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"This token has no access to model gpt-5-2 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"429":{"description":"Rate limit: 120 requests a minute per account, 60 of them successful","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"You have reached the request limit: maximum 60 requests in 1 minutes (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","example":60}}}},"500":{"description":"Error on our side or the model's. Safe to retry with backoff.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"bad_response_status_code","message":"bad response status code 500 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error","param":""}}}}}}}},"/v1/audio/translations":{"post":{"tags":["Audio"],"summary":"Audio translation","description":"Translates audio into English text","operationId":"createtranslation","parameters":[],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"model":{"type":"string"},"prompt":{"type":"string"},"response_format":{"type":"string"},"temperature":{"type":"number"}},"required":["file","model"]}}}},"security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Translated","content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"}}}}}},"401":{"description":"Missing, wrong, disabled or expired key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"Invalid token (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"403":{"description":"Balance too low, or the key may not use this model or IP","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"This token has no access to model gpt-5-2 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"429":{"description":"Rate limit: 120 requests a minute per account, 60 of them successful","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"You have reached the request limit: maximum 60 requests in 1 minutes (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","example":60}}}},"500":{"description":"Error on our side or the model's. Safe to retry with backoff.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"bad_response_status_code","message":"bad response status code 500 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error","param":""}}}}}}}},"/v1/embeddings":{"post":{"tags":["Embeddings"],"summary":"Create embeddings","description":"Turns text into embedding vectors","operationId":"createembedding","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string","examples":["text-embedding-ada-002"]},"input":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Text to embed"},"encoding_format":{"type":"string","enum":["float","base64"],"default":"float"},"dimensions":{"type":"integer","description":"Output vector dimensions"}}}}}},"security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Embeddings created","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","examples":["list"]},"data":{"type":"array","items":{"type":"object","properties":{"object":{"type":"string","examples":["embedding"]},"index":{"type":"integer"},"embedding":{"type":"array","items":{"type":"number"}}}}},"model":{"type":"string"},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer"},"total_tokens":{"type":"integer"}}}}}}}},"401":{"description":"Missing, wrong, disabled or expired key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"Invalid token (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"403":{"description":"Balance too low, or the key may not use this model or IP","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"This token has no access to model gpt-5-2 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}}},"429":{"description":"Rate limit: 120 requests a minute per account, 60 of them successful","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"","message":"You have reached the request limit: maximum 60 requests in 1 minutes (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error"}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","example":60}}}},"500":{"description":"Error on our side or the model's. Safe to retry with backoff.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong. Ends with the request id."},"type":{"type":"string","description":"Error type, for example `api_error` or `invalid_request_error`."},"param":{"type":"string"},"code":{"type":"string","description":"Error code, often empty."}},"required":["message","type"]}},"required":["error"]},"example":{"error":{"code":"bad_response_status_code","message":"bad response status code 500 (request id: 20261102053704107200635868d9d6m7EOL5JK)","type":"api_error","param":""}}}}}}}}},"components":{"schemas":{},"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}}}