{"openapi":"3.1.0","info":{"title":"Paasta AI API","version":"1.8.0","description":"OpenAI- and Anthropic-compatible generation, images, speech, text batches, embeddings and audio transcription with toman billing. Prompt and response content is not retained in usage logs."},"servers":[{"url":"https://console.paasta.cloud/api/ai/v1"}],"security":[{"AiApiKey":[]}],"paths":{"/images/generations":{"post":{"summary":"Generate one image; native models accept size and quality","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageRequest"}}}},"responses":{"200":{"description":"One base64 image; text and image token rates may differ."},"400":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/images/edits":{"post":{"summary":"Edit a public HTTPS reference image with a supported model (JSON only)","requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ImageRequest"}],"description":"Exactly one of image_url or image_urls (1–4 HTTPS URLs), optional mask_url. Check supports_edit in GET /images."}}}},"responses":{"200":{"description":"One edited base64 image."},"400":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/images/batches":{"post":{"summary":"Queue 1–10 image generation/edit items","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","items"],"properties":{"model":{"type":"string"},"items":{"type":"array","minItems":1,"maxItems":10,"items":{"type":"object","required":["type","prompt"],"properties":{"type":{"enum":["generation","edit"]},"prompt":{"type":"string"},"image_url":{"type":"string","format":"uri"},"image_urls":{"type":"array","maxItems":4,"items":{"type":"string","format":"uri"}},"size":{"type":"string"},"quality":{"enum":["low","medium","high","auto"]}}}}}}}}},"responses":{"202":{"description":"Paasta batch UUID and reserved_toman. Fetch within one hour."},"400":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"submission_uncertain: do not resubmit; preserve the Paasta batch ID."}}}},"/images/batches/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Read image batch using the creating key and workspace","responses":{"200":{"description":"Status, available base64 results, expiry and final toman charge. Expired results are not retained by Paasta."},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"summary":"Cancel queued items; already running items can finish and incur charges","responses":{"200":{"description":"Current batch state. Only successful items are billed to the customer."},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/images":{"get":{"summary":"List image models and billing units","operationId":"listAiImageModels","responses":{"200":{"description":"Image catalog: pricing_unit=image includes price_toman_per_image; pricing_unit=token includes input_toman_per_million and output_toman_per_million."},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Generate one image from text","operationId":"createAiImage","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":200}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageRequest"}}}},"responses":{"200":{"description":"One base64-encoded image and final toman charge.","headers":{"x-paasta-request-id":{"schema":{"type":"string","format":"uuid"}}}},"400":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/audio/speech":{"get":{"summary":"List speech models and their character or text/audio token billing units","operationId":"listAiSpeechModels","responses":{"200":{"description":"Speech catalog with pricing_unit and optional pricing_components."},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Convert text to an MP3, PCM or WAV audio file","operationId":"createAiSpeech","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpeechRequest"}}}},"responses":{"200":{"description":"Raw audio bytes.","headers":{"x-paasta-request-id":{"schema":{"type":"string","format":"uuid"}},"x-paasta-charged-toman":{"schema":{"type":"integer"}}},"content":{"audio/mpeg":{"schema":{"type":"string","format":"binary"}},"audio/wav":{"schema":{"type":"string","format":"binary"}},"audio/pcm":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/batches":{"get":{"summary":"List the current key's recent text batches","operationId":"listAiBatches","responses":{"200":{"description":"Up to 50 local batch metadata records, without prompts or outputs."},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Submit 1–20 asynchronous text chat requests","operationId":"createAiBatch","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":200}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchRequest"}}}},"responses":{"202":{"description":"Accepted batch with a local id and reserved wallet amount."},"400":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Submission uncertain; do not retry with a new id. Preserve the returned local batch id."}}}},"/batches/{id}":{"get":{"summary":"Read the current key's batch status and completed results","operationId":"getAiBatch","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Batch status, results when available, and final toman charge. No internal upstream cost."},"400":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/knowledge-bases/{id}/search":{"post":{"summary":"Retrieve hybrid-ranked chunks from a managed knowledge base","operationId":"searchKnowledgeBase","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":200}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSearchRequest"}}}},"responses":{"200":{"description":"Ranked source chunks and the exact final toman charge for embedding the query.","headers":{"x-paasta-request-id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSearchResponse"}}}},"400":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/generation":{"get":{"summary":"Retrieve the recorded usage and final toman charge for one request","operationId":"getAiGeneration","parameters":[{"in":"query","name":"id","required":true,"schema":{"type":"string","format":"uuid"},"description":"The x-paasta-request-id returned by the original request."}],"responses":{"200":{"description":"Generation metadata for the current API key. Prompt and response content and internal upstream cost are not returned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationResponse"}}}},"400":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/embeddings/models":{"get":{"summary":"List available embedding models and prices","operationId":"listAiEmbeddingModels","responses":{"200":{"description":"Embedding model catalog","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Model"}}}}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/embeddings":{"post":{"summary":"Create embeddings for text or token inputs","operationId":"createAiEmbeddings","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":200}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingRequest"}}}},"responses":{"200":{"description":"Embedding vectors, token usage and final charge.","headers":{"x-paasta-request-id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingResponse"}}}},"400":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/audio/models":{"get":{"summary":"List available audio transcription models and prices","operationId":"listAiAudioModels","responses":{"200":{"description":"Transcription model catalog","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Model"}}}}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/audio/transcriptions":{"post":{"summary":"Transcribe base64 audio or a multipart file up to 1.4 MB; duration-priced models require validated PCM WAV","operationId":"createAiAudioTranscription","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":200}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TranscriptionRequest"}},"multipart/form-data":{"schema":{"type":"object","required":["model","file"],"properties":{"model":{"type":"string"},"file":{"type":"string","format":"binary"},"language":{"type":"string"},"response_format":{"enum":["json","verbose_json","diarized_json"]}}}}}},"responses":{"200":{"description":"Transcribed text, token usage and final charge.","headers":{"x-paasta-request-id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TranscriptionResponse"}}}},"400":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/models":{"get":{"summary":"List available priced models","operationId":"listAiModels","responses":{"200":{"description":"Live model catalog","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Model"}}}}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/chat/completions":{"post":{"summary":"Create a chat completion","operationId":"createChatCompletion","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":200},"description":"A unique identifier that prevents duplicate reservations and charges."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"200":{"description":"JSON completion or text/event-stream when stream=true.","headers":{"x-paasta-request-id":{"schema":{"type":"string","format":"uuid"}},"x-ratelimit-limit-requests":{"schema":{"type":"integer"}},"x-ratelimit-remaining-requests":{"schema":{"type":"integer"}},"x-ratelimit-reset-requests":{"schema":{"type":"integer"}}}},"400":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}},"502":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/responses":{"post":{"summary":"Create a synchronous, stateless model response","operationId":"createResponse","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":200},"description":"A unique identifier that prevents duplicate reservations and charges."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponsesRequest"}}}},"responses":{"200":{"description":"Completed response. Paasta always returns store=false and does not retain prompt or output content.","headers":{"x-paasta-request-id":{"schema":{"type":"string","format":"uuid"}}}},"400":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/messages":{"post":{"summary":"Create an Anthropic-compatible message","operationId":"createAnthropicMessage","security":[{"AiApiKey":[]},{"AnthropicApiKey":[]}],"parameters":[{"in":"header","name":"anthropic-version","required":false,"schema":{"type":"string"},"description":"Accepted for Anthropic SDK compatibility."},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":200}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicRequest"}}}},"responses":{"200":{"description":"Anthropic Message JSON or Anthropic SSE events when stream=true.","headers":{"x-paasta-request-id":{"schema":{"type":"string","format":"uuid"}}}},"400":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"The request failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"AiApiKey":{"type":"http","scheme":"bearer","bearerFormat":"paasta_ai_…","description":"Create a scoped key in the Paasta AI console. Never expose it in browser code."},"AnthropicApiKey":{"type":"apiKey","in":"header","name":"x-api-key","description":"The same scoped Paasta AI key, accepted for Anthropic SDK compatibility."}},"schemas":{"ImageRequest":{"type":"object","required":["model","prompt"],"additionalProperties":false,"properties":{"model":{"type":"string"},"prompt":{"type":"string","minLength":1,"maxLength":4000},"n":{"const":1},"response_format":{"const":"b64_json"},"size":{"enum":["1024x1024","1024x1536","1536x1024","2048x2048","auto"]},"quality":{"enum":["low","medium","high","auto"]},"background":{"enum":["auto","opaque","transparent"]},"output_format":{"enum":["png","jpeg","webp"]},"moderation":{"enum":["auto","low"]},"image_url":{"type":"string","format":"uri"},"image_urls":{"type":"array","minItems":1,"maxItems":4,"items":{"type":"string","format":"uri"}},"mask_url":{"type":"string","format":"uri"}}},"SpeechRequest":{"type":"object","required":["model","input"],"additionalProperties":false,"properties":{"model":{"type":"string"},"input":{"type":"string","minLength":1,"maxLength":4000},"voice":{"type":"string"},"response_format":{"enum":["mp3","pcm","wav"]}}},"BatchRequest":{"type":"object","required":["model","endpoint","requests"],"properties":{"model":{"type":"string"},"endpoint":{"const":"/v1/chat/completions"},"requests":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"object","required":["custom_id","body"],"properties":{"custom_id":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"body":{"type":"object","required":["messages"],"properties":{"messages":{"type":"array","minItems":1,"maxItems":40,"items":{"type":"object"}},"max_tokens":{"type":"integer","minimum":1,"maximum":8192},"temperature":{"type":"number","minimum":0,"maximum":2}}}}}}}},"KnowledgeSearchRequest":{"type":"object","required":["query"],"properties":{"query":{"type":"string","minLength":2,"maxLength":4000},"top_k":{"type":"integer","minimum":1,"maximum":10,"default":5},"retrieval_mode":{"enum":["hybrid","semantic"],"default":"hybrid","description":"Hybrid combines vector similarity with Persian- and English-aware keyword ranking without another model call."}}},"KnowledgeSearchResponse":{"type":"object","required":["results","retrieval","model","usage","charged_toman","request_id"],"properties":{"results":{"type":"array","items":{"type":"object","required":["source_id","source_name","chunk","score","semantic_score","keyword_score","match_type","content"],"properties":{"source_id":{"type":"string","format":"uuid"},"source_name":{"type":"string"},"chunk":{"type":"integer","minimum":0},"score":{"type":"number","minimum":-1,"maximum":1,"description":"Relative hybrid relevance, or the original cosine similarity in semantic mode."},"semantic_score":{"type":"number","minimum":-1,"maximum":1},"keyword_score":{"type":"number","minimum":0,"maximum":1},"match_type":{"enum":["hybrid","semantic"]},"content":{"type":"string"}}}},"retrieval":{"type":"object","required":["mode","semantic_weight","keyword_weight"],"properties":{"mode":{"enum":["hybrid","semantic"]},"semantic_weight":{"type":"number"},"keyword_weight":{"type":"number"}}},"model":{"type":"string"},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer"}}},"charged_toman":{"type":"integer"},"request_id":{"type":"string","format":"uuid"}}},"GenerationResponse":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["id","model","status","created_at","usage","charged_toman"],"properties":{"id":{"type":"string","format":"uuid"},"model":{"type":"string"},"status":{"enum":["reserved","succeeded","failed"]},"created_at":{"type":"string","format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"generation_time":{"type":["number","null"],"description":"Recorded service latency in seconds."},"tokens_prompt":{"type":"integer"},"tokens_completion":{"type":"integer"},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer"},"completion_tokens":{"type":"integer"},"total_tokens":{"type":"integer"},"reasoning_tokens":{"type":"integer"},"cached_tokens":{"type":"integer"},"cache_write_tokens":{"type":"integer"},"input_characters":{"type":"integer","description":"Characters billed by text-to-speech; not tokens."}}},"charged_toman":{"type":"integer","description":"Final customer charge in toman."},"finish_reason":{"type":["string","null"]},"error_code":{"type":["string","null"]}}}}},"EmbeddingRequest":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string"},"input":{"oneOf":[{"type":"string"},{"type":"array","minItems":1,"maxItems":2048,"items":{"type":"string"}},{"type":"array","minItems":1,"items":{"type":"integer","minimum":0}},{"type":"array","minItems":1,"maxItems":2048,"items":{"type":"array","minItems":1,"items":{"type":"integer","minimum":0}}}]},"dimensions":{"type":"integer","minimum":1,"maximum":65536},"encoding_format":{"enum":["float","base64"]},"input_type":{"type":"string","maxLength":80},"user":{"type":"string","maxLength":200}}},"EmbeddingResponse":{"type":"object","required":["object","data","model","usage","paasta"],"properties":{"object":{"const":"list"},"model":{"type":"string"},"data":{"type":"array","items":{"type":"object","required":["object","index","embedding"],"properties":{"object":{"const":"embedding"},"index":{"type":"integer"},"embedding":{"oneOf":[{"type":"array","items":{"type":"number"}},{"type":"string"}]}}}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer"},"total_tokens":{"type":"integer"}}},"paasta":{"type":"object","properties":{"charged_toman":{"type":"integer"}}}}},"TranscriptionRequest":{"type":"object","required":["model","input_audio"],"properties":{"model":{"type":"string"},"input_audio":{"type":"object","required":["data","format"],"properties":{"data":{"type":"string","contentEncoding":"base64"},"format":{"enum":["wav","mp3","m4a","ogg","webm","flac","aac","mp4"]}}},"language":{"type":"string","description":"Optional language hint, such as fa."},"response_format":{"enum":["json","verbose_json","diarized_json"]}}},"TranscriptionResponse":{"type":"object","required":["text","usage","paasta"],"properties":{"text":{"type":"string"},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"}}},"paasta":{"type":"object","properties":{"charged_toman":{"type":"integer"}}}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["message","type","code"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"}}}}},"Model":{"type":"object","required":["id","object","pricing"],"properties":{"id":{"type":"string"},"object":{"const":"model"},"name":{"type":"string"},"context_length":{"type":["integer","null"]},"max_output_tokens":{"type":"integer"},"pricing":{"type":"object","properties":{"input_toman_per_million":{"type":"integer"},"output_toman_per_million":{"type":"integer"}}}}},"Message":{"type":"object","required":["role"],"properties":{"role":{"enum":["developer","system","user","assistant","tool"]},"content":{"type":["string","array","null"]},"tool_call_id":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object"}}}},"FunctionTool":{"type":"object","required":["type","function"],"properties":{"type":{"const":"function"},"function":{"type":"object","required":["name"],"properties":{"name":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"description":{"type":"string","maxLength":8000},"parameters":{"type":"object"},"strict":{"type":"boolean"}}}}},"ChatRequest":{"type":"object","required":["model","messages"],"properties":{"model":{"type":"string"},"messages":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/Message"}},"max_tokens":{"type":"integer","minimum":1,"description":"Values above the selected model limit are clamped to that limit."},"max_completion_tokens":{"type":"integer","minimum":1,"description":"Values above the selected model limit are clamped to that limit."},"temperature":{"type":"number"},"stream":{"type":"boolean","default":false},"tools":{"type":"array","maxItems":128,"items":{"$ref":"#/components/schemas/FunctionTool"}},"tool_choice":{"oneOf":[{"enum":["none","auto","required"]},{"type":"object"}]},"parallel_tool_calls":{"type":"boolean"},"response_format":{"oneOf":[{"type":"object","properties":{"type":{"enum":["text","json_object"]}}},{"type":"object","properties":{"type":{"const":"json_schema"},"json_schema":{"type":"object"}}}]}}},"ResponsesRequest":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string"},"instructions":{"type":"string"},"input":{"oneOf":[{"type":"string"},{"type":"array","minItems":1,"items":{"type":"object"}}]},"max_output_tokens":{"type":"integer","minimum":1},"temperature":{"type":"number"},"top_p":{"type":"number"},"store":{"const":false,"description":"Stateful storage is not supported. true returns unsupported_responses_feature."},"reasoning":{"type":"object","properties":{"effort":{"enum":["none","minimal","low","medium","high","xhigh"]}}},"cache_control":{"type":"object","properties":{"type":{"const":"ephemeral"},"ttl":{"enum":["5m","1h"]}}},"stream":{"const":false},"background":{"const":false},"tools":{"type":"array","maxItems":128,"items":{"type":"object"}},"tool_choice":{"oneOf":[{"enum":["none","auto","required"]},{"type":"object"}]},"text":{"type":"object"},"max_tool_calls":{"const":1,"description":"For explicit hosted web search: model=openai/gpt-5.6-luna, tools=[{type:web_search}], tool_choice={type:web_search}, text input only, store=false, stream=false. Search has a separate fee shown in GET /models."}}},"AnthropicRequest":{"type":"object","required":["model","messages","max_tokens"],"properties":{"model":{"type":"string"},"max_tokens":{"type":"integer","minimum":1},"system":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"object"}}]},"messages":{"type":"array","minItems":1,"items":{"type":"object","required":["role","content"],"properties":{"role":{"enum":["user","assistant"]},"content":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"object"}}]}}}},"temperature":{"type":"number"},"top_p":{"type":"number"},"top_k":{"type":"integer"},"stop_sequences":{"type":"array","items":{"type":"string"}},"stream":{"type":"boolean"},"thinking":{"type":"object","description":"Uses a verified native Anthropic Messages route; the selected model must support thinking. Supported free routes remain subject to free quota and never fall back to paid models.","required":["type"],"properties":{"type":{"enum":["enabled","adaptive","disabled"]},"budget_tokens":{"type":"integer","minimum":1}}},"output_config":{"type":"object","description":"Native Anthropic reasoning effort; availability depends on the model.","properties":{"effort":{"enum":["low","medium","high","xhigh","max"]}}},"tools":{"type":"array","maxItems":128,"items":{"type":"object","required":["name","input_schema"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"input_schema":{"type":"object"}}}},"tool_choice":{"type":"object"}}}}}}