3.6 KiB
3.6 KiB
Yuanjing API Documentation
LLM API
Base url: https://token.opencomputing.cn/llmage/v1
All endpoints require Bearer Token authentication.
POST /v1/chat/completions
Text generation endpoint, OpenAI-compatible.
Required Parameters
| Parameter | Type | Description |
|---|---|---|
model |
string | Model name, e.g. "qwen3-max" |
messages or prompt |
array / string | Conversation messages or text prompt |
Optional Parameters
| Parameter | Type | Description |
|---|---|---|
catelogid |
string | Catalog type ID, default "t2t", Chinese names supported |
stream |
boolean | Enable streaming output |
off_peak |
boolean | Use off-peak pricing |
transno |
string | Transaction ID (auto-generated if omitted) |
Example Request
{
"model": "qwen3-max",
"messages": [
{"role": "user", "content": "Hello"}
],
"stream": false
}
# Non-streaming
curl -X POST 'https://token.opencomputing.cn/llmage/v1/chat/completions' \\n -H 'Authorization: Bearer ***' \\n -H 'Content-Type: application/json' \\n -d '{\\n \"model\": \"qwen3-max\",\\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello, introduce yourself\"}],\\n \"stream\": false\\n }'
# Streaming
curl -X POST 'https://token.opencomputing.cn/llmage/v1/chat/completions' \\n -H 'Authorization: Bearer ***' \\n -H 'Content-Type: application/json' \\n -d '{\\n \"model\": \"qwen3-max\",\\n \"messages\": [{\"role\": \"user\", \"content\": \"Write a poem about spring\"}],\\n \"stream\": true\\n }'
Response Format
Non-streaming:
{
"id": "luid_xxx",
"object": "chat.completion",
"model": "qwen3-max",
"choices": [{
"index": 0,
"message": {"role": "assistant", "content": "Hi there!"},
"finish_reason": "stop"
}],
"usage": {"prompt_tokens": 10, "completion_tokens": 5, "total_tokens": 15}
}
Streaming (SSE):
data: {"choices": [{"delta": {"content": "Hi"}, "index": 0}]}
data: {"choices": [{"delta": {"content": " there!"}, "index": 0}]}
data: [DONE]
Error Responses
| Status | Description |
|---|---|
| 400 | Missing required parameters or model not found |
| 403 | Not authenticated |
| 429 | Insufficient account balance |
POST /v1/video/generations
Video generation endpoint.
Required Parameters
| Parameter | Type | Description |
|---|---|---|
model |
string | Model name, e.g. "keling-2.1" |
catelogid |
string | Catalog type: "t2v" / "i2v" / "r2v" |
prompt |
string | Generation prompt |
Optional Parameters
| Parameter | Type | Description |
|---|---|---|
image_url |
string | Reference image URL for I2V |
duration |
string | Video duration, e.g. "5s" |
resolution |
string | Resolution, e.g. "1080p" |
n |
integer | Number of generations |
transno |
string | Transaction ID |
Example Request
{
"model": "keling-2.1",
"catelogid": "t2v",
"prompt": "A beautiful sunset over the ocean",
"duration": "5s",
"resolution": "1080p"
}
Response Format
Video generation is typically async:
{
"id": "luid_xxx",
"object": "video.generation",
"model": "keling-2.1",
"status": "submitted",
"taskid": "task_xxx",
"created": 1716912000
}
Query task status via /v1/tasks?taskid=xxx.
For detailed model-specific parameters (Vidu, Seedance, Wan, Kling, Hailuo, HappyHorse), see the Chinese documentation.