sage/wwwroot/public/api/api_en.md

22 KiB

Yuanjing Platform API

Yuanjing Platform provides downstream systems with an API compatible with the OpenAI interface protocol. To enable the API, downstream systems need to follow these steps:

  • Register an account
  • Log in
  • Apply for APIKEY
  • Recharge (Top-up)

After completing the above steps, you can implement inference services for Text-to-Text, Text-to-Video, Image-to-Video, and Reference-to-Video according to the following examples.

For models supported by the Yuanjing platform, please refer to the Model Square.

Apply for APIKEY

Users need to log in via mobile on the Yuanjing platform (https://ai.opencomputing.cn) and click "Create APIKEY".

Enter the information and click submit, and the APIKEY creation is complete.

Click "Copy apikey", see the apikey in the pop-up window, and copy it.

Recharge

Users need to recharge on the Yuanjing platform. Currently, Alipay is supported.

View Current Balance

  • User Login
  • Call up user menu
  • Click "Finance"

API Base URL

https://opencomputing.ai

OpenAI Compatible Interface

We provide a set of APIs compatible with OpenAI.

Text Generation

  • path: /llmage/v1/chat/completions
  • method: 'POST'
  • headers
{
    "Content-Type": "application/json",
    "Authorization": "Bearer <your-apikey>"                # APIKEY applied by the customer from the Yuanjing platform
}
  • data { "model": # Model ID, the name provided by the supplier "prompt": # Prompt, must be entered "sys_prompt" # System prompt, optional "stream" # Stream output switch "..." # Other prompts }

  • Return Streaming or non-streaming results conforming to the OpenAI protocol.

  • Streaming:

./oc.curl 你是谁
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"logprobs": null, "index": 0, "delta": {"content": "", "role": "assistant"}}], "model": "qwen3-max", "reasoning_content": null, "content": "", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u6211\u662f", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u6211\u662f", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u901a\u4e49\u5343", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u901a\u4e49\u5343", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u95ee\uff0c\u963f\u91cc\u5df4\u5df4\u96c6\u56e2\u65d7\u4e0b\u7684", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u95ee\uff0c\u963f\u91cc\u5df4\u5df4\u96c6\u56e2\u65d7\u4e0b\u7684", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u8d85\u5927\u89c4\u6a21\u8bed\u8a00\u6a21\u578b\u3002\u6211\u80fd\u591f", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u8d85\u5927\u89c4\u6a21\u8bed\u8a00\u6a21\u578b\u3002\u6211\u80fd\u591f", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u56de\u7b54\u95ee\u9898\u3001\u521b\u4f5c\u6587\u5b57\uff0c", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u56de\u7b54\u95ee\u9898\u3001\u521b\u4f5c\u6587\u5b57\uff0c", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u6bd4\u5982\u5199\u6545\u4e8b\u3001\u5199\u516c", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u6bd4\u5982\u5199\u6545\u4e8b\u3001\u5199\u516c", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u6587\u3001\u5199\u90ae\u4ef6\u3001\u5199\u5267\u672c", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u6587\u3001\u5199\u90ae\u4ef6\u3001\u5199\u5267\u672c", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u3001\u903b\u8f91\u63a8\u7406\u3001\u7f16\u7a0b\u7b49\u7b49", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u3001\u903b\u8f91\u63a8\u7406\u3001\u7f16\u7a0b\u7b49\u7b49", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\uff0c\u8fd8\u80fd\u8868\u8fbe\u89c2\u70b9\uff0c\u73a9\u6e38\u620f", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\uff0c\u8fd8\u80fd\u8868\u8fbe\u89c2\u70b9\uff0c\u73a9\u6e38\u620f", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u7b49\u3002\u5982\u679c\u4f60\u6709\u4efb\u4f55\u95ee\u9898\u6216", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u7b49\u3002\u5982\u679c\u4f60\u6709\u4efb\u4f55\u95ee\u9898\u6216", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\u9700\u8981\u5e2e\u52a9\uff0c\u6b22\u8fce\u968f\u65f6\u544a\u8bc9\u6211", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\u9700\u8981\u5e2e\u52a9\uff0c\u6b22\u8fce\u968f\u65f6\u544a\u8bc9\u6211", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "\uff01", "role": null}, "index": 0}], "model": "qwen3-max", "reasoning_content": null, "content": "\uff01", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [{"delta": {"content": "", "role": null}, "index": 0, "finish_reason": "stop"}], "model": "qwen3-max", "reasoning_content": null, "content": "", "finish": "0", "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: {"id": "chatcmpl-2665dfd8-e05f-9d7f-adff-3c53c174a454", "object": "chat.completion.chunk", "created": 1775019761, "choices": [], "model": "qwen3-max", "finish": "1", "usage": {"total_tokens": 70, "completion_tokens": 60, "prompt_tokens": 10, "prompt_tokens_details": {"cached_tokens": 0}}, "llmusageid": "K9_veNBxeqvrFfbGWXs0R"}
data: [DONE]
  • Non-streaming
