对接文档
标准 OpenAI 兼容接口 · 请求地址 https://aidmc.0p.ink/v1/v1
1鉴权方式
所有请求需在 HTTP 头携带密钥(注册后在「用户中心 · 我的密钥」获取,密钥以 sh- 开头):
Authorization: Bearer sh-你的密钥
2模型列表
| 模型 ID | 说明 | 输入(点/1K) | 输出(点/1K) | 能力 |
|---|
3请求示例 · cURL
curl https://aidmc.0p.ink/v1/v1/chat/completions \
-H "Authorization: Bearer sh-你的密钥" \
-H "Content-Type: application/json" \
-d '{
"model": "dmc-1.0",
"messages": [
{"role": "user", "content": "你好"}
]
}'
4Python 示例
from openai import OpenAI
client = OpenAI(
api_key="sh-你的密钥",
base_url="https://aidmc.0p.ink/v1/v1"
)
resp = client.chat.completions.create(
model="dmc-1.0",
messages=[{"role": "user", "content": "你好"}]
)
print(resp.choices[0].message.content)
5流式输出
请求中设置 "stream": true,服务端以 SSE(text/event-stream)逐块返回:
resp = client.chat.completions.create(
model="dmc-1.0",
stream=True,
messages=[{"role": "user", "content": "写一首短诗"}]
)
for chunk in resp:
print(chunk.choices[0].delta.content or "", end="", flush=True)
6示例文件下载
提供完整可运行的示例工程(cURL / Python / Node.js / Postman 集合 / README):
7错误码说明
| HTTP | code | 含义 / 处理 |
|---|---|---|
| 401 | invalid_api_key | 密钥无效或已停用,请检查密钥 |
| 400 | - | 请求格式错误,需包含 messages |
| 403 | ip_banned | IP 已被封禁,请联系站长 |
| 404 | model_not_found | 模型不存在或已下线 |
| 429 | insufficient_quota | 额度已用尽,请使用兑换码充值或联系管理员 |
| 429 | concurrency_limit | 并发数达上限,请等待进行中的请求完成 |
| 503 | no_upstream | 暂无可用上游渠道 |
| 502 | upstream_error | 上游服务暂时不可用,请稍后重试 |
错误响应统一格式:{"error":{"code":"...","message":"...","type":"..."}}