大模型

ai-chatPOST
POSThttps://v1.apizero.cn/api/ai-chat
收费档

默认经济档(最低)。适中、较贵同一模型价更高。

加载中…

概述

一把 Key 调对话、生图、视频。地址 POST https://v1.apizero.cn/v1/chat/completions,SDK base 填 https://v1.apizero.cn/v1。默认经济档(最低),也可选适中或较贵。成功后按 Token / 任务价扣大模型额度。

调用约定

  • 网关 · https://v1.apizero.cn
  • 鉴权 · Authorization: Bearer <API Key>
  • 回包 · JSON {code, msg, data}。成功看 code === 0,不要只看 HTTP 200。
/aidocs/ai-chat/raw.md
打开 Markdown

鉴权

本接口无匿名/登录免费额度,需携带有效 API Key,按次、点数或会员套餐计费。鉴权字段与兼容写法见下方「请求头说明」。

获取 API Key

请求头

Authorizationstring必填

必填鉴权。推荐:Bearer <API Key>。兼容请求头 X-API-Key,以及 Query api_key / apikey / key(key 仅当值为 sk_live_/sk_test_/sk_stag_ 形态时生效)。付费接口需携带有效 Key。

对话

POSTAPPLICATION/JSON·APPLICATION/JSON

多轮对话走同一 Completions 地址。model 换对话模型即可。stream 可按需打开。默认经济档。

https://v1.apizero.cn/v1/chat/completions?model=deepseek-v4-flash-0731&tier=economy&messages=%5B%7B%22role%22%3A%22user%22%2C%22content%22%3A%22%E7%94%A8%E4%B8%80%E5%8F%A5%E8%AF%9D%E4%BB%8B%E7%BB%8D%E6%9E%81%E6%95%B0%E6%9C%AC%E6%BA%90%22%7D%5D&stream=false

model(模型)string必填

对话模型 ID,见本页模型表或 ?type=chat

deepseek-v4-flash-0731

tier(收费档)string选填

收费档:economy 经济(默认、最低)/ standard 适中 / plus 较贵。不传按经济档

economy

messages(对话消息)array必填

OpenAI 风格 messages,可带历史轮次

[{"role":"user","content":"用一句话介绍极数本源"}]

stream(流式)boolean选填

true 时按 SSE 流式返回

false

{
  "model": "deepseek-v4-flash-0731",
  "tier": "economy",
  "messages": "[{\"role\":\"user\",\"content\":\"用一句话介绍极数本源\"}]",
  "stream": "false"
}

返回结果

idstring

本次请求 ID

objectstring

固定 chat.completion

creatednumber

生成时间 Unix 秒

modelstring

实际使用的模型 ID

choicesarray

模型输出。对话在 choices[0].message.content;生图/视频常见为链接或任务信息

indexnumber

index

messageobject

message

rolestring

role

contentstring

内容

finish_reasonstring

finish_reason

usageobject

成功回包才有。含 prompt_tokens / completion_tokens / total_tokens

prompt_tokensnumber

prompt_tokens

completion_tokensnumber

completion_tokens

total_tokensnumber

total_tokens

tierstring

实际计费档:economy / standard / plus

billingobject

本次扣费:cost_fen / cost_yuan / pricing_used 等

tipsstring

品牌提示(所有接口统一返回):极数本源 · https://apizero.cn

{
  "id": "chatcmpl-demo",
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "极数本源提供统一 Key 的 API 与大模型接入。"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 16,
    "completion_tokens": 18,
    "total_tokens": 34
  },
  "tips": "极数本源 · https://apizero.cn"
}

生图

POSTAPPLICATION/JSON·APPLICATION/JSON

仍 POST /v1/chat/completions,只把 model 换成生图模型。提示词写在 messages 里。不要和商城里单独的豆包文生图接口混用。默认经济档。

https://v1.apizero.cn/v1/chat/completions?model=qwen-image&tier=economy&messages=%5B%7B%22role%22%3A%22user%22%2C%22content%22%3A%22%E4%B8%80%E5%8F%AA%E6%A9%98%E7%8C%AB%E5%9D%90%E5%9C%A8%E7%AA%97%E5%8F%B0%E4%B8%8A%EF%BC%8C%E5%8D%88%E5%90%8E%E9%98%B3%E5%85%89%EF%BC%8C%E5%86%99%E5%AE%9E%22%7D%5D

model(模型)string必填

生图模型 ID,见本页模型表或 ?type=image

qwen-image

tier(收费档)string选填

收费档:economy 经济(默认、最低)/ standard 适中 / plus 较贵。不传按经济档

economy

messages(对话消息)array必填

user content 即生图提示词

[{"role":"user","content":"一只橘猫坐在窗台上,午后阳光,写实"}]

{
  "model": "qwen-image",
  "tier": "economy",
  "messages": "[{\"role\":\"user\",\"content\":\"一只橘猫坐在窗台上,午后阳光,写实\"}]"
}

返回结果

idstring

本次请求 ID

objectstring

固定 chat.completion

creatednumber

生成时间 Unix 秒

modelstring

实际使用的模型 ID

choicesarray

模型输出。对话在 choices[0].message.content;生图/视频常见为链接或任务信息

indexnumber

index

messageobject

message

rolestring

role

contentstring

内容

finish_reasonstring

finish_reason

usageobject

成功回包才有。含 prompt_tokens / completion_tokens / total_tokens