./oc.curl 你是谁
{"id": "chatcmpl-eea7abb9-24d5-9f70-b6f6-d7da4f22a8b8", "object": "chat.completion", "created": 1775011902, "choices": [{"finish_reason": "stop", "index": 0, "message": {"content": "我是通义千问,阿里巴巴集团旗下的超大规模语言模型。我能够回答问题、创作文字,比如写故事、写公文、写邮件、写剧本、逻辑推理、编程等等,还能表达观点,玩游戏等。如果你有任何问题或需要帮助,欢迎随时告诉我!", "role": "assistant"}}], "model": "qwen3-max", "reasoning_content": null, "content": "我是通义千问,阿里巴巴集团旗下的超大规模语言模型。我能够回答问题、创作文字,比如写故事、写公文、写邮件、写剧本、逻辑推理、编程等等,还能表达观点,玩游戏等。如果你有任何问题或需要帮助,欢迎随时告诉我!", "finish": "1", "usage": {"completion_tokens": 60, "prompt_tokens": 10, "prompt_tokens_details": {"cached_tokens": 0}, "total_tokens": 70}}

Text-to-Video

Currently supported:

Model ID Provider Model Name
o5vfXYD5BURJWRTWpopE5 Alibaba Cloud happyhorse-1.0-t2v
YjjGgxO_Xma8PWsMjJvps Doubao doubao-seedance-2-0-260128
TWay-xd0p0pkEX-_Kuhto We Token AI dreamina-seedance-2-0-260128(*), dreamina-seedance-2-0-fast-260128
CrEMkFQfRCmbmopZsCqLj Doubao doubao-seedance-1-5-pro-251215
CrEMkFQfRCmbmopZsCqLj Doubao doubao-seedance-1-5-pro-251215
u9HZyfDoqU6uKI6M1BTks Tongyi Wanxiang wan2.6-t2v
r0ill7L0s6PtBS8mkmg-7 vidu viduq3-pro
YjjGgxO_Xma8PWsMjJvps Doubao eedance2.0 (Not enabled)

happyhorse-1.0-t2v Upload Data Requirements

Field (Name) Type Required Default Description
llmid Model ID Yes - -
model Model Name No happyhorse-1.0-t2v -
prompt string Yes - Prompt words. Used to describe the video content you want to generate.
resolution string No 720p Video size. Specify the resolution of the generated video.
Optional values:
480p, 720p, 1080p
ratio string No adaptive Optional: adaptive, 16:9, 4:3, 1:1, 3:4, 9:16, 21:9
duration integer No 5 Video duration. Specify the length of the generated video (seconds).
Optional values: integer seconds

seedance 2.0 Upload Data Requirements

Field (Name) Type Required Default Description
llmid Model ID Yes - -
model Model Name No doubao-seedance-2-0-260128 doubao-seedance-2-0-260128 or doubao-seedance-2-0-fast-260128
prompt string Yes - Prompt words. Used to describe the video content you want to generate.
resolution string No 720p Video size. Specify the resolution of the generated video.
Optional values:
480p, 720p, 1080p
ratio string No adaptive Optional: adaptive, 16:9, 4:3, 1:1, 3:4, 9:16, 21:9
duration integer No 5 Video duration. Specify the length of the generated video (seconds).
Optional values: integer seconds

Wanxiang Upload Data Requirements

Field (Name) Type Required Default Description
llmid Model ID Yes - -
model Model Name No (Starred) -
prompt string Yes - Prompt words. Used to describe the video content you want to generate.
negative_prompt string No (empty) Negative prompt words. Used to describe content you want to avoid in the video.
size string No 1920*1080 Video size. Specify the resolution of the generated video.
Optional values:
832*480, 480*832, 624*624, 1280*720, 720*1280, 960*960, 1088*832, 832*1088, 1920*1080, 1080*1920, 1440*1440, 1632*1248, 1248*1632
duration integer No 15 Video duration. Specify the length of the generated video (seconds).
Optional values:
5, 10, 15

Vidu Upload Parameters

Field (Name) Type Required Default Description
llmid Model ID Yes - -
prompt string Yes - Prompt words. Used to describe the content of the generated video.
off_peak string No N Off-peak execution. Whether to enable non-peak hour generation.
Optional values: Y (Yes), N (No)
duration integer No 10 Video length. The duration of the generated video (seconds).
Range: 1-16 seconds (according to field description)
ratio string No 16:9 Aspect ratio. Specify the video's picture ratio.
Optional values:
16:9, 9:16, 4:3, 3:4, 1:1
resolution string No 1080p Resolution. Specify the clarity of the generated video.
Optional values:
540p, 720p, 1080p

