Guide
API Overview
All public APIs, authentication methods, and links to detailed documentation
API Overview
The base URL is always https://locopalai.com, and all APIs use the same platform API key. For shared conventions (authentication, response structure, pagination, rate limiting, idempotency), see Authentication and Common Conventions.
Models and generation APIs
| Purpose | Method | Path | Details |
|---|---|---|---|
| Query available models | GET | /v1/models | Models and Text API |
| Text chat (including streaming) | POST | /v1/chat/completions | Models and Text API |
| Image generation | POST | /v1/images/generations | Image Generation API |
| Text-to-speech | POST | /v1/audio/speech | Text-to-Speech API |
| Create a video task | POST | /v1/video/generations | Video Generation API |
| Query a video task | GET | /v1/video/generations/{task_id} | Video Generation API |
| Create a video task (OpenAI-compatible form) | POST | /v1/videos | Video Generation API |
| Query a video task (OpenAI-compatible form) | GET | /v1/videos/{task_id} | Video Generation API |
Asset library APIs
All asset library APIs use the API key and return a uniform success response: { "code": 0, "data": ..., "msg": "..." }.
| Purpose | Method | Path | Details |
|---|---|---|---|
| Query asset groups | GET | /api/v1/materials/groups | Asset Groups |
Create an asset group (virtual / real) | POST | /api/v1/materials/groups | Asset Groups |
Query the asset list (supports group_id and pagination) | GET | /api/v1/materials/assets | Assets |
Submit an image asset (image_url or data_url) | POST | /api/v1/materials/assets | Assets |
| Query a single asset's status | GET | /api/v1/materials/assets/{asset_id} | Assets |
| Sync asset status | POST | /api/v1/materials/sync | Sync Asset Status |
| Create a portrait QR code authorization session | POST | /api/v1/materials/portrait/sessions | Portrait Asset Authorization |
| Confirm portrait QR code completion | POST | /api/v1/materials/portrait/resolve | Portrait Asset Authorization |
For detailed parameters, examples, and error descriptions, see Asset Library API Overview.
Typical call flows
Models and video
GET /v1/models
→ POST /v1/video/generations
→ GET /v1/video/generations/{task_id}After creating a task, you must save the task ID; if the network is interrupted, keep querying the original task instead of creating a new one.
Text-to-speech
GET /v1/models
→ POST /v1/audio/speech
→ 保存二进制音频响应Whether the audio API is available and which voice and response_format values are supported depend on the current key's model catalog and the actual model capabilities.
Virtual assets
POST /api/v1/materials/groups
→ POST /api/v1/materials/assets
→ GET /api/v1/materials/assets/{asset_id} (轮询到 status 为 Active)
→ 在视频 content 中使用 asset://<asset_id>Portrait assets
POST /api/v1/materials/groups {"type":"real"}
→ POST /api/v1/materials/portrait/sessions (拿到二维码链接)
→ 由真人本人扫码完成采集
→ POST /api/v1/materials/portrait/resolve
→ POST /api/v1/materials/sync
→ 查询素材状态后用于支持真人素材库的模型For an end-to-end example, see Portrait Assets and Reference Video Integration Workflow; for the capability boundaries of multiple images and reference videos, see Multiple Images and Reference Videos.
Responses and errors
| API type | Success | Failure |
|---|---|---|
| Model / image / video | Returns the result object directly | HTTP non-2xx; read error.message |
| Asset library | { "code": 0, "data": ..., "msg": "OK" } | HTTP status code matches code |
Clients must check both the HTTP status and the response body. For the complete list of error codes and troubleshooting steps, see Error Codes and Troubleshooting.
