TkenPwerDOCS登录 / 注册

文档 · 快速接入

OpenAI 兼容 · 一行换 base_url · 模型列表 API 直出

Python

from openai import OpenAI
client = OpenAI(
    base_url="https://api.tokenpower.ai/v1",
    api_key="tp-sk-...")

resp = client.chat.completions.create(
    model="auto",   # 或指定:qwen-max / deepseek-v3 / claude-opus ...
    messages=[{"role": "user", "content": "你好"}])

# 有哪些模型?一行拿到,无需翻页面
for m in client.models.list():
    print(m.id)

curl

curl https://api.tokenpower.ai/v1/chat/completions \
  -H "Authorization: Bearer tp-sk-..." \
  -H "Content-Type: application/json" \
  -d '{"model":"auto","messages":[{"role":"user","content":"你好"}]}'

说明

· model: "auto" 按成本/延迟自动路由,自动 fallback
· 流式:stream: true,SSE 透传
· 每一笔调用都会出现在你的流水里——tokens、费用、延迟
· 余额不足返回 402;充值后即恢复

限流

默认 60 RPM / 密钥 · 需要更高额度联系 support@tokenpower.ai