{"openapi":"3.1.0","info":{"title":"Byta AI API","version":"1.0.0","description":"Create text, images, video, speech, and music with Byta AI. Text supports synchronous or streaming responses; image, video, and music use durable asynchronous jobs.","contact":{"name":"Byta AI Support","email":"hello@byta-ai.com","url":"https://byta-ai.com/help"}},"externalDocs":{"description":"Byta AI developer documentation","url":"https://byta-ai.com/api-docs"},"servers":[{"url":"https://api.byta-ai.com/v1","description":"Production"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Text","description":"OpenAI-compatible Responses and Chat Completions"},{"name":"Images","description":"Asynchronous image generation and editing"},{"name":"Video","description":"Asynchronous text-to-video and image-to-video generation"},{"name":"Speech","description":"Synchronous text-to-speech generation"},{"name":"Music","description":"Asynchronous song and instrumental generation"},{"name":"Account","description":"Models and prepaid API billing"}],"paths":{"/models":{"get":{"tags":["Account"],"summary":"List active models","operationId":"listModels","responses":{"200":{"description":"Authenticated active model catalog","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string"},"data":{"type":"array","items":{"type":"object","additionalProperties":true}}},"additionalProperties":true}}}},"401":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/billing":{"get":{"tags":["Account"],"summary":"Get API billing balance","operationId":"getBillingBalance","responses":{"200":{"description":"Separate prepaid USD API wallet, expressed in USD micros","content":{"application/json":{"schema":{"type":"object","properties":{"availableUsdMicros":{"type":"integer"},"reservedUsdMicros":{"type":"integer"},"spendableUsdMicros":{"type":"integer"},"monthSpendUsdMicros":{"type":"integer"}},"additionalProperties":true}}}},"401":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/responses":{"post":{"tags":["Text"],"summary":"Create a response","operationId":"createResponse","description":"OpenAI-compatible Responses request. Set stream=true for server-sent events.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponsesRequest"}}}},"responses":{"200":{"description":"Response object or an SSE stream","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/responses/compact":{"post":{"tags":["Text"],"summary":"Compact a Responses conversation","operationId":"compactResponse","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponsesRequest"}}}},"responses":{"200":{"description":"Compacted output items for the next Responses request","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/chat/completions":{"post":{"tags":["Text"],"summary":"Create a chat completion","operationId":"createChatCompletion","description":"OpenAI-compatible text-only Chat Completions request. n must be 1.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionRequest"}}}},"responses":{"200":{"description":"Chat completion object or an SSE stream","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/images/generations":{"post":{"tags":["Images"],"summary":"Submit an image generation","operationId":"createImageGeneration","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"description":"A unique key for the logical media request. Reuse it only when retrying the same request.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageGenerationRequest"}}}},"responses":{"202":{"description":"Durable image job accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaJob"}}}},"400":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/images/generations/{jobId}":{"get":{"tags":["Images"],"summary":"Get image generation status","operationId":"getImageGeneration","security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"jobId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Current job state and any completed private output URLs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaJob"}}}},"401":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/videos/generations":{"post":{"tags":["Video"],"summary":"Submit a video generation","operationId":"createVideoGeneration","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"description":"A unique key for the logical media request. Reuse it only when retrying the same request.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VideoGenerationRequest"}}}},"responses":{"202":{"description":"Durable video job accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaJob"}}}},"400":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/videos/generations/{jobId}":{"get":{"tags":["Video"],"summary":"Get video generation status","operationId":"getVideoGeneration","security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"jobId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Current job state and any completed private output URLs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaJob"}}}},"401":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/speech/generations":{"post":{"tags":["Speech"],"summary":"Generate speech","operationId":"createSpeechGeneration","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpeechGenerationRequest"}}}},"responses":{"200":{"description":"Completed private MP3 output","content":{"application/json":{"schema":{"type":"object","properties":{"audio":{"type":"object","properties":{"url":{"type":"string","format":"uri"}},"required":["url"],"additionalProperties":true}},"required":["audio"],"additionalProperties":true}}}},"400":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/music/generations":{"post":{"tags":["Music"],"summary":"Submit a music generation","operationId":"createMusicGeneration","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"description":"A unique key for the logical media request. Reuse it only when retrying the same request.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicGenerationRequest"}}}},"responses":{"202":{"description":"Durable music job accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaJob"}}}},"400":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/music/generations/{jobId}":{"get":{"tags":["Music"],"summary":"Get music generation status","operationId":"getMusicGeneration","security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"jobId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Current job state and any completed private output URLs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaJob"}}}},"401":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"OpenAI-style error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"Byta API key","description":"Create and rotate keys in the Byta API Console."}},"schemas":{"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"param":{"type":["string","null"]},"code":{"type":["string","null"]}},"required":["message","type"]}},"required":["error"]},"InputReference":{"type":"object","description":"Use exactly one owned file ID, public image URL, or base64 image data URL.","properties":{"file_id":{"type":"string"},"image_url":{"type":"string"}},"additionalProperties":false},"MediaJob":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["queued","running","completed","failed"]},"statusUrl":{"type":"string","format":"uri"},"terminal":{"type":"boolean"},"creditsCharged":{"type":"number"},"error":{"oneOf":[{"$ref":"#/components/schemas/ErrorResponse"},{"type":"null"}]},"images":{"type":"array","items":{"$ref":"#/components/schemas/PrivateMedia"}},"videos":{"type":"array","items":{"$ref":"#/components/schemas/PrivateMedia"}},"clips":{"type":"array","items":{"$ref":"#/components/schemas/PrivateMedia"}}},"required":["id","status"],"additionalProperties":true},"PrivateMedia":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"Fetch with the same Bearer key. Add ?download=1 for attachment disposition."}},"required":["url"],"additionalProperties":true},"ResponsesRequest":{"type":"object","properties":{"model":{"type":"string"},"input":{},"instructions":{"type":"string"},"max_output_tokens":{"type":"integer","minimum":1},"reasoning":{"type":"object","properties":{"effort":{"type":"string"}},"additionalProperties":true},"tools":{"type":"array","items":{"type":"object","additionalProperties":true}},"stream":{"type":"boolean","default":false}},"required":["model","input"],"additionalProperties":true},"ChatCompletionRequest":{"type":"object","properties":{"model":{"type":"string"},"messages":{"type":"array","minItems":1,"items":{"type":"object","properties":{"role":{"type":"string","enum":["system","developer","user","assistant"]},"content":{"type":"string"}},"required":["role","content"],"additionalProperties":true}},"reasoning_effort":{"type":"string"},"stream":{"type":"boolean","default":false},"n":{"type":"integer","const":1,"default":1}},"required":["model","messages"],"additionalProperties":true},"ImageGenerationRequest":{"type":"object","properties":{"model":{"type":"string"},"prompt":{"type":"string"},"n":{"type":"integer","minimum":1,"default":1},"size":{"type":"string","examples":["1024x1024","1792x1024","auto"]},"aspectRatio":{"type":"string","enum":["auto","16:9","9:16","3:2","2:3","1:1"]},"resolution":{"type":"string"},"input_reference":{"$ref":"#/components/schemas/InputReference"},"referenceFileIds":{"type":"array","items":{"type":"string"}}},"required":["model","prompt"],"additionalProperties":true},"VideoGenerationRequest":{"type":"object","properties":{"model":{"type":"string"},"prompt":{"type":"string"},"seconds":{"type":"integer","examples":[6,10]},"size":{"type":"string","examples":["1280x720","720x1280"]},"aspectRatio":{"type":"string"},"resolution":{"type":"string","enum":["480p","720p"]},"input_reference":{"$ref":"#/components/schemas/InputReference"},"referenceFileIds":{"type":"array","items":{"type":"string"}}},"required":["model","prompt"],"additionalProperties":true},"SpeechGenerationRequest":{"type":"object","properties":{"model":{"type":"string"},"input":{"type":"string","minLength":1,"maxLength":4096},"voice":{"type":"string"},"language":{"type":"string"},"speed":{"type":"number"}},"required":["model","input","voice"],"additionalProperties":true},"MusicGenerationRequest":{"type":"object","properties":{"model":{"type":"string"},"mode":{"type":"string","enum":["instrumental","lyrics"]},"title":{"type":"string"},"description":{"type":"string"},"lyrics":{"type":"string"}},"required":["model","mode","title"],"additionalProperties":true}}}}