首頁 › API 文件

API 文件

一個 OpenAI 相容端點,用 DeepSeek、Qwen、GLM。改 base_url 就好,程式不用改。

Base URLhttps://vantixcloud.com/v1驗證Authorization: Bearer vx-…取得 key不開放自助註冊。在 /zh-tw/ai-api 詢價;報價付款後發放 key。端點POST /v1/chat/completions · GET /v1/models計費預付餘額,依報價單價按 token 扣款。USDT(TRC20)或刷卡付款。見如何運作。串流支援("stream": true)
開通方式:API 依報價開通。報價付款後發放 key,開通時間在報價中確認。拿到 key 之前,所有呼叫都會回 401。
快速開始串流模型查餘額與用量錯誤碼頻率限制接入各種工具疑難排解

快速開始

Python(openai SDK)

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)

Node.js(openai SDK)

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

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,餘額就是依此扣款。

Python

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)

Node.js

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

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-proDeepSeek模型頁
deepseek-flashDeepSeek模型頁
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"}}
狀態碼訊息開頭怎麼處理
400Invalid JSON body請送合法的 JSON 請求內容。
400Unsupported model: …用 GET /v1/models 裡的 ID,訊息中也會列出可用的 ID。
401Invalid API key / API key not found用 Authorization: Bearer vx-… 帶完整的 key。key 在報價付款後發放。
402Insufficient balance預付餘額已用完,請在 Telegram 跟 Sapporo 要儲值報價。
403This model is only available to verified 18+ platforms18+ 模型需先完成 18+ 用途確認,請聯絡 @sapporo168。
405POST onlychat completions 請用 POST。
4xx(含 429)Upstream rejected the request: …上游供應商的狀態碼與訊息原樣轉回,例如不接受的參數或頻率限制。修正請求,或遇到 429 時退避後重試。
502Upstream error / Gateway error暫時性錯誤,退避後重試。
503Upstream 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。

Cline / Roo Code (VS Code)

LibreChat

# 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"

Cherry Studio / ChatBox / NextChat

one-api / new-api

LangChain

from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="deepseek-flash", base_url="https://vantixcloud.com/v1", api_key="vx-...")

疑難排解

狀況檢查
SDK 回 404 或 not foundbase_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,附上請求時間與錯誤訊息。
資料:我們不儲存 prompt 與回應內容,閘道只記錄每把 key 的用量。詳見API key 與資料怎麼處理。
不綁死。這裡全部是標準 OpenAI 格式,哪天想換,改 base_url 就好。
取得報價 →用原廠牌價估算費用