统一API接口,兼容OpenAI格式,一行代码接入全部算力服务
注册登录后,在 API Token 页面创建Token
curl https://api.yixima.cn/v1/chat/completions \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "yxm-qwen-plus",
"messages": [{"role":"user","content":"你好"}]
}'
from openai import OpenAI
client = OpenAI(
api_key="YOUR_TOKEN",
base_url="https://api.yixima.cn/v1"
)
resp = client.chat.completions.create(
model="yxm-qwen-plus",
messages=[{"role":"user","content":"你好"}]
)
print(resp.choices[0].message.content)
| 接口 | 方法 | 路径 | 说明 |
|---|---|---|---|
| 对话补全 | POST | /v1/chat/completions | 大语言模型对话 |
| 文本向量 | POST | /v1/embeddings | 文本向量化 |
| 图片OCR | POST | /v1/ocr/recognize | 图片文字识别 |
| 图像生成 | POST | /v1/images/generations | AI绘画 |
| 语音识别 | POST | /v1/audio/transcriptions | 语音转文字 |
| 模型列表 | GET | /v1/models | 获取可用模型 |
| HTTP状态码 | 错误类型 | 说明 |
|---|---|---|
| 401 | authentication_error | Token无效或已过期 |
| 402 | insufficient_balance | 余额不足 |
| 403 | permission_denied | Token无此接口权限 |
| 429 | rate_limit | 请求频率超限 |
| 500 | server_error | 上游服务异常 |