状态与价格
不需要密钥、不需要登录的两个公开接口:GET /api/status(站点的公开设置)和 GET /api/pricing(模型广场的数据:模型名、可用分组、支持的接口、计费方式)。
下面两个接口是公开的,不需要 API 密钥,也不需要登录,适合在程序里读取站点的额度显示方式,或者列出有哪些模型、各在哪些分组里。它们来自 CodaAPI 所基于的开源网关 new-api,跟随上游版本,字段可能随版本变化;返回里还有很多给控制台页面用的字段,本页只列稳定、对接入有用的那些。
| 方法与路径 | 返回什么 |
|---|---|
GET /api/status |
站点名称、版本,以及额度的显示方式等公开设置 |
GET /api/pricing |
模型广场的数据:模型名、可用分组、支持的接口、计费方式 |
请求头
不需要任何鉴权头。
站点状态
GET https://codaapi.com/api/status
没有请求参数。
curl
curl https://codaapi.com/api/status
返回
{
"success": true,
"message": "",
"data": {
"system_name": "CodaAPI",
"version": "v1.0.0…",
"server_address": "https://codaapi.com",
"start_time": 1764460800,
"quota_display_type": "…",
"quota_per_unit": "…",
"usd_exchange_rate": "…",
"custom_currency_symbol": "…",
"custom_currency_exchange_rate": "…",
"…": "…"
}
}
示例只示意字段的位置。额度显示方式、换算比例、汇率这几项是站点后台的设置,示例里没有写值,以接口实际返回的为准;其中 quota_per_unit、usd_exchange_rate、custom_currency_exchange_rate 实际返回的是数字。
| 字段 | 说明 |
|---|---|
data.system_name |
站点名称 |
data.version |
网关的版本号 |
data.server_address |
站点地址 |
data.start_time |
网关这次启动的时间(Unix 时间戳,秒) |
data.quota_display_type |
额度的显示方式:USD、CNY、CUSTOM 或 TOKENS。决定控制台上金额怎么显示,以及 /v1/dashboard/billing/* 返回的数是什么单位,见额度的单位 |
data.quota_per_unit |
数字,1 美元对应多少额度点数。/api/usage/token/、/api/log/token 返回的额度点数除以它就是美元数 |
data.usd_exchange_rate |
数字,显示方式为 CNY 时用的汇率(1 美元合多少元) |
data.custom_currency_symbol、data.custom_currency_exchange_rate |
显示方式为 CUSTOM 时用的货币符号和汇率(数字,1 美元合多少) |
接口能正常返回,只说明网关在响应请求,不代表每个模型的上游都可用。
模型与价格
GET https://codaapi.com/api/pricing
返回模型广场里的全部数据,没有请求参数。
curl
curl https://codaapi.com/api/pricing
Python(pip install requests):列出支持 Claude 格式的模型、计费方式和可用分组
import requests
body = requests.get("https://codaapi.com/api/pricing", timeout=30).json()
for model in body["data"]:
if "anthropic" in (model.get("supported_endpoint_types") or []):
if model.get("billing_mode") == "tiered_expr":
billing = "动态计费" # 表达式计费,quota_type 不能说明计费方式
elif model.get("quota_type") == 1:
billing = "按次"
else:
billing = "按量"
print(model["model_name"], billing, "、".join(model.get("enable_groups") or []))
返回
{
"success": true,
"data": [
{
"model_name": "gemini-2.5-flash",
"vendor_id": 1,
"quota_type": 0,
"enable_groups": ["…"],
"supported_endpoint_types": ["gemini", "openai"],
"description": "…",
"tags": "…",
"…": "…"
}
],
"vendors": [{"id": 1, "name": "Google", "icon": "…"}],
"usable_group": {"…": "…"},
"supported_endpoint": {
"gemini": {"path": "/v1beta/models/{model}:generateContent", "method": "POST"},
"openai": {"path": "/v1/chat/completions", "method": "POST"}
},
"…": "…"
}
| 字段 | 说明 |
|---|---|
data[].model_name |
模型名,调用时 model 填的就是它。名字里带 * 的是通配写法,代表一类名字(例如可以接不同数字的思考预算),不能原样填 |
data[].quota_type |
计费方式:0 按量计费(按 tokens),1 按次计费。有 billing_mode 时先看它 |
data[].billing_mode |
只在表达式计费的模型上出现,值是 tiered_expr,模型广场里显示为「动态计费」,价格由计费表达式决定(见计费方式)。这时不要按 quota_type 把它当成按量或按次计费的模型。其他模型没有这个字段 |
data[].enable_groups |
哪些分组能用这个模型,all 表示所有分组。分组的说明见分组说明 |
data[].supported_endpoint_types |
支持的接口类型,例如 openai、openai-response、anthropic、gemini、image-generation |
data[].vendor_id |
供应商,对应 vendors[].id |
data[].description、data[].tags |
说明和标签,由后台填写,可能为空 |
vendors[] |
供应商列表(id、name) |
usable_group |
分组名 → 分组说明 |
supported_endpoint |
每种接口类型对应的方法和路径 |
返回里还有 model_ratio、model_price、completion_ratio、group_ratio 等计费用的字段。它们的含义和算法属于上游的计费规则,可能随版本变化,也不反映充值价格;价格请以模型广场和价格表为准,不要在程序里用这些字段自己算钱。计费规则见价格与倍率。
几点注意:
- 不登录时,返回的是对所有用户开放的分组和其中的模型。
- 数据在网关里缓存,后台改动后大约一分钟内反映到这里。
- 站点可以关闭模型广场,或者设成登录后才能看;那时这个接口返回 403 或 401。
错误
出错时返回 {"success": false, "message": "…"},例如模型广场被关闭时是 403。各状态码的处理办法见问题排查。
计费
这两个接口不扣费。