docs: 迁移API文档从dashboard_for_sage到docs/,支持多语言(api_doc_{lang}.md)
This commit is contained in:
parent
4e903c0f1b
commit
7d50586964
8
wwwroot/docs/api_doc.ui
Normal file
8
wwwroot/docs/api_doc.ui
Normal file
@ -0,0 +1,8 @@
|
||||
{% set lang = request.args.get('lang') or 'zh' %}
|
||||
{
|
||||
"widgettype": "ApiDoc",
|
||||
"options": {
|
||||
"md_url": "{{entire_url('/docs/api_doc_' + lang + '.md')}}",
|
||||
"height": "100%"
|
||||
}
|
||||
}
|
||||
142
wwwroot/docs/api_doc_en.md
Normal file
142
wwwroot/docs/api_doc_en.md
Normal file
@ -0,0 +1,142 @@
|
||||
# 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
|
||||
|
||||
```json
|
||||
{
|
||||
"model": "qwen3-max",
|
||||
"messages": [
|
||||
{"role": "user", "content": "Hello"}
|
||||
],
|
||||
"stream": false
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
# 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:**
|
||||
|
||||
```json
|
||||
{
|
||||
"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
|
||||
|
||||
```json
|
||||
{
|
||||
"model": "keling-2.1",
|
||||
"catelogid": "t2v",
|
||||
"prompt": "A beautiful sunset over the ocean",
|
||||
"duration": "5s",
|
||||
"resolution": "1080p"
|
||||
}
|
||||
```
|
||||
|
||||
### Response Format
|
||||
|
||||
Video generation is typically async:
|
||||
|
||||
```json
|
||||
{
|
||||
"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](/docs/api_doc_zh.md).
|
||||
2408
wwwroot/docs/api_doc_zh.md
Normal file
2408
wwwroot/docs/api_doc_zh.md
Normal file
File diff suppressed because it is too large
Load Diff
@ -38,7 +38,7 @@
|
||||
"name": "llm_api",
|
||||
"label": "大模型API调用",
|
||||
"icon": "{{entire_url('/imgs/rocket.svg')}}",
|
||||
"url": "{{entire_url('/dashboard_for_sage/api_doc.ui')}}",
|
||||
"url": "{{entire_url('/docs/api_doc.ui')}}",
|
||||
"target": "app.sage_main_content"
|
||||
}
|
||||
{% if is_customer_admin %}
|
||||
@ -87,7 +87,7 @@
|
||||
"name": "llm_api",
|
||||
"label": "大模型API调用",
|
||||
"icon": "{{entire_url('/imgs/rocket.svg')}}",
|
||||
"url": "{{entire_url('/dashboard_for_sage/api_doc.ui')}}",
|
||||
"url": "{{entire_url('/docs/api_doc.ui')}}",
|
||||
"target": "app.sage_main_content"
|
||||
}
|
||||
,{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user