> For the complete documentation index, see [llms.txt](https://anyint.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://anyint.gitbook.io/docs/api-reference/media-apis.md).

# media apis

AnyInt currently publishes media-generation routes through DashScope. These are not chat-completion endpoints. They have their own request bodies, and video generation is task-based.

## Published routes

| Route                                                               | Purpose                            |
| ------------------------------------------------------------------- | ---------------------------------- |
| `POST /v1/dashscope/services/aigc/multimodal-generation/generation` | Prompt-driven image generation     |
| `POST /v1/dashscope/services/aigc/video-generation/video-synthesis` | Prompt, image, and audio to video  |
| `GET /v1/dashscope/tasks/{task_id}`                                 | Query video task status and result |

## Authentication

```http
Authorization: Bearer <ANYINT_API_KEY>
```

## DashScope image generation

### Core request shape

The published schema expects:

* `model`
* `input.messages`
* `parameters.size`
* optional image controls such as `negative_prompt`, `prompt_extend`, and `watermark`

### cURL example

```bash
curl https://gateway.api.anyint.ai/v1/dashscope/services/aigc/multimodal-generation/generation \
  -H "Authorization: Bearer $ANYINT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-image-plus",
    "input": {
      "messages": [
        {
          "role": "user",
          "content": [
            {
              "text": "A cinematic product poster for an AI music launch, neon highlights, premium studio lighting."
            }
          ]
        }
      ]
    },
    "parameters": {
      "negative_prompt": "",
      "prompt_extend": true,
      "watermark": false,
      "size": "1328*1328"
    }
  }'
```

Useful response fields:

* `output.choices[0].message.content[].image`
* `usage.width`
* `usage.height`
* `usage.image_count`

## DashScope video generation

### Core request shape

The current schema expects:

* `model`
* `input.prompt`
* `input.img_url`
* `input.audio_url`
* `parameters.resolution`
* `parameters.duration`
* `parameters.audio`
* `parameters.shot_type`

### cURL example

```bash
curl https://gateway.api.anyint.ai/v1/dashscope/services/aigc/video-generation/video-synthesis \
  -H "Authorization: Bearer $ANYINT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan2.5-i2v-preview",
    "input": {
      "prompt": "A graffiti rapper comes to life under a railway bridge at night and performs to the beat.",
      "img_url": "https://example.com/source-image.png",
      "audio_url": "https://example.com/source-audio.mp3"
    },
    "parameters": {
      "resolution": "720P",
      "prompt_extend": true,
      "duration": 10,
      "audio": true,
      "shot_type": "multi"
    }
  }'
```

### Response pattern

This is a task-based API. The response returns:

* `output.task_id`
* `output.task_status`
* `metadata.provider`

## Video task query

The current catalog shows a task query path in the form:

`GET /v1/dashscope/tasks/{task_id}`

Apifox currently includes one sample task ID directly in the example path. Treat that as a path template rather than a fixed ID.

### Query example

```bash
curl https://gateway.api.anyint.ai/v1/dashscope/tasks/your-task-id \
  -H "Authorization: Bearer $ANYINT_API_KEY"
```

### Query response fields

| Field                  | Meaning                                   |
| ---------------------- | ----------------------------------------- |
| `output.task_status`   | Current task state                        |
| `output.video_url`     | Generated video URL after success         |
| `output.actual_prompt` | Prompt used after provider-side expansion |
| `usage.duration`       | Generated duration                        |
| `usage.video_count`    | Number of outputs                         |

In the published examples, video tasks move from `PENDING` to `SUCCEEDED`.

### HappyHorse video generation

HappyHorse is available through the DashScope-compatible video synthesis API. Create a video task first, then poll the task endpoint until `output.task_status` becomes `SUCCEEDED`. Use `happyhorse-1.0-t2v` as the model. The request can include a prompt, a source image URL, and a source audio URL. The initial response returns `request_id` for tracing and `output.task_id` for result polling.

#### Create a video task

```bash
curl --location --request POST 'https://gateway.api.anyint.ai/dashscope/v1/services/aigc/video-generation/video-synthesis' \
  --header "Authorization: Bearer $ANYINT_API_KEY" \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "model": "happyhorse-1.0-t2v",
    "input": {
      "prompt": "An urban fantasy scene in cinematic style. A graffiti-painted teenage rapper comes alive from a concrete wall under a railway bridge at night, performs a fast English rap, and strikes an energetic classic rapper pose. The only audio is the rap, with no extra dialogue or noise.",
      "img_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png",
      "audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"
    },
    "parameters": {
      "resolution": "720P",
      "prompt_extend": true,
      "duration": 10,
      "audio": true,
      "shot_type": "multi"
    }
  }'
Response example:
{
  "request_id": "570dd72c-52ae-9151-b819-411edf66069e",
  "output": {
    "task_id": "c25723f0-8f2b-401a-b843-7ae05ae4e5e3",
    "task_status": "PENDING"
  }
}
Query the generated video
Use the output.task_id from the previous response:
curl --location --request GET "https://gateway.api.anyint.ai/dashscope/v1/tasks/$TASK_ID" \
  --header "Authorization: Bearer $ANYINT_API_KEY"
Response example:
{
  "request_id": "1e1fb115-c22a-9769-af2c-056451a8f692",
  "output": {
    "task_id": "a54b0585-aa49-45be-8786-fc46414634da",
    "task_status": "SUCCEEDED",
    "submit_time": "2026-04-27 17:01:39.657",
    "scheduled_time": "2026-04-27 17:01:39.689",
    "end_time": "2026-04-27 17:07:10.758",
    "orig_prompt": "An urban fantasy scene in cinematic style...",
    "video_url": "https://example.com/generated-video.mp4"
  },
  "usage": {
    "duration": 10,
    "input_video_duration": 0,
    "output_video_duration": 10,
    "video_count": 1,
    "SR": 720,
    "ratio": "16:9"
  }
}
```

Copy output.video\_url into a browser to preview or download the generated video. Video URLs are temporary, so save the file if you need to keep it.

## When to use media APIs vs AI Music

Use media APIs for:

* image generation
* prompt-to-video
* image-plus-audio-to-video

Use [AI Music](/docs/ai-music/overview.md) for:

* song generation
* cover workflows
* personas
* lyrics
* stems
* music video generation tied to Suno tasks

## Common mistakes

* Treating the example task ID in Apifox as a fixed route
* Assuming video generation returns the final MP4 in the initial response
* Reusing Gemini image-generation payloads against DashScope routes
