# ASOP API Reference

Base URL: `https://asop.uk/api/v1`  
Auth: `Authorization: Bearer asop-...`  
Create tokens: https://asop.uk/api  
Credits: same wallet as the Create page. Failed generations are refunded.

OpenAI-compatible relay. Chat is synchronous. KREA2, REDQW21 (Qwen Image 2.1), and video use async jobs. `GET /models` lists **currently available** Create-page IDs only.

## Catalog (live)

Typical currently listed IDs:

| Model ID | Kind | Access | Typical call |
| --- | --- | --- | --- |
| `prompt-assist` | chat / reverse-prompt | `POST /chat/completions` | max_tokens 1024 |
| `heishou-krea2` | text-to-image (async) | `POST /jobs` or `POST /images/generations` | 2:3 · 6MP · `krea2Mode` story/live/cute |
| `redqw21-unlocked` | text-to-image / edit / ref (async) | `POST /jobs` or `POST /images/generations` | 2:3 · 1.5MP · pack required. Aliases: `qwenimage2.1`, `qwen-image-2.1`, `qw21`, `redqw21` |
| `heishou-h3` | reference-to-video | `POST /videos/generations` | 2:3 · 10s · `h3Mode` hd/fast/raw/series |
| `hongchao-h3` | reference-to-video | `POST /videos/generations` | 10s · 768P · stricter policy |

Official Image3 / Dream5 / Dance2 / X3 / H3 MAX are **delisted** on Create and omitted from `GET /models`. Do not send those IDs.

Live quotes: `GET /api/asop/docs/quotes` (same estimator as Create).

## GET /models

Returns `{ object: "list", data: [...] }` with `id`, `kind`, `output_type`, `endpoints`, `sync`, `require_pack`, `aliases`. Video `kind` is `ref-video`. Image-edit models expose `kind: text-image`.

## POST /chat/completions

Model must be `prompt-assist`. Overseas content policy. Vision via `image_url` (reverse-prompt).

| Field | Required | Notes |
| --- | --- | --- |
| model | yes | `prompt-assist` |
| messages | yes | OpenAI messages |
| stream | no | SSE when true |
| max_tokens | no | 16–4096, default 1024 |
| temperature | no | default 0.7 |
| top_p | no | optional |

## POST /images/generations

Listed image models. KREA2 and REDQW21 return `{ object: "image.generation.job", id, status }` — poll `GET /jobs/{id}`. Default model is `heishou-krea2`.

| Field | Required | Notes |
| --- | --- | --- |
| model | no | default `heishou-krea2`. Also `redqw21-unlocked` / `qwenimage2.1` |
| prompt | yes | max 8000 chars |
| size | no | `WxH` or a resolution tier |
| aspect_ratio | no | `2:3` `3:2` `3:4` `4:3` `1:1` `16:9` `9:16` `21:9` |
| image_resolution | no | KREA2: `2K`/`6MP`/`12MP` (default 6MP). REDQW21: `1.5MP`/`4MP`/`8MP` (default 1.5MP) |
| krea2Mode | no | `heishou-krea2` only: `story` / `live` / `cute` |
| imageGenMode | no | `redqw21-unlocked` only: `txt2img` / `edit` / `ref`. One image without mode → `edit` |
| redqw21PromptEnhance | no | default `true` |
| images | no | REDQW21/KREA2 reference file ids (from `POST /files`) |
| response_format | no | sync-only models: `b64_json` or `url` |
| negative_prompt | no | optional |
| seed | no | optional. Omit for random |

`size` examples: `1024x1024` → 1:1, `1024x1536` → 2:3, `1536x1024` → 3:2, `1024x1792` → 9:16, `1792x1024` → 16:9.

## POST /files

Upload a reference image, video, or audio. Returns `file_id`. Images/audio max 32MB, video max 180MB.

```bash
curl https://asop.uk/api/v1/files \
  -H "Authorization: Bearer $ASOP_API_KEY" \
  -F "file=@ref.png" \
  -F "purpose=reference"
```

Raw upload: `POST` or `PUT` with `Content-Type` and `X-Filename`.

## POST /jobs and GET /jobs/:id

Unified async entry for KREA2, REDQW21, and all listed video models.

| Field | Required | Notes |
| --- | --- | --- |
| model | yes | any listed image or video ID (or alias) |
| prompt | yes | max 8000 chars |
| aspect_ratio | no | H3 default `2:3`; other video default `9:16` |
| duration | no | video seconds (clamped per model; H3 also depends on `h3Mode`) |
| h3Mode | no | `heishou-h3` only: `hd` (max 20s), `fast` (max 30s), `raw` (max 15s, 768P/480P), `series` (max 20s). Default `hd` |
| resolution | no | video tier |
| image_resolution | no | image models |
| seed | no | optional. Omit for random |
| images / videos / audios | no | file id arrays. Or `files: [{id, type}]` |

Status: `queued` | `processing` | `completed` | `failed`.  
`GET /jobs/:id/content` returns a 1-hour signed URL (`?redirect=1` to follow).

## POST /videos/generations

Same as `POST /jobs`, but the model must be reference-to-video. At least one image or video. Audio needs a visual.

| Model ID | Inputs | Duration | Resolution | Policy |
| --- | --- | --- | --- | --- |
| `heishou-h3` | image ≤9, video ≤3, audio ≤3 | HD 5–20s, FAST 5–30s, RAW 5–15s, SERIES 5–20s, default 10 | HD/FAST/SERIES: 3MP locked. RAW: `768P`/`480P`. Default aspect `2:3`. `h3Mode`: hd / fast / raw / series | overseas |
| `hongchao-h3` | references | 5–15s, default 10 | 480P / 768P / 2K / 4K | stricter |

Mixed assets: max 12 files.

## Errors

- 401 invalid token
- 400 bad model / missing fields
- 402 insufficient credits
- 403 REDQW21 pack not eligible
- 404 job or file not found
- 409 job not completed
- 410 output expired
- 429 generation line full
- 502 generation failed (refunded)
