TTS Audio & AI Images
Reference for text-to-speech MP3 synthesis, word-level subtitle timestamps, AI image generation and reference editing, and prompt polish endpoints.
Text-to-Speech POST /api/partner/v1/audio/speech
Synthesizes input text into 128 kbps MP3 audio. Markdown syntax, fenced code blocks, tables, citation blocks, and raw URLs are stripped automatically into natural spoken prose; if no spoken text remains, the endpoint returns 400 SPEECH_TEXT_INVALID. Recommended client read timeout: >= 90 seconds.
Request Body (JSON, strict, <= 16 KB)
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
text | string | Yes | - | 1-600 trimmed chars; split longer articles by sentence boundaries |
voice | string | No | "feifei" | Voice alias: "feifei" (default), "yutong", "zixuan" |
stream | boolean | No | false | false returns full buffered MP3; true streams chunked audio/mpeg |
user_id | string | No | - | 1-128 chars, optional anonymous user ID for per-user rate isolation |
Success Response (HTTP 200)
- Body: Binary MP3 audio (
Content-Type: audio/mpeg). - Headers:
X-Audio-Format: mp3,X-Speech-Voice: feifei | yutong | zixuan,X-Content-Type-Options: nosniff,Cache-Control: no-store(X-Accel-Buffering: nowhenstream: true).
curl --max-time 90 "https://feixiaohao.io/api/partner/v1/audio/speech" \
-H "Authorization: Bearer $PARTNER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Welcome to the daily digital asset market briefing.","voice":"feifei","user_id":"u_anon_9f2c1a8b"}' \
--output brief.mp3Speech with Word Timestamps POST /api/partner/v1/audio/speech-with-timestamps
Returns Base64-encoded MP3 audio, total duration, and millisecond-accurate word timing for synchronized subtitles or voiceover playback.
- Body (JSON, strict, <= 16 KB):
text(required, 1-600 chars),voice(optional),language(optional:"zh","en","ko"),user_id(optional). - Response (HTTP
200,application/json):
{
"format": "mp3",
"media_type": "audio/mpeg",
"voice": "feifei",
"duration_ms": 2450,
"audio_base64": "//uQxAAAAAANIAAAAAExBTUUzLjEwMFVVVVVV...",
"words": [
{ "text": "Welcome", "start_ms": 0, "end_ms": 420 },
{ "text": "to", "start_ms": 420, "end_ms": 580 }
]
}AI Image Generation & Editing POST /api/partner/v1/images/generations
Supports text-to-image generation and editing with up to 3 reference images. Accepts both application/json and multipart/form-data. Server max execution time is 260 seconds; set HTTP read timeout to >= 270 seconds.
Request Parameters
Body size ceilings: 64 KB for JSON without references, 28 MB for JSON with Base64 references, and 24.25 MB for multipart/form-data (repeated file field references):
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | string | Yes | - | 1-6,000 trimmed chars (no control characters) |
style | string | No | "auto" | Visual style preset (see list below) |
aspect_ratio | string | No | "square" | square, landscape, portrait, wide, tall |
quality | string | No | Server default | auto, low, medium, high (unsupported values return 422 IMAGE_SPEC_UNSUPPORTED) |
transparent | boolean | No | false | Output transparent PNG ("true" or "1" in multipart) |
response_format | string | No | "b64_json" | "b64_json" (JSON envelope) or "binary" (raw image/png bytes) |
user_id | string | No | - | 1-128 chars, optional anonymous user ID for per-user daily cap |
request_id | string | No | Auto-generated | 1-100 chars (^[A-Za-z0-9_-]+$), echoed for tracing (images are not cached/replayed) |
references | ImageInput[] or files | No | - | 1-3 PNG, JPEG, or WebP reference images (<= 8 MB each, <= 20 MB total) |
Recommended style Presets
auto, minimal-fintech, 3d-render, photorealistic, infographic, flat-illustration, movie-poster, cyberpunk, anime, guofeng, watercolor, pixel-art.
Success Response (HTTP 200)
response_format: "b64_json"(default):
{
"request_id": "req-img-001",
"format": "png",
"media_type": "image/png",
"width": 1024,
"height": 1024,
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA...",
"elapsed_ms": 14820
}response_format: "binary": Returns rawContent-Type: image/pngbytes withX-Request-Id,X-Content-SHA256,X-Image-Width,X-Image-Height, andX-Image-Format: png. Generated images are not persisted server-side; store them in your own object storage if needed.
Prompt Polish & Inspiration POST /api/partner/v1/images/polish
Refines a rough draft into a high-craft image prompt (polish mode), or generates a fresh creative prompt when prompt is empty or omitted (inspire mode). Accepts up to 3 PNG/JPEG/WebP reference images to incorporate visual cues.
- Body (JSON, strict; <= 64 KB without references, <= 28 MB with references):
prompt(0-6,000 chars),style,style_hint(<= 300 chars),aspect_ratio,lang("zh"default or"en"),previous_prompt,user_id,references. - Response (HTTP
200):
{
"prompt": "Minimalist deep-navy fintech research cover with fine golden light trajectories, subtle frosted glass depth, generous negative space, soft studio lighting",
"mode": "polish",
"source": "model",
"analyzed_references": 1
}