一个 OpenAI 兼容端点,用 DeepSeek、Qwen、GLM。改 base_url 就好,代码不用改。
https://vantixcloud.com/v1鉴权Authorization: Bearer vx-…获取 key不开放自助注册。在 /zh-cn/ai-api 询价;报价付款后发放 key。端点POST /v1/chat/completions · GET /v1/models计费预付余额,按报价单价按 token 扣费。USDT(TRC20)或刷卡付款。见如何运作。流式支持("stream": true)pip install openai
from openai import OpenAI
client = OpenAI(
base_url="https://vantixcloud.com/v1",
api_key="vx-your-key",
)
r = client.chat.completions.create(
model="deepseek-flash",
messages=[{"role": "user", "content": "Hello"}],
)
print(r.choices[0].message.content)
npm install openai · ES modules(顶层 await)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://vantixcloud.com/v1",
apiKey: process.env.VANTIX_KEY, // vx-...
});
const r = await client.chat.completions.create({
model: "deepseek-flash",
messages: [{ role: "user", content: "Hello" }],
});
console.log(r.choices[0].message.content);
curl https://vantixcloud.com/v1/chat/completions \
-H "Authorization: Bearer $VANTIX_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-flash","messages":[{"role":"user","content":"Hello"}]}'
设 stream: true 就会收到标准 OpenAI 格式的 SSE。网关会向上游请求流式的 token 用量(stream_options.include_usage),所以最后一个 chunk 带有 usage,余额就是按此扣费。
stream = client.chat.completions.create(
model="deepseek-flash",
messages=[{"role": "user", "content": "Write a haiku about latency"}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
if chunk.usage: # last chunk carries token usage
print("\n", chunk.usage)
const stream = await client.chat.completions.create({
model: "deepseek-flash",
messages: [{ role: "user", content: "Write a haiku about latency" }],
stream: true,
});
for await (const chunk of stream) {
const t = chunk.choices?.[0]?.delta?.content;
if (t) process.stdout.write(t);
if (chunk.usage) console.log("\n", chunk.usage); // last chunk
}
curl -N https://vantixcloud.com/v1/chat/completions \
-H "Authorization: Bearer $VANTIX_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-flash","stream":true,"messages":[{"role":"user","content":"Hello"}]}'
模型 ID 区分大小写。以下是目前端点上的模型;GET /v1/models 返回同一份列表。
| 模型 ID | 原厂 | 官方牌价 |
|---|---|---|
deepseek-v4-pro | DeepSeek | 模型页 |
deepseek-flash | DeepSeek | 模型页 |
qwen3.8-max | 阿里云(通义千问) | 模型页 |
qwen3.7-plus | 阿里云(通义千问) | 模型页 |
glm-5.3 | 智谱(GLM) | 模型页 |
curl https://vantixcloud.com/v1/models
Kimi、Seedance 2.5、Wan,以及 Claude、GPT、Gemini 为报价制供应,不在这个端点的固定列表上。想按官方牌价比较每月费用,请用大模型 API 费用计算器。
把 key POST 到 /api/keys,带 action: "balance",会返回余额、累计花费与调用次数(美元)。非流式响应也会带两个响应头:
X-Vantix-Cost-USD | 这次调用的费用 |
X-Vantix-Balance-USD | 这次调用后的剩余余额 |
流式响应不带这两个响应头,请用查余额。
curl -X POST https://vantixcloud.com/api/keys \
-H "Content-Type: application/json" \
-d '{"action":"balance","key":"vx-your-key"}'
# {"ok":true,"email":"...","balance":12.3456,"spent":7.6544,"calls":1234,"created":"..."}
错误采用 OpenAI 的错误格式,SDK 会照常抛出异常:
{"error": {"message": "Insufficient balance. Top up at ...", "type": "invalid_request_error"}}
| 状态码 | 信息开头 | 怎么处理 |
|---|---|---|
| 400 | Invalid JSON body | 请发送合法的 JSON 请求体。 |
| 400 | Unsupported model: … | 用 GET /v1/models 里的 ID,信息中也会列出可用的 ID。 |
| 401 | Invalid API key / API key not found | 用 Authorization: Bearer vx-… 带完整的 key。key 在报价付款后发放。 |
| 402 | Insufficient balance | 预付余额已用完,请在 Telegram 跟 Sapporo 要充值报价。 |
| 403 | This model is only available to verified 18+ platforms | 18+ 模型需先完成 18+ 用途确认,请联系 @sapporo168。 |
| 405 | POST only | chat completions 请用 POST。 |
| 4xx(含 429) | Upstream rejected the request: … | 上游供应商的状态码与信息原样返回,例如不接受的参数或频率限制。修正请求,或遇到 429 时退避后重试。 |
| 502 | Upstream error / Gateway error | 临时性错误,退避后重试。 |
| 503 | Upstream temporarily unavailable | 上游供应商故障,我们已收到通知。稍后重试或私信 @sapporo168。 |
网关本身不设每把 key 的频率限制。上游供应商有各自的限制;它们返回 429 时我们原样返回。请用指数退避重试:
import time, openai
def call_with_retry(fn, tries=5):
for i in range(tries):
try:
return fn()
except openai.RateLimitError: # HTTP 429 passed through from upstream
time.sleep(min(2 ** i, 30))
except openai.APIStatusError as e: # retry 502/503 only
if e.status_code not in (502, 503):
raise
time.sleep(min(2 ** i, 30))
raise RuntimeError("still failing, contact Telegram @sapporo168")
只要支持“OpenAI 兼容”供应商的工具都能用:填 base URL、粘贴 key、选模型 ID。
https://vantixcloud.com/v1vx-…deepseek-v4-pro 或 deepseek-flash# librechat.yaml
endpoints:
custom:
- name: "VantixCloud"
apiKey: "${VANTIX_KEY}"
baseURL: "https://vantixcloud.com/v1"
models:
default: ["deepseek-flash", "deepseek-v4-pro", "qwen3.7-plus", "glm-5.3"]
fetch: true
titleConvo: true
modelDisplayLabel: "VantixCloud"
https://vantixcloud.com(有些 App 要不含 /v1 的地址;失败就改成加 /v1)vx-…deepseek-flash、deepseek-v4-pro、qwen3.8-max、glm-5.3https://vantixcloud.comvx-…from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="deepseek-flash", base_url="https://vantixcloud.com/v1", api_key="vx-...")
| 现象 | 检查 |
|---|---|
| SDK 返回 404 或 not found | base_url 要以 /v1 结尾:https://vantixcloud.com/v1。有些工具会自己加 /v1,这时改用 https://vantixcloud.com。 |
| 刚拿到 key 就 401 | 用 Authorization: Bearer vx-… 发送,完整复制 key,不要有空格或换行。 |
| "Unsupported model" | 用 GET /v1/models 里的 ID,例如 deepseek-flash。ID 区分大小写。 |
| 流式卡住或中断 | 确认你的代理或 serverless 平台不会缓冲或超时中断长响应。 |
| 费用比预期高 | 部分模型的官方牌价按时段不同(DeepSeek 低峰更便宜),部分按输入长度分档(Qwen 输入超过 256K 更贵)。把固定的指令放在 prompt 开头,更容易命中缓存。 |
| 还是不行 | 在 Telegram 私信 @sapporo168,附上请求时间与错误信息。 |
base_url 就好。