prompt_tokensnumber

prompt_tokens

completion_tokensnumber

completion_tokens

total_tokensnumber

total_tokens

tierstring

实际计费档:economy / standard / plus

billingobject

本次扣费:cost_fen / cost_yuan / pricing_used 等

tipsstring

品牌提示(所有接口统一返回):极数本源 · https://apizero.cn

{
  "id": "chatcmpl-img",
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "https://example.com/generated.png"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 8,
    "total_tokens": 32
  },
  "tips": "极数本源 · https://apizero.cn"
}

视频

POSTAPPLICATION/JSON·APPLICATION/JSON

仍 POST /v1/chat/completions,只把 model 换成视频模型。提示词写在 messages 里。有的模型按次/按时长计价,以价目表为准。默认经济档。

https://v1.apizero.cn/v1/chat/completions?model=viduq3&tier=economy&messages=%5B%7B%22role%22%3A%22user%22%2C%22content%22%3A%22%E4%B8%80%E5%8F%AA%E9%87%91%E6%AF%9B%E5%9C%A8%E8%8D%89%E5%9C%B0%E4%B8%8A%E5%A5%94%E8%B7%91%EF%BC%8C%E6%85%A2%E9%95%9C%E5%A4%B4%EF%BC%8C%E9%98%B3%E5%85%89%22%7D%5D

model(模型)string必填

视频模型 ID,见本页模型表或 ?type=video

viduq3

tier(收费档)string选填

收费档:economy 经济(默认、最低)/ standard 适中 / plus 较贵。不传按经济档

economy

messages(对话消息)array必填

user content 即视频提示词

[{"role":"user","content":"一只金毛在草地上奔跑,慢镜头,阳光"}]

{
  "model": "viduq3",
  "tier": "economy",
  "messages": "[{\"role\":\"user\",\"content\":\"一只金毛在草地上奔跑,慢镜头,阳光\"}]"
}

返回结果

idstring

本次请求 ID

objectstring

固定 chat.completion

creatednumber

生成时间 Unix 秒

modelstring

实际使用的模型 ID

choicesarray

模型输出。对话在 choices[0].message.content;生图/视频常见为链接或任务信息

indexnumber

index

messageobject

message

rolestring

role

contentstring

内容

finish_reasonstring

finish_reason

usageobject

成功回包才有。含 prompt_tokens / completion_tokens / total_tokens

prompt_tokensnumber

prompt_tokens

completion_tokensnumber

completion_tokens

total_tokensnumber

total_tokens

tierstring

实际计费档:economy / standard / plus

billingobject

本次扣费:cost_fen / cost_yuan / pricing_used 等

tipsstring

品牌提示(所有接口统一返回):极数本源 · https://apizero.cn

{
  "id": "chatcmpl-vid",
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "https://example.com/generated.mp4"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 20,
    "completion_tokens": 6,
    "total_tokens": 26
  },
  "tips": "极数本源 · https://apizero.cn"
}

模型列表

GETURL QUERY·APPLICATION/JSON

公开价目,不用 Key。type 可筛 chat / image / video / audio。每条带三档价格,挂牌和调试默认看 economy。调用时仍走 /v1/chat/completions。

https://config.apizero.cn/api/v1/public/ai-models?type=chat&q=deepseek

type(类型)string选填

chat / image / video / audio,不传返回全部

chat

q(搜索)string选填

按模型 ID 或名称搜索

deepseek

返回结果

totalnumber

条数

modelsarray

模型列表,含 id / name / type / prices.economy|standard|plus

idstring

id

namestring

名称

typestring

类型

pricesobject

prices

economyobject

economy

standardstring

standard

plusstring

plus

tipsstring

品牌提示(所有接口统一返回):极数本源 · https://apizero.cn

{
  "code": 0,
  "msg": "ok",
  "data": {
    "total": 1,
    "models": [
      {
        "id": "deepseek-v4-flash-0731",
        "name": "DeepSeek V4 Flash",
        "type": "chat",
        "prices": {
          "economy": {
            "label": "经济",
            "available": true,
            "sell": {
              "input": 0.5,
              "output": 2,
              "billing": "per_token"
            }
          },
          "standard": null,
          "plus": null
        }
      }
    ]
  },
  "tips": "极数本源 · https://apizero.cn"
}

请求示例

示例都是服务端写法。Python / JavaScript 各有常规写法和官方库。

curl -sS -X POST "https://v1.apizero.cn/api/ai-chat" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

错误码

先看业务 code。HTTP 也可能不是 200。

0200

成功

4000400

参数错误

4011401

API Key 无效

4013403

API Key 已暂停

4014403

当前 IP 不在 Key 白名单

4015401

此接口需要 API Key

4022402

余额不足

4029429

调用过快(QPS)

4030429

今日免费额度已用完

4040503

接口已下线

4041404

接口不存在

5000500

服务器内部错误

5020502

上游暂时不可用

5021502

上游返回格式异常

5030502

暂无可用节点

调用限制

计费模式
按次付费 · 点数包 · 月套餐
QPS 限制
0 req/s
登录免费额度
匿名每日额度
黄金会员
这档会员调这个接口不送免费
钻石会员
每天 100,000 次 · 每秒 30 次
企业会员
按用量扣大模型额度 · QPS 120

购买套餐、看评价请走商城详情。 购买 / 调试

更新日志

暂无变更记录。

免责声明

需 API Key

大模型 接入文档|极数本源