跳到正文
老马Chat laomachat.com

分发 Key

给每个分组发 Sub2API 自己的 Key,客户端填写这把 Key。

后台进入 API Key,为每个分组各建一把 Key。Key 只在创建时完整显示一次。

名称示例绑定分组给谁用
openai-localopenai-defaultOpenAI 兼容客户端、Codex
claude-localanthropic-defaultClaude Code、Anthropic Messages

分给不同的人时,继续新建 Key,每把只绑定一个分组。停用某把 Key 不影响分组里的其他 Key,也不删除上游老马 Chat 账号。

OpenAI 兼容客户端

  • Base URL:https://sub2api.example.com/v1
  • API Key:绑定 openai-default 的 Key
PowerShell — 探测 OpenAI 分组powershell
curl https://sub2api.example.com/v1/chat/completions `
  -H "Authorization: Bearer 绑定openai-default的Key" `
  -H "Content-Type: application/json" `
  -d "{\"model\":\"gpt-6-luna\",\"messages\":[{\"role\":\"user\",\"content\":\"reply with pong\"}]}"

model 使用准备工作映射表中的名称。

Claude Code

PowerShell — Claude Codepowershell
$env:ANTHROPIC_BASE_URL = "https://sub2api.example.com"
$env:ANTHROPIC_AUTH_TOKEN = "绑定anthropic-default的Key"
claude

Anthropic 的 Base URL 不要加 /v1。/model 里选择的名称使用同一份映射表中的名称。