{"openapi":"3.1.0","info":{"title":"CLAILA API","version":"1.0.0","description":"Images, video, music, voice and chat models with one key, billed in CLAILA credits.\n\nMCP server: https://api.claila.com/mcp\n\nKeys and billing: https://app.claila.com/api","contact":{"url":"https://www.claila.com/contact-us"}},"servers":[{"url":"https://api.claila.com/v1"}],"security":[{"bearerAuth":[]},{"oauth2":["claila:generate","claila:chat","claila:read"]}],"paths":{"/models":{"get":{"summary":"List models with prices","operationId":"listModels","parameters":[{"name":"type","in":"query","schema":{"type":"string","enum":["image","video","audio","chat"]}}],"responses":{"200":{"description":"Models","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object"}}}}}}}},"security":[]}},"/models/{id}":{"get":{"summary":"One model","operationId":"getModel","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Model"},"404":{"$ref":"#/components/responses/Error"}},"security":[]}},"/images/generations":{"post":{"summary":"Generate images (OpenAI compatible)","operationId":"createImage","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt"],"properties":{"model":{"type":"string","default":"flux-2-pro"},"prompt":{"type":"string"},"n":{"type":"integer","minimum":1,"maximum":4},"size":{"type":"string","example":"1024x1024"},"aspect_ratio":{"type":"string"},"preset":{"type":"string","enum":["instagram_post","instagram_square","story_reel","youtube_thumbnail","pinterest","linkedin"]},"quality":{"type":"string"},"response_format":{"type":"string","enum":["url","b64_json"],"default":"url"},"image":{"description":"Optional input image(s) for edits","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}}}}}},"responses":{"200":{"description":"Images","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"integer"},"data":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"b64_json":{"type":"string"},"file_id":{"type":"string"}}}},"usage":{"type":"object","properties":{"credits":{"type":"number"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"502":{"$ref":"#/components/responses/Error"}}}},"/images/edits":{"post":{"summary":"Edit images (OpenAI compatible, multipart or JSON)","operationId":"editImage","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["prompt","image"],"properties":{"image":{"type":"string","format":"binary"},"prompt":{"type":"string"},"model":{"type":"string","default":"nano-banana-2"},"n":{"type":"integer"},"size":{"type":"string"}}}},"application/json":{"schema":{"type":"object","required":["prompt","images"],"properties":{"images":{"type":"array","items":{"type":"string"}},"prompt":{"type":"string"},"model":{"type":"string"}}}}}},"responses":{"200":{"description":"Images (same shape as /images/generations)"},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"502":{"$ref":"#/components/responses/Error"}}}},"/generations":{"post":{"summary":"Run any generation model","operationId":"createGeneration","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","maxLength":64}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationRequest"}}}},"responses":{"200":{"description":"Finished","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Generation"}}}},"202":{"description":"Still running; poll poll_url","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Generation"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"502":{"$ref":"#/components/responses/Error"}}},"get":{"summary":"Recent generations","operationId":"listGenerations","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":100}}],"responses":{"200":{"description":"List"}}}},"/generations/{id}":{"get":{"summary":"Generation status and files","operationId":"getGeneration","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"wait","in":"query","schema":{"type":"integer","maximum":60}}],"responses":{"200":{"description":"Generation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Generation"}}}},"404":{"$ref":"#/components/responses/Error"}}}},"/chat/completions":{"post":{"summary":"Chat completion (OpenAI compatible, streaming)","operationId":"createChatCompletion","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","messages"],"properties":{"model":{"type":"string","example":"claude-sonnet-5-5"},"messages":{"type":"array","items":{"type":"object"}},"max_tokens":{"type":"integer","default":4096},"temperature":{"type":"number"},"stream":{"type":"boolean"},"tools":{"type":"array","items":{"type":"object"}},"response_format":{"type":"object"},"reasoning_effort":{"type":"string","enum":["minimal","low","medium","high"]}}}}}},"responses":{"200":{"description":"chat.completion, or text/event-stream when stream is true; usage.credits is the charge"},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"502":{"$ref":"#/components/responses/Error"}}}},"/files":{"post":{"summary":"Upload an input image","operationId":"uploadFile","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}}}},"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"data":{"type":"string","description":"data URI or base64"}}}}}},"responses":{"200":{"description":"File","content":{"application/json":{"schema":{"$ref":"#/components/schemas/File"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"502":{"$ref":"#/components/responses/Error"}}}},"/files/{id}":{"get":{"summary":"File metadata with a fresh signed URL","operationId":"getFile","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"File"},"404":{"$ref":"#/components/responses/Error"}}}},"/files/{id}/content":{"get":{"summary":"File bytes (Bearer, or exp+sig from a signed URL)","operationId":"getFileContent","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Binary"}}}},"/credits":{"get":{"summary":"Credit balance","operationId":"getCredits","responses":{"200":{"description":"Balance","content":{"application/json":{"schema":{"type":"object","properties":{"credits":{"type":"number"},"credits_plan":{"type":"number"},"credits_extra":{"type":"number"},"auto_topup":{"type":"boolean"},"billing_url":{"type":"string"}}}}}}}}},"/key":{"get":{"summary":"The calling key or connected app","operationId":"getKey","responses":{"200":{"description":"Key info"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"sk-claila-… key from https://app.claila.com/api, or an OAuth access token"},"oauth2":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://app.claila.com/oauth/authorize","tokenUrl":"https://api.claila.com/oauth/token","refreshUrl":"https://api.claila.com/oauth/token","scopes":{"claila:generate":"Generate media","claila:chat":"Use chat models","claila:read":"Read account and files"}}}}},"schemas":{"File":{"type":"object","properties":{"id":{"type":"string","example":"file_Ab3dE5fG7h"},"object":{"type":"string","const":"file"},"type":{"type":"string","enum":["image","video","audio","text"]},"mime_type":{"type":"string"},"bytes":{"type":"integer"},"url":{"type":"string","format":"uri","description":"Signed download URL, valid 7 days"},"url_expires_at":{"type":"integer"},"width":{"type":"integer"},"height":{"type":"integer"}}},"Generation":{"type":"object","properties":{"id":{"type":"string","example":"gen_6f1c2b9a0d4e8f7a1b2c3d4e"},"object":{"type":"string","const":"generation"},"model":{"type":"string"},"type":{"type":"string","enum":["image","video","audio","text"]},"status":{"type":"string","enum":["queued","running","succeeded","failed","canceled"]},"created":{"type":"integer"},"credits_reserved":{"type":"number"},"credits_used":{"type":["number","null"]},"files":{"type":"array","items":{"$ref":"#/components/schemas/File"}},"poll_url":{"type":"string"},"poll_after_seconds":{"type":"integer"},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}},"GenerationRequest":{"type":"object","required":["model"],"properties":{"model":{"type":"string","enum":["auto","flux-2-pro","flux-pro-ultra","flux-schnell","nano-banana-2","flux-2-pro-edit","flux-kontext","remove-background","upscale","kling-2.6-pro","wan-2.2","minimax-music-2.6","elevenlabs-music","stable-audio-3","tts"]},"prompt":{"type":"string","maxLength":4000},"preset":{"type":"string","enum":["instagram_post","instagram_square","story_reel","youtube_thumbnail","pinterest","linkedin"]},"aspect_ratio":{"type":"string","example":"4:5"},"size":{"type":"string","example":"1024x1280","description":"OpenAI style; converted to the nearest aspect ratio"},"n":{"type":"integer","minimum":1,"maximum":4},"quality":{"type":"string","enum":["1K","2K","4K"],"description":"nano-banana-2 only"},"megapixels":{"type":"number","minimum":0.25,"maximum":2,"description":"FLUX.2 [pro], 2 MP costs double"},"images":{"type":"array","items":{"type":"string"},"description":"Input images: https URL, data URI or file_ id"},"duration":{"type":"integer","enum":[5,10]},"audio":{"type":"boolean","description":"kling-2.6-pro sound (default true)"},"lyrics":{"type":"string"},"instrumental":{"type":"boolean"},"voice":{"type":"string"},"upscale_factor":{"type":"integer","enum":[2,4]},"seed":{"type":"integer"},"negative_prompt":{"type":"string"},"wait":{"type":"integer","minimum":0,"maximum":60,"description":"Seconds to wait for async models before answering"}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"type":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"billing_url":{"type":"string"}}}}}},"responses":{"Error":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}