# Image, audio, video, and retrieval integration

> Part of the ChinaAPI documentation. HTML: https://dash.chinaapi.ai/docs/multimodal/

These capabilities use the same Base URL and bearer key as chat, but each one has its own endpoint and payload. The model IDs below are working examples; check **Console → Models** for the latest model catalog before shipping.

## Image generation

POST /v1/images/generations

Send a JSON prompt. Read the generated asset from `data[0].url`, or from `data[0].b64_json` when the selected model returns base64.

**Key parameters:** `prompt` and `model` are required. Use `size` for resolution, `n` for image count, and `response_format` for `url` or `b64_json`. `quality` and `style` are model-specific; common values include `standard`, `hd`, or `auto`.

**curl · image**

```
curl https://api.chinaapi.ai/v1/images/generations \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-4-5-251128",
    "prompt": "A cinematic skyline at blue hour",
    "size": "1024x1024",
    "response_format": "url",
    "n": 1
  }'
```

## Gemini image generation

POST /v1/chat/completions

Gemini image models use the OpenAI Chat Completions request shape. Read the generated Markdown image from `choices[0].message.content`; the image payload is a `data:image/...` URL.

**Key parameters:** send the signed-in catalog model ID in `model` and the image prompt in `messages`. Do not send this model to `/v1/images/generations`.

**curl · Gemini image chat**

```
curl https://api.chinaapi.ai/v1/chat/completions \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<GEMINI_IMAGE_MODEL>",
    "messages": [
      {
        "role": "user",
        "content": "Generate a cinematic skyline at blue hour"
      }
    ],
    "stream": false
  }'
```

## Speech to text

POST /v1/audio/transcriptions

Upload audio as multipart form data; do not set the `Content-Type` header manually. The recognized text is returned in the `text` field.

**Key parameters:** send `model` and `file` as multipart fields. Use `response_format` as `json`, `text`, or `verbose_json` when supported by the selected model.

**curl · transcription**

```
curl https://api.chinaapi.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -F "model=qwen3-asr-flash" \
  -F "file=@speech.wav" \
  -F "response_format=json"
```

## Text to speech

POST /v1/audio/speech

The response body is binary audio, so write it to a file. `alloy` selects the model's default voice; a model may also publish provider-specific voice IDs.

**Key parameters:** use `input`, `model`, and `voice`. Select an output with `response_format` such as `mp3` or `wav`; `speed` and `instructions` are available when the selected model supports them.

**curl · speech**

```
curl https://api.chinaapi.ai/v1/audio/speech \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mimo-v2.5-tts",
    "input": "Hello from ChinaAPI.",
    "voice": "alloy",
    "response_format": "mp3"
  }' \
  --output speech.mp3
```

## Video generation

POST /v1/video/generations

Video generation is asynchronous. Submit once, save the returned `task_id`, then poll `GET /v1/video/generations/{task_id}` until the task succeeds or fails. Creating a task can consume quota.

**Key parameters:** `prompt` and `model` start the task. Use `duration`, `width`, `height`, `fps`, and `n` where supported. Resolution is the common clarity control. Put provider-specific controls such as `quality`, `quality_level`, `negative_prompt`, or camera settings in `metadata` only when they are listed for that model.

**curl · video**

```
curl https://api.chinaapi.ai/v1/video/generations \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "happyhorse-1.1-t2v",
    "prompt": "A paper boat crossing a moonlit lake",
    "duration": 5,
    "width": 1280,
    "height": 720
  }'

curl https://api.chinaapi.ai/v1/video/generations/$TASK_ID \
  -H "Authorization: Bearer $CHINAAPI_KEY"
```