Seedance Upload Data Requirements

Field Type Required Default Description
llmid Model ID Yes - -
prompt string Yes - Prompt words. Describe the content of the generated video.
radio string No - Aspect ratio. Specify the aspect ratio of the video.
Optional values:
16:9, keep_ratio, 4:3, 1:1, 3:4, 9:16, 9:21, 21:9, adaptive
resolution string No 1080p Resolution. Specify video clarity.
Optional values:
480p, 720p, 1080p
duration integer No 12 Video length. Video duration (seconds).

Example

Example using seedance:

#!/usr/bin/env bash
curl -X POST https://opencomputing.ai/llmage/video \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-apikey-from-opencomputing.ai" \
  -d '{
        "llmid": "CrEMkFQfRCmbmopZsCqLj",
        "prompt": "小猫在抓老鼠",
        "duration": 5,
        "ratio": "16:9",
        "resolution": "480p"
    }'

Image-to-Video

Model ID Provider Model Name Function
7y7kfYM0Xasizyi37WvAZ Alibaba Cloud happyhorse-1.0-i2v Text/Image to Video
UeYax4591ytnPcr9eumry Doubao doubao-seedance-2-0-260128 Text/Image to Video
tb0VSY6WeyGbzaolU1_qE We Token AI dreamina-seedance-2-0-fast-260128, dreamina-seedance-2-0-260128 Text/Image to Video
7RTOJD6K8A7RXCMG4GnQ9 Doubao doubao-seedance-1-5-pro-251215 Text/Image to Video
7RTOJD6K8A7RXCMG4GnQ9 Doubao doubao-seedance-1-5-pro-251215 Text to Video
FK_h7FLYnosv2TkMN4ATC vidu viduq3-pro Text/Image to Video
x4HksKp9mXR1Yv60mw6Py Tongyi Wanxiang wan2.6-r2v Text/Image to Video

Happy Horse Upload Data Requirements

The interface only supports first-frame-to-video.

Field (Name) Type Required Default Description
llmid Model ID Yes - -
prompt string Yes - Prompt words. Used to describe the video content you want to generate.
image1_file image file Yes - First frame image.
resolution string No 720p Video size. Specify the resolution of the generated video.
Optional values:
720P, 1080P
duration integer No 5 Video duration. Specify the length of the generated video (seconds).
Optional values: integer seconds

Example:

#!/usr/bin/env bash
curl -X POST https://opencomputing.ai/llmage/video \
  -H "Authorization: Bearer <your-apikey>" \
  -F "llmid=o5vfXYD5BURJWRTWpopE5" \
  -F "prompt=一起来调科目三" \
  -F "duration=15" \
  -F "resolution=720P" \
  -F "image1_file=@./02.jpg"

seedance 2.0 Upload Data Requirements

Field (Name) Type Required Default Description
llmid Model ID Yes - -
model Model Name No doubao-seedance-2-0-260128 doubao-seedance-2-0-260128 or doubao-seedance-2-0-fast-260128
prompt string Yes - Prompt words. Describe the video content you want to generate.
image1_file image file Yes - First frame image.
image2_file image file Yes - Last frame image.
resolution string No 720p Video size. Specify video resolution.
Optional values:
480p, 720p, 1080p
ratio string No adaptive Optional: adaptive, 16:9, 4:3, 1:1, 3:4, 9:16, 21:9
duration integer No 5 Video duration. Specify generated video length (seconds).

Tongyi Wanxiang Upload Data Requirements

Field (Name) Type Required Default Description
llmid Model ID Yes - -
prompt string Yes - Prompt words.
negative_prompt string No (empty) Negative prompt words.
size string No 1920*1080 Video size.
Optional: 1280*720, etc.
duration integer No 15 Video length.
Optional: 5, 10, 15
image_file1 string/file Yes - First frame image. (URL or Base64).
image_file2 string/file Yes - Last frame image. (URL or Base64).

Vidu Upload Data Requirements

Field (Name) Type Required Default Description
llmid Model ID Yes - -
model string No viduq3-pro Model version.
Optional: viduq2-turbo, viduq3-pro
prompt string Yes - Prompt text.
off_peak string No N Off-peak execution. Y (Yes), N (No)
image_file1 string/file Yes - First frame image.
image_file2 string/file Yes - Last frame image.
duration integer No 10 Video length. 1-16 seconds.
ratio string No 16:9 Aspect ratio.
resolution string No 1080p Resolution.

Seedance 1.5 Upload Data Requirements

