{"openapi":"3.1.0","info":{"title":"LeapFun AI API","description":"Text-to-speech API with four engine tiers (ultra, pro, expressive, turbo), director's notes, and an OpenAI-compatible endpoint. Authenticate with `Authorization: Bearer lf_sk_...`; create keys at https://app.leapfun.ai/settings. Errors use `{\"error\": {\"type\", \"code\", \"message\", \"param\", \"request_id\"}}`.","version":"1.0.0"},"servers":[{"url":"https://api.leapfun.ai"}],"paths":{"/v1/tts":{"post":{"summary":"Generate speech","description":"Synthesize up to 5,000 characters in one call. Credits are drawn from the workspace that owns the API key.","operationId":"v1_tts_v1_tts_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V1TTSRequest"}}},"required":true},"responses":{"200":{"description":"Audio bytes. Headers: X-Job-Id, X-Credits-Used, X-Engine, X-RateLimit-*.","content":{"audio/mpeg":{},"audio/wav":{}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":[]}]}},"/v1/voices":{"get":{"summary":"List voices","description":"Preset voices across the four engine tiers plus this workspace's cloned/designed voices.","operationId":"v1_voices_v1_voices_get","security":[{"ApiKey":[]}],"parameters":[{"name":"engine","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ultra | pro | expressive | turbo","title":"Engine"},"description":"ultra | pro | expressive | turbo"},{"name":"lang","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO language code, e.g. en, zh, ja. Multilingual voices always match.","title":"Lang"},"description":"ISO language code, e.g. en, zh, ja. Multilingual voices always match."},{"name":"gender","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"female | male","title":"Gender"},"description":"female | male"},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Substring match on voice name or slug.","title":"Q"},"description":"Substring match on voice name or slug."},{"name":"type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"preset | cloned","title":"Type"},"description":"preset | cloned"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/engines":{"get":{"summary":"List engine tiers","description":"The four engine tiers with billing units, supported parameters and director presets.","operationId":"v1_engines_v1_engines_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"ApiKey":[]}]}},"/v1/usage":{"get":{"summary":"Get usage and quota","description":"Credits used and remaining in the current billing period. Also the recommended credential-check endpoint.","operationId":"v1_usage_v1_usage_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"ApiKey":[]}]}},"/v1/audio/speech":{"post":{"summary":"OpenAI-compatible speech","description":"Drop-in replacement for OpenAI's /v1/audio/speech. Point the SDK's base_url at https://api.leapfun.ai/v1.","operationId":"openai_speech_v1_audio_speech_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpenAISpeechRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"audio/mpeg":{},"audio/wav":{}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":[]}]}}},"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"OpenAISpeechRequest":{"properties":{"model":{"type":"string","title":"Model","description":"tts-1 → turbo, tts-1-hd → pro, gpt-4o-mini-tts → ultra; or leap-ultra | leap-pro | leap-expressive | leap-turbo.","default":"gpt-4o-mini-tts"},"input":{"type":"string","maxLength":5000,"minLength":1,"title":"Input"},"voice":{"type":"string","title":"Voice","description":"LeapFun voice slug, or an OpenAI voice name (alloy, echo, fable, onyx, nova, shimmer).","default":"aurora"},"response_format":{"type":"string","title":"Response Format","description":"mp3 | wav","default":"mp3"},"speed":{"type":"number","maximum":2.0,"minimum":0.5,"title":"Speed","default":1.0},"instructions":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Instructions","description":"Director's note (ultra/pro). Same as 'note' on POST /v1/tts."}},"type":"object","required":["input"],"title":"OpenAISpeechRequest"},"V1TTSRequest":{"properties":{"text":{"type":"string","maxLength":5000,"minLength":1,"title":"Text","description":"Text to speak, 1–5,000 characters."},"engine":{"type":"string","title":"Engine","description":"Engine tier: ultra | pro | expressive | turbo. 'pro' routes automatically by voice.","default":"ultra"},"voice":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice","description":"Preset voice slug from GET /v1/voices. Defaults to the engine's default voice."},"voice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Id","description":"Your cloned/designed voice id (mutually exclusive with 'voice')."},"speed":{"type":"number","maximum":2.0,"minimum":0.5,"title":"Speed","description":"Speaking rate multiplier.","default":1.0},"emotion":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Emotion","description":"happy | sad | angry | calm | surprised | gentle | serious (pro/ultra)."},"style":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Style","description":"Director style preset (ultra/pro): newscaster | smile | whisper | storyteller | hype | deadpan."},"pace":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Pace","description":"Director pace preset (ultra/pro): natural | rapid | drift | staccato."},"accent":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Accent","description":"Director accent preset (ultra/pro): american | british | australian."},"note":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Note","description":"Free-text director's note, up to 300 characters (ultra/pro)."},"exaggeration":{"anyOf":[{"type":"number","maximum":2.0,"minimum":0.25},{"type":"null"}],"title":"Exaggeration","description":"Expressive only: emotion intensity."},"cfg_weight":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Cfg Weight","description":"Expressive only: pacing adherence."},"format":{"type":"string","pattern":"^(wav|mp3)$","title":"Format","description":"Output container: mp3 (default) or wav.","default":"mp3"}},"type":"object","required":["text"],"title":"V1TTSRequest"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"ApiKey":{"type":"http","scheme":"bearer","bearerFormat":"lf_sk_..."}}},"security":[{"ApiKey":[]}]}