Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/antigmalabs_ante-preview.json
T
OpenCode 68a9071cf1 feat: reconcile local master with origin (exa/hot-platform hunters, leaks ledger, latest results)
Local branch had diverged from origin/master (sibling commits on the same base). Rewrote local history linearly on top of origin/master, folding in all local content: exa/hot-platform discovery hunters, leaks ledger, nightly sweep orchestrator, updated .gitignore and skill docs, plus the latest hunt output and vault state. Remote-only files (vault keys, channel scripts) were restored rather than dropped, so the resulting tree is a full union of both sides.
2026-08-07 12:53:47 +08:00

1 line
55 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"repo": "antigmalabs/ante-preview", "files": {"docs-site/docs/antix/concepts/routing.md": {"485f037514ac52cdb36b0a5d467b9d32424832b3": {"t": 1785746548.1169221, "n": 4532, "h": "0a40eb06fcbfed13", "c": "---\ntitle: \"Routing & BYOK\"\ndescription: \"Endpoints, multi-protocol SDK compatibility, and Bring Your Own Key semantics.\"\nsidebar_position: 1\n---\n\n# Routing & BYOK\n\nAntix is a multi-protocol gateway. It accepts requests in OpenAI, Anthropic, and Gemini shapes and normalizes streaming across upstream providers including Anthropic, Google Gemini, Alibaba Qwen, DeepSeek, Zai (GLM), xAI, and OpenAI.\n\n## Supported endpoints\n\n| Endpoint | Method | Protocol |\n|---|---|---|\n| `/v1/chat/completions` | POST | OpenAI Chat Completions |\n| `/v1/responses` | POST | OpenAI Responses API |\n| `/v1/messages` | POST | Anthropic Messages |\n| `/v1/messages/count_tokens` | POST | Anthropic token counter |\n| `/v1/models/{action}` | POST | Gemini native (`:generateContent`, `:streamGenerateContent`) |\n| `/v1beta/models/{action}` | POST | Gemini v1beta native path |\n| `/v1/models`, `/models` | GET | Public model catalog (no auth) |\n| `/v2/model/info` | GET | Catalog with pricing |\n\n`/v1/embeddings`, audio, images, files, fine-tuning, and the batch API are **not** supported.\n\n## Drop-in SDK compatibility\n\nPoint any OpenAI, Anthropic, or Gemini SDK at Antix by changing the base URL and swapping in your Virtual Key. The proxy translates provider-specific quirks and keeps SSE streaming predictable.\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n base_url=\"https://antix.antigma.ai/v1\",\n api_key=\"sk-antix-<your-key>\",\n)\n\nresponse = client.chat.completions.create(\n model=\"claude-sonnet-4-6\",\n messages=[{\"role\": \"user\", \"content\": \"Hello!\"}],\n stream=True,\n)\n```\n\nA streaming pipeline normalizes SSE events across providers so token deltas, tool calls, and stop reasons arrive in a consistent shape regardless of upstream.\n\n### Claude Code\n\nClaude Code uses the Anthropic SDK internally, so redirecting it at Antix takes one environment variable:\n\n```bash\nexport ANTHROPIC_BASE_URL=\"https://antix.antigma.ai\"\n```\n\nThat's it — Claude Code's SDK reads both and routes all `/v1/messages` traffic to Antix, which passes it through to Anthropic with your platform key substituted.\n\n## Bring Your Own Key (BYOK)\n\nIf you have negotiated direct rates with a provider but still want Antix's observability and routing, use BYOK. Send your provider key in `Authorization` and declare the provider with `X-Antix-Provider`:\n\n```bash\ncurl -X POST https://antix.antigma.ai/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_ALIBABA_DASHSCOPE_KEY\" \\\n -H \"X-Antix-Provider: alibaba\" \\\n -d '{\n \"model\": \"qwen-max\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n }'\n```\n\nBYOK traffic is not re-billed by Antix. It is still tracked for observability.\n\n### Supported providers\n\nAntix normalizes requests across these upstream providers. Route to any of them by model name (Antix infers the provider) or explicitly via `X-Antix-Provider`:\n\n| Provider | Notable models | Accepted `X-Antix-Provider` values | Notes |\n|---|---|---|---|\n| **Anthropic** | Claude Sonnet, Opus, Haiku | `anthropic` | Native `/v1/messages` support. |\n| **OpenAI** | GPT-5.x | `openai` | Native `/v1/chat/completions` and `/v1/responses` support. |\n| **Google Gemini** | Gemini 3.x | `google`, `gemini`, `google_ai_studio_gemini` | Native Gemini protocol at `/v1/models/{action}` and `/v1beta`. |\n| **xAI** | Grok | `xai`, `x-ai` | OpenAI-compatible upstream. |\n| **Alibaba Qwen** | `qwen3-max`, `qwen3-coder-plus`, `qwen3-coder-flash`, `qwq-plus`, `qwen-plus`, `qwen-max`, and more | `alibaba`, `qwen`, `dashscope` | Routed via DashScope. No distinctive key prefix — you **must** set `X-Antix-Provider` on BYOK calls. |\n| **DeepSeek** | `deepseek-chat` (V3), `deepseek-reasoner` (R1), `deepseek-v4-pro`, `deepseek-v4-flash` | `deepseek` | OpenAI-compatible upstream API. `deepseek-reasoner` returns a `reasoning_content` field alongside the final answer. |\n| **Zai (GLM)** | `glm-5.2`, `glm-5.1`, `glm-4.7` | `zai` | Zhipu AI's GLM model family, OpenAI-compatible upstream. No distinctive key prefix — you **must** set `X-Antix-Provider` on BYOK calls. |\n\n:::note Provider inference\nWhen the header is omitted, Antix infers the provider from the key prefix (e.g., `sk-ant-…` → Anthropic, `sk-…` → OpenAI). Some keys (like Alibaba/DashScope or Zai) may have no distinctive prefix — you **must** set `X-Antix-Provider` for those requests, otherwise they will fail upstream with `401 Unauthorized`.\n:::\n\nSee [Models API](/antix/concepts/models) to list exactly which models your gateway currently serves.\n"}, "ed5bc5390033dc28b138b80fe7660f50229084e8": {"t": 1785765521.4678807, "n": 4532, "h": "0a40eb06fcbfed13", "c": "---\ntitle: \"Routing & BYOK\"\ndescription: \"Endpoints, multi-protocol SDK compatibility, and Bring Your Own Key semantics.\"\nsidebar_position: 1\n---\n\n# Routing & BYOK\n\nAntix is a multi-protocol gateway. It accepts requests in OpenAI, Anthropic, and Gemini shapes and normalizes streaming across upstream providers including Anthropic, Google Gemini, Alibaba Qwen, DeepSeek, Zai (GLM), xAI, and OpenAI.\n\n## Supported endpoints\n\n| Endpoint | Method | Protocol |\n|---|---|---|\n| `/v1/chat/completions` | POST | OpenAI Chat Completions |\n| `/v1/responses` | POST | OpenAI Responses API |\n| `/v1/messages` | POST | Anthropic Messages |\n| `/v1/messages/count_tokens` | POST | Anthropic token counter |\n| `/v1/models/{action}` | POST | Gemini native (`:generateContent`, `:streamGenerateContent`) |\n| `/v1beta/models/{action}` | POST | Gemini v1beta native path |\n| `/v1/models`, `/models` | GET | Public model catalog (no auth) |\n| `/v2/model/info` | GET | Catalog with pricing |\n\n`/v1/embeddings`, audio, images, files, fine-tuning, and the batch API are **not** supported.\n\n## Drop-in SDK compatibility\n\nPoint any OpenAI, Anthropic, or Gemini SDK at Antix by changing the base URL and swapping in your Virtual Key. The proxy translates provider-specific quirks and keeps SSE streaming predictable.\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n base_url=\"https://antix.antigma.ai/v1\",\n api_key=\"sk-antix-<your-key>\",\n)\n\nresponse = client.chat.completions.create(\n model=\"claude-sonnet-4-6\",\n messages=[{\"role\": \"user\", \"content\": \"Hello!\"}],\n stream=True,\n)\n```\n\nA streaming pipeline normalizes SSE events across providers so token deltas, tool calls, and stop reasons arrive in a consistent shape regardless of upstream.\n\n### Claude Code\n\nClaude Code uses the Anthropic SDK internally, so redirecting it at Antix takes one environment variable:\n\n```bash\nexport ANTHROPIC_BASE_URL=\"https://antix.antigma.ai\"\n```\n\nThat's it — Claude Code's SDK reads both and routes all `/v1/messages` traffic to Antix, which passes it through to Anthropic with your platform key substituted.\n\n## Bring Your Own Key (BYOK)\n\nIf you have negotiated direct rates with a provider but still want Antix's observability and routing, use BYOK. Send your provider key in `Authorization` and declare the provider with `X-Antix-Provider`:\n\n```bash\ncurl -X POST https://antix.antigma.ai/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_ALIBABA_DASHSCOPE_KEY\" \\\n -H \"X-Antix-Provider: alibaba\" \\\n -d '{\n \"model\": \"qwen-max\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n }'\n```\n\nBYOK traffic is not re-billed by Antix. It is still tracked for observability.\n\n### Supported providers\n\nAntix normalizes requests across these upstream providers. Route to any of them by model name (Antix infers the provider) or explicitly via `X-Antix-Provider`:\n\n| Provider | Notable models | Accepted `X-Antix-Provider` values | Notes |\n|---|---|---|---|\n| **Anthropic** | Claude Sonnet, Opus, Haiku | `anthropic` | Native `/v1/messages` support. |\n| **OpenAI** | GPT-5.x | `openai` | Native `/v1/chat/completions` and `/v1/responses` support. |\n| **Google Gemini** | Gemini 3.x | `google`, `gemini`, `google_ai_studio_gemini` | Native Gemini protocol at `/v1/models/{action}` and `/v1beta`. |\n| **xAI** | Grok | `xai`, `x-ai` | OpenAI-compatible upstream. |\n| **Alibaba Qwen** | `qwen3-max`, `qwen3-coder-plus`, `qwen3-coder-flash`, `qwq-plus`, `qwen-plus`, `qwen-max`, and more | `alibaba`, `qwen`, `dashscope` | Routed via DashScope. No distinctive key prefix — you **must** set `X-Antix-Provider` on BYOK calls. |\n| **DeepSeek** | `deepseek-chat` (V3), `deepseek-reasoner` (R1), `deepseek-v4-pro`, `deepseek-v4-flash` | `deepseek` | OpenAI-compatible upstream API. `deepseek-reasoner` returns a `reasoning_content` field alongside the final answer. |\n| **Zai (GLM)** | `glm-5.2`, `glm-5.1`, `glm-4.7` | `zai` | Zhipu AI's GLM model family, OpenAI-compatible upstream. No distinctive key prefix — you **must** set `X-Antix-Provider` on BYOK calls. |\n\n:::note Provider inference\nWhen the header is omitted, Antix infers the provider from the key prefix (e.g., `sk-ant-…` → Anthropic, `sk-…` → OpenAI). Some keys (like Alibaba/DashScope or Zai) may have no distinctive prefix — you **must** set `X-Antix-Provider` for those requests, otherwise they will fail upstream with `401 Unauthorized`.\n:::\n\nSee [Models API](/antix/concepts/models) to list exactly which models your gateway currently serves.\n"}, "e153ed13c7b6ff40d5978ee3801a7c72d0ac4ce1": {"t": 1785765522.7181826, "n": 3287, "h": "bde36f118901ee73", "c": "---\ntitle: \"Routing & BYOK\"\ndescription: \"Endpoints, multi-protocol SDK compatibility, and Bring Your Own Key semantics.\"\nsidebar_position: 1\n---\n\n# Routing & BYOK\n\nAntix is a multi-protocol gateway. It accepts requests in OpenAI, Anthropic, and Gemini shapes and normalizes streaming across upstream providers including Anthropic, Google Gemini, Alibaba Qwen, xAI, and OpenAI.\n\n## Supported endpoints\n\n| Endpoint | Method | Protocol |\n|---|---|---|\n| `/v1/chat/completions` | POST | OpenAI Chat Completions |\n| `/v1/responses` | POST | OpenAI Responses API |\n| `/v1/messages` | POST | Anthropic Messages |\n| `/v1/messages/count_tokens` | POST | Anthropic token counter |\n| `/v1/models/{action}` | POST | Gemini native (`:generateContent`, `:streamGenerateContent`) |\n| `/v1beta/models/{action}` | POST | Gemini v1beta native path |\n| `/v1/models`, `/models` | GET | Public model catalog (no auth) |\n| `/v2/model/info` | GET | Catalog with pricing |\n\n`/v1/embeddings`, audio, images, files, fine-tuning, and the batch API are **not** supported.\n\n## Drop-in SDK compatibility\n\nPoint any OpenAI, Anthropic, or Gemini SDK at Antix by changing the base URL and swapping in your Virtual Key. The proxy translates provider-specific quirks and keeps SSE streaming predictable.\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n base_url=\"https://antix.antigma.ai/v1\",\n api_key=\"sk-antix-<your-key>\",\n)\n\nresponse = client.chat.completions.create(\n model=\"claude-sonnet-4-6\",\n messages=[{\"role\": \"user\", \"content\": \"Hello!\"}],\n stream=True,\n)\n```\n\nA streaming pipeline normalizes SSE events across providers so token deltas, tool calls, and stop reasons arrive in a consistent shape regardless of upstream.\n\n### Claude Code\n\nClaude Code uses the Anthropic SDK internally, so redirecting it at Antix takes one environment variable:\n\n```bash\nexport ANTHROPIC_BASE_URL=\"https://antix.antigma.ai\"\n```\n\nThat's it — Claude Code's SDK reads both and routes all `/v1/messages` traffic to Antix, which passes it through to Anthropic with your platform key substituted.\n\n## Bring Your Own Key (BYOK)\n\nIf you have negotiated direct rates with a provider but still want Antix's observability and routing, use BYOK. Send your provider key in `Authorization` and declare the provider with `X-Antix-Provider`:\n\n```bash\ncurl -X POST https://antix.antigma.ai/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_ALIBABA_DASHSCOPE_KEY\" \\\n -H \"X-Antix-Provider: alibaba\" \\\n -d '{\n \"model\": \"qwen-max\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n }'\n```\n\nBYOK traffic is not re-billed by Antix. It is still tracked for observability.\n\n### Accepted `X-Antix-Provider` values\n\n| Provider | Accepted values |\n|---|---|\n| OpenAI | `openai` |\n| Anthropic | `anthropic` |\n| Google Gemini | `google`, `gemini`, `google_ai_studio_gemini` |\n| xAI | `xai`, `x-ai` |\n| Alibaba / DashScope | `alibaba`, `qwen`, `dashscope` |\n\n:::note Provider inference\nWhen the header is omitted, Antix infers the provider from the key prefix (e.g., `sk-ant-…` → Anthropic, `sk-…` → OpenAI). Alibaba/DashScope keys have no distinctive prefix — you **must** set `X-Antix-Provider` for those requests, otherwise they will fail upstream with `401 Unauthorized`.\n:::\n"}, "f4b8d759b6080f1994ccf48f82c6c1f2e7219365": {"t": 1785765524.0007632, "n": 2934, "h": "e822848b112c603a", "c": "---\ntitle: \"Routing & BYOK\"\ndescription: \"Endpoints, multi-protocol SDK compatibility, and Bring Your Own Key semantics.\"\nsidebar_position: 1\n---\n\n# Routing & BYOK\n\nAntix is a multi-protocol gateway. It accepts requests in OpenAI, Anthropic, and Gemini shapes and normalizes streaming across upstream providers including Anthropic, Google Gemini, Alibaba Qwen, xAI, and OpenAI.\n\n## Supported endpoints\n\n| Endpoint | Method | Protocol |\n|---|---|---|\n| `/v1/chat/completions` | POST | OpenAI Chat Completions |\n| `/v1/responses` | POST | OpenAI Responses API |\n| `/v1/messages` | POST | Anthropic Messages |\n| `/v1/messages/count_tokens` | POST | Anthropic token counter |\n| `/v1/models/{action}` | POST | Gemini native (`:generateContent`, `:streamGenerateContent`) |\n| `/v1beta/models/{action}` | POST | Gemini v1beta native path |\n| `/v1/models`, `/models` | GET | Public model catalog (no auth) |\n| `/v2/model/info` | GET | Catalog with pricing |\n\n`/v1/embeddings`, audio, images, files, fine-tuning, and the batch API are **not** supported.\n\n## Drop-in SDK compatibility\n\nPoint any OpenAI, Anthropic, or Gemini SDK at Antix by changing the base URL and swapping in your Virtual Key. The proxy translates provider-specific quirks and keeps SSE streaming predictable.\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n base_url=\"https://antix.antigma.ai/v1\",\n api_key=\"sk-antix-<your-key>\",\n)\n\nresponse = client.chat.completions.create(\n model=\"claude-sonnet-4-6\",\n messages=[{\"role\": \"user\", \"content\": \"Hello!\"}],\n stream=True,\n)\n```\n\nA streaming pipeline normalizes SSE events across providers so token deltas, tool calls, and stop reasons arrive in a consistent shape regardless of upstream.\n\n## Bring Your Own Key (BYOK)\n\nIf you have negotiated direct rates with a provider but still want Antix's observability and routing, use BYOK. Send your provider key in `Authorization` and declare the provider with `X-Antix-Provider`:\n\n```bash\ncurl -X POST https://antix.antigma.ai/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_ALIBABA_DASHSCOPE_KEY\" \\\n -H \"X-Antix-Provider: alibaba\" \\\n -d '{\n \"model\": \"qwen-max\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n }'\n```\n\nBYOK traffic is not re-billed by Antix. It is still tracked for observability.\n\n### Accepted `X-Antix-Provider` values\n\n| Provider | Accepted values |\n|---|---|\n| OpenAI | `openai` |\n| Anthropic | `anthropic` |\n| Google Gemini | `google`, `gemini`, `google_ai_studio_gemini` |\n| xAI | `xai`, `x-ai` |\n| Alibaba / DashScope | `alibaba`, `qwen`, `dashscope` |\n\n:::note Provider inference\nWhen the header is omitted, Antix infers the provider from the key prefix (e.g., `sk-ant-…` → Anthropic, `sk-…` → OpenAI). Alibaba/DashScope keys have no distinctive prefix — you **must** set `X-Antix-Provider` for those requests, otherwise they will fail upstream with `401 Unauthorized`.\n:::\n"}, "5b2e6eb53f6410981f51472557a2c94f1f91fd7e": {"t": 1785765525.2715085, "n": 2939, "h": "ef8784f4717b3670", "c": "---\ntitle: \"Routing & BYOK\"\ndescription: \"Endpoints, multi-protocol SDK compatibility, and Bring Your Own Key semantics.\"\nsidebar_position: 1\n---\n\n# Routing & BYOK\n\nAntix is a multi-protocol gateway. It accepts requests in OpenAI, Anthropic, and Gemini shapes and normalizes streaming across upstream providers including Anthropic, Google Gemini, Alibaba Qwen, xAI, and OpenAI.\n\n## Supported endpoints\n\n| Endpoint | Method | Protocol |\n|---|---|---|\n| `/v1/chat/completions` | POST | OpenAI Chat Completions |\n| `/v1/responses` | POST | OpenAI Responses API |\n| `/v1/messages` | POST | Anthropic Messages |\n| `/v1/messages/count_tokens` | POST | Anthropic token counter |\n| `/v1/models/{action}` | POST | Gemini native (`:generateContent`, `:streamGenerateContent`) |\n| `/v1beta/models/{action}` | POST | Gemini v1beta native path |\n| `/v1/models`, `/models` | GET | Public model catalog (no auth) |\n| `/v2/model/info` | GET | Catalog with pricing |\n\n`/v1/embeddings`, audio, images, files, fine-tuning, and the batch API are **not** supported.\n\n## Drop-in SDK compatibility\n\nPoint any OpenAI, Anthropic, or Gemini SDK at Antix by changing the base URL and swapping in your Virtual Key. The proxy translates provider-specific quirks and keeps SSE streaming predictable.\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n base_url=\"https://antix.antigma.ai/v1\",\n api_key=\"sk-antix-<your-key>\",\n)\n\nresponse = client.chat.completions.create(\n model=\"claude-sonnet-4-6\",\n messages=[{\"role\": \"user\", \"content\": \"Hello!\"}],\n stream=True,\n)\n```\n\nA Rust streaming pipeline normalizes SSE events across providers so token deltas, tool calls, and stop reasons arrive in a consistent shape regardless of upstream.\n\n## Bring Your Own Key (BYOK)\n\nIf you have negotiated direct rates with a provider but still want Antix's observability and routing, use BYOK. Send your provider key in `Authorization` and declare the provider with `X-Antix-Provider`:\n\n```bash\ncurl -X POST https://antix.antigma.ai/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_ALIBABA_DASHSCOPE_KEY\" \\\n -H \"X-Antix-Provider: alibaba\" \\\n -d '{\n \"model\": \"qwen-max\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n }'\n```\n\nBYOK traffic is not re-billed by Antix. It is still tracked for observability.\n\n### Accepted `X-Antix-Provider` values\n\n| Provider | Accepted values |\n|---|---|\n| OpenAI | `openai` |\n| Anthropic | `anthropic` |\n| Google Gemini | `google`, `gemini`, `google_ai_studio_gemini` |\n| xAI | `xai`, `x-ai` |\n| Alibaba / DashScope | `alibaba`, `qwen`, `dashscope` |\n\n:::note Provider inference\nWhen the header is omitted, Antix infers the provider from the key prefix (e.g., `sk-ant-…` → Anthropic, `sk-…` → OpenAI). Alibaba/DashScope keys have no distinctive prefix — you **must** set `X-Antix-Provider` for those requests, otherwise they will fail upstream with `401 Unauthorized`.\n:::\n"}, "8ce59518ed8a2ddda46c07cbb0b6fb1f528438a3": {"t": 1786067817.7229624, "n": 4532, "h": "0a40eb06fcbfed13", "c": "---\ntitle: \"Routing & BYOK\"\ndescription: \"Endpoints, multi-protocol SDK compatibility, and Bring Your Own Key semantics.\"\nsidebar_position: 1\n---\n\n# Routing & BYOK\n\nAntix is a multi-protocol gateway. It accepts requests in OpenAI, Anthropic, and Gemini shapes and normalizes streaming across upstream providers including Anthropic, Google Gemini, Alibaba Qwen, DeepSeek, Zai (GLM), xAI, and OpenAI.\n\n## Supported endpoints\n\n| Endpoint | Method | Protocol |\n|---|---|---|\n| `/v1/chat/completions` | POST | OpenAI Chat Completions |\n| `/v1/responses` | POST | OpenAI Responses API |\n| `/v1/messages` | POST | Anthropic Messages |\n| `/v1/messages/count_tokens` | POST | Anthropic token counter |\n| `/v1/models/{action}` | POST | Gemini native (`:generateContent`, `:streamGenerateContent`) |\n| `/v1beta/models/{action}` | POST | Gemini v1beta native path |\n| `/v1/models`, `/models` | GET | Public model catalog (no auth) |\n| `/v2/model/info` | GET | Catalog with pricing |\n\n`/v1/embeddings`, audio, images, files, fine-tuning, and the batch API are **not** supported.\n\n## Drop-in SDK compatibility\n\nPoint any OpenAI, Anthropic, or Gemini SDK at Antix by changing the base URL and swapping in your Virtual Key. The proxy translates provider-specific quirks and keeps SSE streaming predictable.\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n base_url=\"https://antix.antigma.ai/v1\",\n api_key=\"sk-antix-<your-key>\",\n)\n\nresponse = client.chat.completions.create(\n model=\"claude-sonnet-4-6\",\n messages=[{\"role\": \"user\", \"content\": \"Hello!\"}],\n stream=True,\n)\n```\n\nA streaming pipeline normalizes SSE events across providers so token deltas, tool calls, and stop reasons arrive in a consistent shape regardless of upstream.\n\n### Claude Code\n\nClaude Code uses the Anthropic SDK internally, so redirecting it at Antix takes one environment variable:\n\n```bash\nexport ANTHROPIC_BASE_URL=\"https://antix.antigma.ai\"\n```\n\nThat's it — Claude Code's SDK reads both and routes all `/v1/messages` traffic to Antix, which passes it through to Anthropic with your platform key substituted.\n\n## Bring Your Own Key (BYOK)\n\nIf you have negotiated direct rates with a provider but still want Antix's observability and routing, use BYOK. Send your provider key in `Authorization` and declare the provider with `X-Antix-Provider`:\n\n```bash\ncurl -X POST https://antix.antigma.ai/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_ALIBABA_DASHSCOPE_KEY\" \\\n -H \"X-Antix-Provider: alibaba\" \\\n -d '{\n \"model\": \"qwen-max\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n }'\n```\n\nBYOK traffic is not re-billed by Antix. It is still tracked for observability.\n\n### Supported providers\n\nAntix normalizes requests across these upstream providers. Route to any of them by model name (Antix infers the provider) or explicitly via `X-Antix-Provider`:\n\n| Provider | Notable models | Accepted `X-Antix-Provider` values | Notes |\n|---|---|---|---|\n| **Anthropic** | Claude Sonnet, Opus, Haiku | `anthropic` | Native `/v1/messages` support. |\n| **OpenAI** | GPT-5.x | `openai` | Native `/v1/chat/completions` and `/v1/responses` support. |\n| **Google Gemini** | Gemini 3.x | `google`, `gemini`, `google_ai_studio_gemini` | Native Gemini protocol at `/v1/models/{action}` and `/v1beta`. |\n| **xAI** | Grok | `xai`, `x-ai` | OpenAI-compatible upstream. |\n| **Alibaba Qwen** | `qwen3-max`, `qwen3-coder-plus`, `qwen3-coder-flash`, `qwq-plus`, `qwen-plus`, `qwen-max`, and more | `alibaba`, `qwen`, `dashscope` | Routed via DashScope. No distinctive key prefix — you **must** set `X-Antix-Provider` on BYOK calls. |\n| **DeepSeek** | `deepseek-chat` (V3), `deepseek-reasoner` (R1), `deepseek-v4-pro`, `deepseek-v4-flash` | `deepseek` | OpenAI-compatible upstream API. `deepseek-reasoner` returns a `reasoning_content` field alongside the final answer. |\n| **Zai (GLM)** | `glm-5.2`, `glm-5.1`, `glm-4.7` | `zai` | Zhipu AI's GLM model family, OpenAI-compatible upstream. No distinctive key prefix — you **must** set `X-Antix-Provider` on BYOK calls. |\n\n:::note Provider inference\nWhen the header is omitted, Antix infers the provider from the key prefix (e.g., `sk-ant-…` → Anthropic, `sk-…` → OpenAI). Some keys (like Alibaba/DashScope or Zai) may have no distinctive prefix — you **must** set `X-Antix-Provider` for those requests, otherwise they will fail upstream with `401 Unauthorized`.\n:::\n\nSee [Models API](/antix/concepts/models) to list exactly which models your gateway currently serves.\n"}, "d316a4434b214c0fb90ceb144d8c073f9ec44b8f": {"t": 1786068471.9942873, "n": 4532, "h": "0a40eb06fcbfed13", "c": "---\ntitle: \"Routing & BYOK\"\ndescription: \"Endpoints, multi-protocol SDK compatibility, and Bring Your Own Key semantics.\"\nsidebar_position: 1\n---\n\n# Routing & BYOK\n\nAntix is a multi-protocol gateway. It accepts requests in OpenAI, Anthropic, and Gemini shapes and normalizes streaming across upstream providers including Anthropic, Google Gemini, Alibaba Qwen, DeepSeek, Zai (GLM), xAI, and OpenAI.\n\n## Supported endpoints\n\n| Endpoint | Method | Protocol |\n|---|---|---|\n| `/v1/chat/completions` | POST | OpenAI Chat Completions |\n| `/v1/responses` | POST | OpenAI Responses API |\n| `/v1/messages` | POST | Anthropic Messages |\n| `/v1/messages/count_tokens` | POST | Anthropic token counter |\n| `/v1/models/{action}` | POST | Gemini native (`:generateContent`, `:streamGenerateContent`) |\n| `/v1beta/models/{action}` | POST | Gemini v1beta native path |\n| `/v1/models`, `/models` | GET | Public model catalog (no auth) |\n| `/v2/model/info` | GET | Catalog with pricing |\n\n`/v1/embeddings`, audio, images, files, fine-tuning, and the batch API are **not** supported.\n\n## Drop-in SDK compatibility\n\nPoint any OpenAI, Anthropic, or Gemini SDK at Antix by changing the base URL and swapping in your Virtual Key. The proxy translates provider-specific quirks and keeps SSE streaming predictable.\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n base_url=\"https://antix.antigma.ai/v1\",\n api_key=\"sk-antix-<your-key>\",\n)\n\nresponse = client.chat.completions.create(\n model=\"claude-sonnet-4-6\",\n messages=[{\"role\": \"user\", \"content\": \"Hello!\"}],\n stream=True,\n)\n```\n\nA streaming pipeline normalizes SSE events across providers so token deltas, tool calls, and stop reasons arrive in a consistent shape regardless of upstream.\n\n### Claude Code\n\nClaude Code uses the Anthropic SDK internally, so redirecting it at Antix takes one environment variable:\n\n```bash\nexport ANTHROPIC_BASE_URL=\"https://antix.antigma.ai\"\n```\n\nThat's it — Claude Code's SDK reads both and routes all `/v1/messages` traffic to Antix, which passes it through to Anthropic with your platform key substituted.\n\n## Bring Your Own Key (BYOK)\n\nIf you have negotiated direct rates with a provider but still want Antix's observability and routing, use BYOK. Send your provider key in `Authorization` and declare the provider with `X-Antix-Provider`:\n\n```bash\ncurl -X POST https://antix.antigma.ai/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_ALIBABA_DASHSCOPE_KEY\" \\\n -H \"X-Antix-Provider: alibaba\" \\\n -d '{\n \"model\": \"qwen-max\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n }'\n```\n\nBYOK traffic is not re-billed by Antix. It is still tracked for observability.\n\n### Supported providers\n\nAntix normalizes requests across these upstream providers. Route to any of them by model name (Antix infers the provider) or explicitly via `X-Antix-Provider`:\n\n| Provider | Notable models | Accepted `X-Antix-Provider` values | Notes |\n|---|---|---|---|\n| **Anthropic** | Claude Sonnet, Opus, Haiku | `anthropic` | Native `/v1/messages` support. |\n| **OpenAI** | GPT-5.x | `openai` | Native `/v1/chat/completions` and `/v1/responses` support. |\n| **Google Gemini** | Gemini 3.x | `google`, `gemini`, `google_ai_studio_gemini` | Native Gemini protocol at `/v1/models/{action}` and `/v1beta`. |\n| **xAI** | Grok | `xai`, `x-ai` | OpenAI-compatible upstream. |\n| **Alibaba Qwen** | `qwen3-max`, `qwen3-coder-plus`, `qwen3-coder-flash`, `qwq-plus`, `qwen-plus`, `qwen-max`, and more | `alibaba`, `qwen`, `dashscope` | Routed via DashScope. No distinctive key prefix — you **must** set `X-Antix-Provider` on BYOK calls. |\n| **DeepSeek** | `deepseek-chat` (V3), `deepseek-reasoner` (R1), `deepseek-v4-pro`, `deepseek-v4-flash` | `deepseek` | OpenAI-compatible upstream API. `deepseek-reasoner` returns a `reasoning_content` field alongside the final answer. |\n| **Zai (GLM)** | `glm-5.2`, `glm-5.1`, `glm-4.7` | `zai` | Zhipu AI's GLM model family, OpenAI-compatible upstream. No distinctive key prefix — you **must** set `X-Antix-Provider` on BYOK calls. |\n\n:::note Provider inference\nWhen the header is omitted, Antix infers the provider from the key prefix (e.g., `sk-ant-…` → Anthropic, `sk-…` → OpenAI). Some keys (like Alibaba/DashScope or Zai) may have no distinctive prefix — you **must** set `X-Antix-Provider` for those requests, otherwise they will fail upstream with `401 Unauthorized`.\n:::\n\nSee [Models API](/antix/concepts/models) to list exactly which models your gateway currently serves.\n"}}, "docs-site/i18n/zh-Hans/docusaurus-plugin-content-docs/current/antix/concepts/routing.md": {"485f037514ac52cdb36b0a5d467b9d32424832b3": {"t": 1785746549.66998, "n": 3492, "h": "096d9efa5499347d", "c": "---\ntitle: \"路由与 BYOK\"\ndescription: \"端点、多协议 SDK 兼容性以及自带密钥(Bring Your Own Key)语义。\"\nsidebar_position: 1\n---\n\n# 路由与 BYOK {#routing--byok}\n\nAntix 是一个多协议网关。它接受 OpenAI、Anthropic 和 Gemini 数据结构的请求,并将跨越上游提供商的流式传输规范化,包括 Anthropic、Google Gemini、Alibaba Qwen、DeepSeek、Zai (GLM)、xAI 和 OpenAI。\n\n## 支持的端点 {#supported-endpoints}\n\n| 端点 | 方法 | 协议 |\n|---|---|---|\n| `/v1/chat/completions` | POST | OpenAI Chat Completions |\n| `/v1/responses` | POST | OpenAI Responses API |\n| `/v1/messages` | POST | Anthropic Messages |\n| `/v1/messages/count_tokens` | POST | Anthropic token counter |\n| `/v1/models/{action}` | POST | Gemini 原生(`:generateContent`, `:streamGenerateContent`) |\n| `/v1beta/models/{action}` | POST | Gemini v1beta 原生路径 |\n| `/v1/models`, `/models` | GET | 公开模型目录(无身份验证) |\n| `/v2/model/info` | GET | 包含定价的目录 |\n\n**不**支持 `/v1/embeddings`、音频、图像、文件、微调(fine-tuning)和批处理(batch)API。\n\n## 即插即用的 SDK 兼容性 {#drop-in-sdk-compatibility}\n\n通过更改基地址(base URL)并换上您的虚拟密钥,将任何 OpenAI、Anthropic 或 Gemini SDK 指向 Antix。代理会转换特定于提供商的特性,并保持 SSE 流的传输可预测。\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n base_url=\"https://antix.antigma.ai/v1\",\n api_key=\"sk-antix-<your-key>\",\n)\n\nresponse = client.chat.completions.create(\n model=\"claude-sonnet-4-6\",\n messages=[{\"role\": \"user\", \"content\": \"Hello!\"}],\n stream=True,\n)\n```\n\n流式传输管道将跨提供商的 SSE 事件标准化,因此无论上游情况如何,代币增量、工具调用和停止原因都将以一致的数据结构到达。\n\n### Claude Code {#claude-code}\n\nClaude Code 内部使用 Anthropic SDK,因此将其重定向到 Antix 只需要一个环境变量:\n\n```bash\nexport ANTHROPIC_BASE_URL=\"https://antix.antigma.ai\"\n```\n\n就是这样——Claude Code 的 SDK 会读取这两个配置,并将所有的 `/v1/messages` 流量路由到 Antix,Antix 在替换您的平台密钥后将其原样传递给 Anthropic。\n\n## 自带密钥(Bring Your Own Key, BYOK) {#bring-your-own-key-byok}\n\n如果您已经与提供商协商了直接费率,但仍然想要 Antix 的可观测性和路由功能,请使用 BYOK。在 `Authorization` 中发送您的提供商密钥,并通过 `X-Antix-Provider` 声明提供商:\n\n```bash\ncurl -X POST https://antix.antigma.ai/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_ALIBABA_DASHSCOPE_KEY\" \\\n -H \"X-Antix-Provider: alibaba\" \\\n -d '{\n \"model\": \"qwen-max\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n }'\n```\n\nAntix 不会对 BYOK 流量重新计费。为了可观测性,它仍会被追踪记录。\n\n### 支持的提供商 {#supported-providers}\n\nAntix 在这些上游提供商之间将请求标准化。您可以通过模型名称(Antix 会推断提供商)或通过 `X-Antix-Provider` 明确地路由到其中的任何一个:\n\n| 提供商 | 显著的模型 | 可接受的 `X-Antix-Provider` 值 | 备注 |\n|---|---|---|---|\n| **Anthropic** | Claude Sonnet, Opus, Haiku | `anthropic` | 原生 `/v1/messages` 支持。 |\n| **OpenAI** | GPT-5.x | `openai` | 原生 `/v1/chat/completions` 和 `/v1/responses` 支持。 |\n| **Google Gemini** | Gemini 3.x | `google`, `gemini`, `google_ai_studio_gemini` | `/v1/models/{action}` 和 `/v1beta` 的原生 Gemini 协议。 |\n| **xAI** | Grok | `xai`, `x-ai` | 兼容 OpenAI 的上游。 |\n| **Alibaba Qwen** | `qwen3-max`, `qwen3-coder-plus`, `qwen3-coder-flash`, `qwq-plus`, `qwen-plus`, `qwen-max`, 等等 | `alibaba`, `qwen`, `dashscope` | 通过 DashScope 路由。没有独特的密钥前缀——您**必须**在 BYOK 调用中设置 `X-Antix-Provider`。 |\n| **DeepSeek** | `deepseek-chat` (V3), `deepseek-reasoner` (R1), `deepseek-v4-pro`, `deepseek-v4-flash` | `deepseek` | 兼容 OpenAI 的上游 API。`deepseek-reasoner` 会在最终答案旁返回 `reasoning_content` 字段。 |\n| **Zai (GLM)** | `glm-5.2`, `glm-5.1`, `glm-4.7` | `zai` | 智谱 AI 的 GLM 模型系列,兼容 OpenAI 的上游。没有独特的密钥前缀——您**必须**在 BYOK 调用中设置 `X-Antix-Provider`。 |\n\n:::note 提供商推断\n当标头被省略时,Antix 会从密钥前缀推断提供商(例如,`sk-ant-…` → Anthropic,`sk-…` → OpenAI)。某些密钥(如 Alibaba/DashScope 或 Zai)可能没有明显的前缀——您**必须**为这些请求设置 `X-Antix-Provider`,否则它们在上游将因 `401 Unauthorized` 失败。\n:::\n\n请参阅[模型 API](/antix/concepts/models)以准确列出您的网关目前提供服务的模型。\n"}, "f2861ee4088de1e56a31265242f7d190cb336a35": {"t": 1785765521.1335819, "n": 3492, "h": "096d9efa5499347d", "c": "---\ntitle: \"路由与 BYOK\"\ndescription: \"端点、多协议 SDK 兼容性以及自带密钥(Bring Your Own Key)语义。\"\nsidebar_position: 1\n---\n\n# 路由与 BYOK {#routing--byok}\n\nAntix 是一个多协议网关。它接受 OpenAI、Anthropic 和 Gemini 数据结构的请求,并将跨越上游提供商的流式传输规范化,包括 Anthropic、Google Gemini、Alibaba Qwen、DeepSeek、Zai (GLM)、xAI 和 OpenAI。\n\n## 支持的端点 {#supported-endpoints}\n\n| 端点 | 方法 | 协议 |\n|---|---|---|\n| `/v1/chat/completions` | POST | OpenAI Chat Completions |\n| `/v1/responses` | POST | OpenAI Responses API |\n| `/v1/messages` | POST | Anthropic Messages |\n| `/v1/messages/count_tokens` | POST | Anthropic token counter |\n| `/v1/models/{action}` | POST | Gemini 原生(`:generateContent`, `:streamGenerateContent`) |\n| `/v1beta/models/{action}` | POST | Gemini v1beta 原生路径 |\n| `/v1/models`, `/models` | GET | 公开模型目录(无身份验证) |\n| `/v2/model/info` | GET | 包含定价的目录 |\n\n**不**支持 `/v1/embeddings`、音频、图像、文件、微调(fine-tuning)和批处理(batch)API。\n\n## 即插即用的 SDK 兼容性 {#drop-in-sdk-compatibility}\n\n通过更改基地址(base URL)并换上您的虚拟密钥,将任何 OpenAI、Anthropic 或 Gemini SDK 指向 Antix。代理会转换特定于提供商的特性,并保持 SSE 流的传输可预测。\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n base_url=\"https://antix.antigma.ai/v1\",\n api_key=\"sk-antix-<your-key>\",\n)\n\nresponse = client.chat.completions.create(\n model=\"claude-sonnet-4-6\",\n messages=[{\"role\": \"user\", \"content\": \"Hello!\"}],\n stream=True,\n)\n```\n\n流式传输管道将跨提供商的 SSE 事件标准化,因此无论上游情况如何,代币增量、工具调用和停止原因都将以一致的数据结构到达。\n\n### Claude Code {#claude-code}\n\nClaude Code 内部使用 Anthropic SDK,因此将其重定向到 Antix 只需要一个环境变量:\n\n```bash\nexport ANTHROPIC_BASE_URL=\"https://antix.antigma.ai\"\n```\n\n就是这样——Claude Code 的 SDK 会读取这两个配置,并将所有的 `/v1/messages` 流量路由到 Antix,Antix 在替换您的平台密钥后将其原样传递给 Anthropic。\n\n## 自带密钥(Bring Your Own Key, BYOK) {#bring-your-own-key-byok}\n\n如果您已经与提供商协商了直接费率,但仍然想要 Antix 的可观测性和路由功能,请使用 BYOK。在 `Authorization` 中发送您的提供商密钥,并通过 `X-Antix-Provider` 声明提供商:\n\n```bash\ncurl -X POST https://antix.antigma.ai/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_ALIBABA_DASHSCOPE_KEY\" \\\n -H \"X-Antix-Provider: alibaba\" \\\n -d '{\n \"model\": \"qwen-max\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n }'\n```\n\nAntix 不会对 BYOK 流量重新计费。为了可观测性,它仍会被追踪记录。\n\n### 支持的提供商 {#supported-providers}\n\nAntix 在这些上游提供商之间将请求标准化。您可以通过模型名称(Antix 会推断提供商)或通过 `X-Antix-Provider` 明确地路由到其中的任何一个:\n\n| 提供商 | 显著的模型 | 可接受的 `X-Antix-Provider` 值 | 备注 |\n|---|---|---|---|\n| **Anthropic** | Claude Sonnet, Opus, Haiku | `anthropic` | 原生 `/v1/messages` 支持。 |\n| **OpenAI** | GPT-5.x | `openai` | 原生 `/v1/chat/completions` 和 `/v1/responses` 支持。 |\n| **Google Gemini** | Gemini 3.x | `google`, `gemini`, `google_ai_studio_gemini` | `/v1/models/{action}` 和 `/v1beta` 的原生 Gemini 协议。 |\n| **xAI** | Grok | `xai`, `x-ai` | 兼容 OpenAI 的上游。 |\n| **Alibaba Qwen** | `qwen3-max`, `qwen3-coder-plus`, `qwen3-coder-flash`, `qwq-plus`, `qwen-plus`, `qwen-max`, 等等 | `alibaba`, `qwen`, `dashscope` | 通过 DashScope 路由。没有独特的密钥前缀——您**必须**在 BYOK 调用中设置 `X-Antix-Provider`。 |\n| **DeepSeek** | `deepseek-chat` (V3), `deepseek-reasoner` (R1), `deepseek-v4-pro`, `deepseek-v4-flash` | `deepseek` | 兼容 OpenAI 的上游 API。`deepseek-reasoner` 会在最终答案旁返回 `reasoning_content` 字段。 |\n| **Zai (GLM)** | `glm-5.2`, `glm-5.1`, `glm-4.7` | `zai` | 智谱 AI 的 GLM 模型系列,兼容 OpenAI 的上游。没有独特的密钥前缀——您**必须**在 BYOK 调用中设置 `X-Antix-Provider`。 |\n\n:::note 提供商推断\n当标头被省略时,Antix 会从密钥前缀推断提供商(例如,`sk-ant-…` → Anthropic,`sk-…` → OpenAI)。某些密钥(如 Alibaba/DashScope 或 Zai)可能没有明显的前缀——您**必须**为这些请求设置 `X-Antix-Provider`,否则它们在上游将因 `401 Unauthorized` 失败。\n:::\n\n请参阅[模型 API](/antix/concepts/models)以准确列出您的网关目前提供服务的模型。\n"}, "8ce59518ed8a2ddda46c07cbb0b6fb1f528438a3": {"t": 1786067819.3472822, "n": 3492, "h": "096d9efa5499347d", "c": "---\ntitle: \"路由与 BYOK\"\ndescription: \"端点、多协议 SDK 兼容性以及自带密钥(Bring Your Own Key)语义。\"\nsidebar_position: 1\n---\n\n# 路由与 BYOK {#routing--byok}\n\nAntix 是一个多协议网关。它接受 OpenAI、Anthropic 和 Gemini 数据结构的请求,并将跨越上游提供商的流式传输规范化,包括 Anthropic、Google Gemini、Alibaba Qwen、DeepSeek、Zai (GLM)、xAI 和 OpenAI。\n\n## 支持的端点 {#supported-endpoints}\n\n| 端点 | 方法 | 协议 |\n|---|---|---|\n| `/v1/chat/completions` | POST | OpenAI Chat Completions |\n| `/v1/responses` | POST | OpenAI Responses API |\n| `/v1/messages` | POST | Anthropic Messages |\n| `/v1/messages/count_tokens` | POST | Anthropic token counter |\n| `/v1/models/{action}` | POST | Gemini 原生(`:generateContent`, `:streamGenerateContent`) |\n| `/v1beta/models/{action}` | POST | Gemini v1beta 原生路径 |\n| `/v1/models`, `/models` | GET | 公开模型目录(无身份验证) |\n| `/v2/model/info` | GET | 包含定价的目录 |\n\n**不**支持 `/v1/embeddings`、音频、图像、文件、微调(fine-tuning)和批处理(batch)API。\n\n## 即插即用的 SDK 兼容性 {#drop-in-sdk-compatibility}\n\n通过更改基地址(base URL)并换上您的虚拟密钥,将任何 OpenAI、Anthropic 或 Gemini SDK 指向 Antix。代理会转换特定于提供商的特性,并保持 SSE 流的传输可预测。\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n base_url=\"https://antix.antigma.ai/v1\",\n api_key=\"sk-antix-<your-key>\",\n)\n\nresponse = client.chat.completions.create(\n model=\"claude-sonnet-4-6\",\n messages=[{\"role\": \"user\", \"content\": \"Hello!\"}],\n stream=True,\n)\n```\n\n流式传输管道将跨提供商的 SSE 事件标准化,因此无论上游情况如何,代币增量、工具调用和停止原因都将以一致的数据结构到达。\n\n### Claude Code {#claude-code}\n\nClaude Code 内部使用 Anthropic SDK,因此将其重定向到 Antix 只需要一个环境变量:\n\n```bash\nexport ANTHROPIC_BASE_URL=\"https://antix.antigma.ai\"\n```\n\n就是这样——Claude Code 的 SDK 会读取这两个配置,并将所有的 `/v1/messages` 流量路由到 Antix,Antix 在替换您的平台密钥后将其原样传递给 Anthropic。\n\n## 自带密钥(Bring Your Own Key, BYOK) {#bring-your-own-key-byok}\n\n如果您已经与提供商协商了直接费率,但仍然想要 Antix 的可观测性和路由功能,请使用 BYOK。在 `Authorization` 中发送您的提供商密钥,并通过 `X-Antix-Provider` 声明提供商:\n\n```bash\ncurl -X POST https://antix.antigma.ai/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_ALIBABA_DASHSCOPE_KEY\" \\\n -H \"X-Antix-Provider: alibaba\" \\\n -d '{\n \"model\": \"qwen-max\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n }'\n```\n\nAntix 不会对 BYOK 流量重新计费。为了可观测性,它仍会被追踪记录。\n\n### 支持的提供商 {#supported-providers}\n\nAntix 在这些上游提供商之间将请求标准化。您可以通过模型名称(Antix 会推断提供商)或通过 `X-Antix-Provider` 明确地路由到其中的任何一个:\n\n| 提供商 | 显著的模型 | 可接受的 `X-Antix-Provider` 值 | 备注 |\n|---|---|---|---|\n| **Anthropic** | Claude Sonnet, Opus, Haiku | `anthropic` | 原生 `/v1/messages` 支持。 |\n| **OpenAI** | GPT-5.x | `openai` | 原生 `/v1/chat/completions` 和 `/v1/responses` 支持。 |\n| **Google Gemini** | Gemini 3.x | `google`, `gemini`, `google_ai_studio_gemini` | `/v1/models/{action}` 和 `/v1beta` 的原生 Gemini 协议。 |\n| **xAI** | Grok | `xai`, `x-ai` | 兼容 OpenAI 的上游。 |\n| **Alibaba Qwen** | `qwen3-max`, `qwen3-coder-plus`, `qwen3-coder-flash`, `qwq-plus`, `qwen-plus`, `qwen-max`, 等等 | `alibaba`, `qwen`, `dashscope` | 通过 DashScope 路由。没有独特的密钥前缀——您**必须**在 BYOK 调用中设置 `X-Antix-Provider`。 |\n| **DeepSeek** | `deepseek-chat` (V3), `deepseek-reasoner` (R1), `deepseek-v4-pro`, `deepseek-v4-flash` | `deepseek` | 兼容 OpenAI 的上游 API。`deepseek-reasoner` 会在最终答案旁返回 `reasoning_content` 字段。 |\n| **Zai (GLM)** | `glm-5.2`, `glm-5.1`, `glm-4.7` | `zai` | 智谱 AI 的 GLM 模型系列,兼容 OpenAI 的上游。没有独特的密钥前缀——您**必须**在 BYOK 调用中设置 `X-Antix-Provider`。 |\n\n:::note 提供商推断\n当标头被省略时,Antix 会从密钥前缀推断提供商(例如,`sk-ant-…` → Anthropic,`sk-…` → OpenAI)。某些密钥(如 Alibaba/DashScope 或 Zai)可能没有明显的前缀——您**必须**为这些请求设置 `X-Antix-Provider`,否则它们在上游将因 `401 Unauthorized` 失败。\n:::\n\n请参阅[模型 API](/antix/concepts/models)以准确列出您的网关目前提供服务的模型。\n"}, "d316a4434b214c0fb90ceb144d8c073f9ec44b8f": {"t": 1786068472.6095788, "n": 3492, "h": "096d9efa5499347d", "c": "---\ntitle: \"路由与 BYOK\"\ndescription: \"端点、多协议 SDK 兼容性以及自带密钥(Bring Your Own Key)语义。\"\nsidebar_position: 1\n---\n\n# 路由与 BYOK {#routing--byok}\n\nAntix 是一个多协议网关。它接受 OpenAI、Anthropic 和 Gemini 数据结构的请求,并将跨越上游提供商的流式传输规范化,包括 Anthropic、Google Gemini、Alibaba Qwen、DeepSeek、Zai (GLM)、xAI 和 OpenAI。\n\n## 支持的端点 {#supported-endpoints}\n\n| 端点 | 方法 | 协议 |\n|---|---|---|\n| `/v1/chat/completions` | POST | OpenAI Chat Completions |\n| `/v1/responses` | POST | OpenAI Responses API |\n| `/v1/messages` | POST | Anthropic Messages |\n| `/v1/messages/count_tokens` | POST | Anthropic token counter |\n| `/v1/models/{action}` | POST | Gemini 原生(`:generateContent`, `:streamGenerateContent`) |\n| `/v1beta/models/{action}` | POST | Gemini v1beta 原生路径 |\n| `/v1/models`, `/models` | GET | 公开模型目录(无身份验证) |\n| `/v2/model/info` | GET | 包含定价的目录 |\n\n**不**支持 `/v1/embeddings`、音频、图像、文件、微调(fine-tuning)和批处理(batch)API。\n\n## 即插即用的 SDK 兼容性 {#drop-in-sdk-compatibility}\n\n通过更改基地址(base URL)并换上您的虚拟密钥,将任何 OpenAI、Anthropic 或 Gemini SDK 指向 Antix。代理会转换特定于提供商的特性,并保持 SSE 流的传输可预测。\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n base_url=\"https://antix.antigma.ai/v1\",\n api_key=\"sk-antix-<your-key>\",\n)\n\nresponse = client.chat.completions.create(\n model=\"claude-sonnet-4-6\",\n messages=[{\"role\": \"user\", \"content\": \"Hello!\"}],\n stream=True,\n)\n```\n\n流式传输管道将跨提供商的 SSE 事件标准化,因此无论上游情况如何,代币增量、工具调用和停止原因都将以一致的数据结构到达。\n\n### Claude Code {#claude-code}\n\nClaude Code 内部使用 Anthropic SDK,因此将其重定向到 Antix 只需要一个环境变量:\n\n```bash\nexport ANTHROPIC_BASE_URL=\"https://antix.antigma.ai\"\n```\n\n就是这样——Claude Code 的 SDK 会读取这两个配置,并将所有的 `/v1/messages` 流量路由到 Antix,Antix 在替换您的平台密钥后将其原样传递给 Anthropic。\n\n## 自带密钥(Bring Your Own Key, BYOK) {#bring-your-own-key-byok}\n\n如果您已经与提供商协商了直接费率,但仍然想要 Antix 的可观测性和路由功能,请使用 BYOK。在 `Authorization` 中发送您的提供商密钥,并通过 `X-Antix-Provider` 声明提供商:\n\n```bash\ncurl -X POST https://antix.antigma.ai/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_ALIBABA_DASHSCOPE_KEY\" \\\n -H \"X-Antix-Provider: alibaba\" \\\n -d '{\n \"model\": \"qwen-max\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n }'\n```\n\nAntix 不会对 BYOK 流量重新计费。为了可观测性,它仍会被追踪记录。\n\n### 支持的提供商 {#supported-providers}\n\nAntix 在这些上游提供商之间将请求标准化。您可以通过模型名称(Antix 会推断提供商)或通过 `X-Antix-Provider` 明确地路由到其中的任何一个:\n\n| 提供商 | 显著的模型 | 可接受的 `X-Antix-Provider` 值 | 备注 |\n|---|---|---|---|\n| **Anthropic** | Claude Sonnet, Opus, Haiku | `anthropic` | 原生 `/v1/messages` 支持。 |\n| **OpenAI** | GPT-5.x | `openai` | 原生 `/v1/chat/completions` 和 `/v1/responses` 支持。 |\n| **Google Gemini** | Gemini 3.x | `google`, `gemini`, `google_ai_studio_gemini` | `/v1/models/{action}` 和 `/v1beta` 的原生 Gemini 协议。 |\n| **xAI** | Grok | `xai`, `x-ai` | 兼容 OpenAI 的上游。 |\n| **Alibaba Qwen** | `qwen3-max`, `qwen3-coder-plus`, `qwen3-coder-flash`, `qwq-plus`, `qwen-plus`, `qwen-max`, 等等 | `alibaba`, `qwen`, `dashscope` | 通过 DashScope 路由。没有独特的密钥前缀——您**必须**在 BYOK 调用中设置 `X-Antix-Provider`。 |\n| **DeepSeek** | `deepseek-chat` (V3), `deepseek-reasoner` (R1), `deepseek-v4-pro`, `deepseek-v4-flash` | `deepseek` | 兼容 OpenAI 的上游 API。`deepseek-reasoner` 会在最终答案旁返回 `reasoning_content` 字段。 |\n| **Zai (GLM)** | `glm-5.2`, `glm-5.1`, `glm-4.7` | `zai` | 智谱 AI 的 GLM 模型系列,兼容 OpenAI 的上游。没有独特的密钥前缀——您**必须**在 BYOK 调用中设置 `X-Antix-Provider`。 |\n\n:::note 提供商推断\n当标头被省略时,Antix 会从密钥前缀推断提供商(例如,`sk-ant-…` → Anthropic,`sk-…` → OpenAI)。某些密钥(如 Alibaba/DashScope 或 Zai)可能没有明显的前缀——您**必须**为这些请求设置 `X-Antix-Provider`,否则它们在上游将因 `401 Unauthorized` 失败。\n:::\n\n请参阅[模型 API](/antix/concepts/models)以准确列出您的网关目前提供服务的模型。\n"}}, "docs-site/docs/usage/providers.mdx": {"d316a4434b214c0fb90ceb144d8c073f9ec44b8f": {"t": 1786068449.433037, "n": 6148, "h": "2c5cae83cbac6398", "c": "---\ntitle: Providers\ndescription: \"Pick your provider, sign in, and customize the catalog\"\n---\n\nAnte is provider-agnostic. Each provider implements a common interface for sending prompts and receiving streaming responses, and providers and models are resolved from a catalog at session start.\n\nThis page covers the everyday tasks: picking a provider, authenticating, and customizing the catalog. For the complete list of built-in providers, every model they serve, and the full `catalog.json` schema, see the [Catalog Reference](/reference/catalog-reference).\n\n## Selecting a provider\n\nYou can set your provider three ways, in order of precedence:\n\n1. **CLI flag** — `ante --provider anthropic --model claude-sonnet-4-6`\n2. **Settings file** — set `provider` and `model` in `~/.ante/settings.json`\n3. **Auto-detect** — if you specify neither, Ante uses the first provider you have credentials for (and `local` if none).\n\nEvery provider key you can pass to `--provider` is listed in the [Catalog Reference](/reference/catalog-reference#built-in-providers).\n\nMid-session, type `/providers` in the TUI: pick a connected provider, then confirm a model (and effort) from its scoped picker. Ante remembers the last model you used on each provider. See [Models, Providers & Effort](/usage/models-and-thinking#switching-providers).\n\n## Authentication\n\nMost providers read an API key from an environment variable:\n\n```bash\nexport ANTHROPIC_API_KEY=\"sk-ant-...\"\nante --provider anthropic --model claude-sonnet-4-6\n```\n\nEach provider's exact auth method (env var name or OAuth) is in the [Catalog Reference](/reference/catalog-reference#built-in-providers).\n\n### Subscription login (OAuth)\n\nProviders with subscription plans (Anthropic, OpenAI, Antix, etc.) can sign in via OAuth instead, so you use your existing subscription without managing API keys. Type `/connect` in the TUI to open the provider login flow. Ante launches your default browser for authentication, then links your session automatically.\n\n<img src=\"/assets/cookbook/connect.gif\" alt=\"Connecting to a provider via /connect\" style={{width: '100%', borderRadius: '8px', margin: '16px 0'}} />\n\nOnce connected, Ante remembers your credentials for future sessions, so there is no need to re-authenticate each time.\n\n:::tip\nWhen using third-party providers, make sure the model supports tool use (function calling) — Ante relies on it for agent capabilities. If results are poor, try a larger or more capable model.\n:::\n\n## Custom catalog\n\nCreate `~/.ante/catalog.json` to add a provider Ante doesn't ship, patch a built-in one, or tweak a model's defaults. It is merged on top of the built-in presets at startup, so you only specify what you want to add or change. The examples below are the common cases; see the [Catalog Reference](/reference/catalog-reference#catalogjson-schema) for the full schema, authentication forms, and resolution rules.\n\n### Add a hosted provider\n\nMost hosted endpoints are OpenAI-compatible. Register one with `wire_style: \"OpenAiCompatible\"`, point `base_url` at it, and list the models you want to appear in the picker:\n\n```json\n{\n \"providers\": {\n \"together\": {\n \"display_name\": \"Together AI\",\n \"base_url\": \"https://api.together.xyz/v1\",\n \"wire_style\": \"OpenAiCompatible\",\n \"auth\": { \"bearer\": { \"env_key\": \"TOGETHER_API_KEY\" } },\n \"preferred_models\": [\n {\n \"id\": \"moonshotai/Kimi-K2-Instruct\",\n \"description\": \"Kimi K2 on Together\",\n \"max_tokens\": 16384,\n \"context_limit\": 128000,\n \"effort\": \"medium\"\n }\n ]\n }\n }\n}\n```\n\n```bash\nexport TOGETHER_API_KEY=\"...\"\nante --provider together --model moonshotai/Kimi-K2-Instruct\n```\n\n### Add a local provider with no auth\n\nOmit `auth` for a provider that needs no key, and leave `preferred_models` off when the provider has no stable picker/default model list — handy for a local server like Ollama where the available models change as you pull them. You can still pass any model id explicitly with `--provider` and `--model`:\n\n```json\n{\n \"providers\": {\n \"ollama\": {\n \"display_name\": \"Ollama\",\n \"base_url\": \"http://localhost:11434/v1\",\n \"wire_style\": \"OpenAiCompatible\"\n }\n }\n}\n```\n\n```bash\nante --provider ollama --model qwen2.5-coder:7b\n```\n\n### Patch a built-in provider\n\nWhen the key matches a built-in provider, only the fields you set are changed.\nSet optional fields such as `auth` or `http_headers` to `null` to clear the\npreset value:\n\n```json\n{\n \"providers\": {\n \"openai\": {\n \"base_url\": \"http://localhost:8080/v1\",\n \"auth\": null\n }\n }\n}\n```\n\n### Override model defaults\n\nThe `models` section patches a model by id without redefining it. Each field you set replaces the built-in default; everything else is left alone:\n\n```json\n{\n \"models\": {\n \"claude-opus-4-8\": { \"effort\": \"max\" },\n \"claude-sonnet-4-6\": { \"effort\": \"high\", \"max_tokens\": 64000 },\n \"gpt-5.5\": { \"temperature\": 0.2 }\n }\n}\n```\n\n## Third-party providers\n\n### Using Open Router\n\n1. Sign up at [openrouter.ai](https://openrouter.ai/) and generate an API key.\n2. Set your API key:\n ```bash\n export OPENROUTER_API_KEY=\"sk-or-...\"\n ```\n3. Use any model from [Open Router's model list](https://openrouter.ai/models):\n ```bash\n ante --provider openrouter --model deepseek/deepseek-reasoner\n ```\n\n### OpenAI-compatible providers\n\nMany LLM providers expose an OpenAI-compatible API (e.g., Together AI, Fireworks, Groq Cloud, Perplexity). For a one-off you can reuse the built-in `openai-compatible` provider via env vars (no catalog edit needed):\n\n1. Set the base URL — the per-provider variable takes precedence over `MODEL_BASE_URL`:\n ```bash\n export OPENAI_COMPATIBLE_BASE_URL=\"https://api.together.xyz/v1\"\n ```\n2. Set your API key:\n ```bash\n export OPENAI_COMPATIBLE_API_KEY=\"your-provider-api-key\"\n ```\n3. Run with the OpenAI Compatible provider:\n ```bash\n ante --provider openai-compatible --model meta-llama/Llama-3-70b-chat-hf\n ```\n\nFor something you'll use repeatedly, add a named provider to your [custom catalog](#custom-catalog) instead so it shows up in the picker.\n"}}}}