Field Type Required Default Description
llmid Model ID Yes - -
prompt string Yes - Prompt text describing the video content.
radio string No - Aspect ratio.
resolution string No 1080p Resolution.
duration integer No 12 Video length (seconds).
image_file1 string No - First frame image.
image_file2 string No - Last frame image.

Example using seedance 1.5:

#!/usr/bin/env bash
curl -X POST https://opencomputing.ai/llmage/video \
  -H "Authorization: Bearer <your-apikey-from-opencomputing.ai" \
  -F "model=dreamina-seedance-2-0-260128" \
  -F "llmid=CrEMkFQfRCmbmopZsCqLj" \
  -F "prompt=从图片1到图片2丝滑转换" \
  -F "duration=5" \
  -F "ratio=16:9" \
  -F "resolution=480p" \
  -F "image1_file=@./myimg1.jpg" \
  -F "image1_file=@./myimg2.jpg"

Reference-to-Video

Model ID Provider Model Name
6o9n_7u2K927hNlD8_72f Alibaba Cloud happyhorse-1.0-r2v
dmPXF65TD1riKj9KaxLmg Doubao doubao-seedance-2-0-260128(*), doubao-seedance-2-0-fast-260128
nVbH7lEO51soqTbLGIHE_ We Token AI dreamina-seedance-2-0-260128(*), dreamina-seedance-2-0-fast-260128

Happy Horse Upload Data Requirements

Field Type Required Default Description
model str No Default is the starred model
prompt string Yes - Prompt text.
ratio string No - Aspect ratio.
resolution string No 1080p Resolution.
duration integer No 12 Video duration (seconds).
image_files array Yes [] Reference image array. Up to 9 files.

seedance 2.0 Upload Data Requirements

Field Type Required Default Description
model str No Default is the starred model
prompt string Yes - Prompt text.
ratio string No - Aspect ratio.
resolution string No 1080p Resolution.
duration integer No 12 Video length.
image_files array Yes [] Reference image array.
video_files array No [] Reference video array.
audio_files array No [] Reference audio array.

Task Submission

  • path: /llmage/video
  • method: POST
  • headers
{
    "Content-Type": "application/json",
    "Authorization": "Bearer <your-apikey>"             # APIKEY applied by the customer from the Yuanjing platform
}
  • data Except for llmid, different models require different data. Please refer to the upload data instructions.

  • Return

{
    "taskid":                               # Task ID, used later to query execution results
    "status":                               # Status includes:
                                            # SUCCEEDED: Success
                                            # FAILED: Failed
                                            # CREATED: Created
                                            # PENDING: Queued
                                            # RUNNING: Running
}

Return example:

{
    "taskid": "936759404378734592",
    "status": "created"
}

Example

seedance 2.0 Reference-to-Video

curl -X POST https://opencomputing.ai/llmage/video \
  -H "Authorization: Bearer <APIKEY>" \
  -F "llmid=dmPXF65TD1riKj9KaxLmg" \
  -F "model": "doubao-seedance-2-0-260128" \
  -F "image_files=@./1.jpg" \
  -F "image_files=@./2.jpg" \
  -F "prompt=平滑过度从第一张图片到第二张图片" \
  -F "ratio=4:3" \
  -F "resolution=720p" \
  -F "duration=4"

Query Task Status

  • path: /llmage/tasks
  • method: GET
  • headers
{
    "Content-Type": "application/json",
    "Authorization": "Bearer <your-apikey>"             # APIKEY applied from Yuanjing platform
}
  • params
{
    "taskid": "936759404378734592"
}
  • Return
{
    "status":                           # Status: SUCCEEDED, FAILED, CREATED, PENDING, RUNNING
    "taskid":                           # Task number generated by the supplier; if failed, taskid is meaningless
    "usage":                            # Valid when status==SUCCEEDED, billing information
    "image":                            # Video cover URL
    "video":                            # Video URL
}

Return example:

{
    "usage": {                          # Billing varies by supplier and model
        "action": "t2v",
        "credits": 10,
        "type": "text2video",
        "model": "viduq3-pro",
        "resolution": "540p",
        "off_peak": false,
        "duration": 1
    },
    "image": "https://opencomputing.ai/idfile?path=/tmp/19/43/137/39/cover.jpeg",
    "video": "https://opencomputing.ai/idfile?path=/tmp/137/173/31/47/video.mp4",
    "status": "SUCCEEDED"
}

Example

#!/usr/bin/env bash
curl -X POST https://opencomputing.ai/llmage/tasks?taskid=<taskid> \
  -H "Authorization: Bearer <your-apikey-from-opencomputing.ai>"

Error Information

  • 401: {"error": "Invalid API Key"}
  • 400: {"error": "Missing required parameter: prompt"}
  • 429: {"error": "Insufficient balance"}