> ## Documentation Index
> Fetch the complete documentation index at: https://apixo.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude API Gateway：可用模型、定價與程式碼範例

> 透過 APIXO 接入當前的 Claude 模型，瞭解相容的 HTTP 請求和 SDK 用法、流式回應以及已核實的標準 token 費率。

對於一個 Anthropic SDK 整合，將基礎 URL 設為 `https://llm.apixo.ai`，並在 `model` 欄位中填入來自 [型號及價格表](#compare-claude-models-and-pricing) 的正確 ID。對於原始 HTTP，將請求發送到 `https://llm.apixo.ai/v1/messages`，並附帶 `x-api-key` 與 `anthropic-version: 2023-06-01`。請參考 [快速入門](#quickstart) 以透過 SDK 或 HTTP 提出相同請求。

> [!NOTE]
>
> 模型供應狀況與標準價格確認於 2026 年 11 月 18 日。最新費率及帳戶適用價格請見 [API 價目表](https://apixo.ai/pricing/api)。

> [!TIP]
>
> **選擇您的整合路徑：** [使用快速入門](#quickstart) 手動整合，或 [讓 AI 透過複製此頁面來實現](#let-an-ai-implement-it)。

## 改變什麼

| 設定 | APIXO 值 |
| - | - |
| SDK Base URL | `https://llm.apixo.ai` |
| 原始 HTTP 路徑 | `POST /v1/messages` |
| 請求 URL | `https://llm.apixo.ai/v1/messages` |
| API 金鑰 | `APIXO_API_KEY` 來自 [APIXO API 金鑰](https://apixo.ai/dashboard/api-keys) |
| API 金鑰標頭 | `x-api-key` |
| API 金鑰值 | `$APIXO_API_KEY` |
| 必填的版本標頭 | `anthropic-version: 2023-06-01` |
| 模型位置 | 請求主體 `model` |

> [!NOTE]
>
> `2023-06-01` 表示目前使用的 Anthropic Messages API 協定版本，與 Claude 模型的發布日期無關。直接傳送 HTTP 請求時必須附上這個標頭；使用 Anthropic SDK 時，SDK 會自動加入。

## 快速入門

```bash theme={null}
export APIXO_API_KEY="your_apixo_api_key"
```

> [tab] cURL
>
> ```bash theme={null}
> curl -X POST "https://llm.apixo.ai/v1/messages" \
>   -H "x-api-key: $APIXO_API_KEY" \
>   -H "anthropic-version: 2023-06-01" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "model": "claude-opus-5-5",
>     "max_tokens": 256,
>     "messages": [
>       {"role": "user", "content": "Say hello in one sentence."}
>     ]
>   }'
> ```

> [tab] JavaScript
>
> ```javascript theme={null}
> import Anthropic from "@anthropic-ai/sdk";
>
> const client = new Anthropic({
>   apiKey: process.env.APIXO_API_KEY,
>   baseURL: "https://llm.apixo.ai"
> });
>
> const message = await client.messages.create({
>   model: "claude-opus-5-5",
>   max_tokens: 256,
>   messages: [{ role: "user", content: "Say hello in one sentence." }]
> });
>
> for (const block of message.content) {
>   if (block.type === "text") process.stdout.write(block.text);
> }
> ```

> [tab] Python
>
> ```python theme={null}
> import os
> from anthropic import Anthropic
>
> client = Anthropic(
>     api_key=os.environ["APIXO_API_KEY"],
>     base_url="https://llm.apixo.ai",
> )
>
> message = client.messages.create(
>     model="claude-opus-5-5",
>     max_tokens=256,
>     messages=[{"role": "user", "content": "Say hello in one sentence."}],
> )
>
> print("".join(block.text for block in message.content if block.type == "text"))
> ```

> [!TIP]
>
> 範例使用 `claude-opus-5-5`。要使用比較表中的任何其他模型，只需更改 `model` 值。

## 比較 Claude 個型號和定價

| 模型 | 模型 ID | 推薦用於 | 輸入 | 輸出 | 快取寫入 | 快取讀取 | 節省比例 |
| - | - | - | -: | -: | -: | -: | -: |
| Claude Fable 5.2 | `claude-fable-5-2` | 各模型的 Messages API 串接方式 | \$4.8 | \$24 | \$6 | \$0.12 | 40% |
| Claude Fable 5.1 | `claude-fable-5-1` | 各模型的 Messages API 串接方式 | \$6 | \$30 | \$7.5 | \$0.15 | 40% |
| Claude Fable 5 | `claude-fable-5` | 各模型的 Messages API 串接方式 | \$6 | \$30 | \$7.5 | \$0.6 | 40% |
| Claude Opus 5.5 | `claude-opus-5-5` | 各模型的 Messages API 串接方式 | \$2.4 | \$12 | \$3 | \$0.12 | 40% |
| Claude Opus 5 | `claude-opus-5` | 各模型的 Messages API 串接方式 | \$3 | \$15 | \$3.75 | \$0.3 | 40% |
| Claude Opus 4.8 | `claude-opus-4-8` | Opus 模型適用於最苛刻的推理、編碼和代理工作 | \$3 | \$15 | \$3.75 | \$0.3 | 40% |
| Claude Opus 4.7 | `claude-opus-4-7` | 已針對 4.7 模型的高效能 Opus 工作負載 | \$3 | \$15 | \$3.75 | \$0.3 | 40% |
| Claude Opus 4.6 | `claude-opus-4-6` | Opus 4.6 上現有的複雜推理和編碼整合 | \$3 | \$15 | \$3.75 | \$0.3 | 40% |
| Claude Opus 4.5 20251101 | `claude-opus-4-5-20251101` | 版本固定的 Opus 4.5 集成 | \$3 | \$15 | \$3.75 | \$0.3 | 40% |
| Claude Sonnet 5.5 | `claude-sonnet-5-5` | 各模型的 Messages API 串接方式 | \$1.2 | \$6 | \$1.5 | \$0.06 | 40% |
| Claude Sonnet 5 | `claude-sonnet-5` | 各模型的 Messages API 串接方式 | \$1.2 | \$6 | \$1.5 | \$0.12 | 40% |
| Claude Sonnet 4.6 | `claude-sonnet-4-6` | 平衡日常專業和編碼工作的能力和成本 | \$1.8 | \$9 | \$2.25 | \$0.18 | 40% |
| Claude Sonnet 4.5 20250929 | `claude-sonnet-4-5-20250929` | 版本固定的 Sonnet 4.5 集成 | \$1.8 | \$9 | \$2.25 | \$0.18 | 40% |
| Claude Haiku 5.5 | `claude-haiku-5-5` | 各模型的 Messages API 串接方式 | \$0.06 | \$0.3 | \$0.075 | \$0.006 | 40% |
| Claude Haiku 4.5 20251001 | `claude-haiku-4-5-20251001` | 成本敏感、低延遲和大容量的 Claude 工作負載 | \$0.6 | \$3 | \$0.75 | \$0.06 | 40% |

每 100 萬 token 的價格以美元計算。核價日期：2026-11-18。節省比例以標準輸入價與一般市場參考價比較得出。實際價格可能因帳戶而異。費率為 \$0 表示此價目表對該快取類別不另外收費。詳見[API 定價](https://apixo.ai/pricing/api)。

此表使用標準快取寫入速率。如果模型單獨支援一小時快取寫入，則該生命週期遵循其適用的速率。其他與訊息相容的模型系列記錄在 [GLM、DeepSeek、Kimi 和 Grok](https://apixo.ai/docs/zh-hant/models/text/messages.md) 中。

## 讓AI來實現它

### 將此頁複製到 AI

使用頁面選單中的 **複製頁面** 按鈕，將複製的文件貼上到 AI 編碼工具中，並新增以下提示：

```text theme={null}
Integrate the APIXO Anthropic-compatible Messages API into my existing project
using the documentation below.

Requirements:
- Use model claude-opus-5-5 unless my project already specifies another supported model.
- Read APIXO_API_KEY from an environment variable and keep it server-side.
- Preserve my current language, framework, and project structure.
- Add the smallest working integration and one minimal verification request.
- Do not invent endpoints, model IDs, or request fields that are not documented.
```

將提示中的 `claude-opus-5-5` 替換為比較表中的任何模型 ID。

### 遠端 MCP 可用性

使用 `list_models` 和 `integration_type: llm_gateway` 來發現 Claude 模型 ID。將選定的 ID 傳遞到 `get_model_schema`（用於訊息合約）或傳遞到 `get_integration_guide`（用於伺服器端 SDK 設定）。 [APIXO MCP](https://apixo.ai/docs/zh-hant/integrations/mcp)

## 串流傳輸

```bash theme={null}
curl -N -X POST "https://llm.apixo.ai/v1/messages" \
  -H "x-api-key: $APIXO_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-5-5",
    "stream": true,
    "max_tokens": 256,
    "messages": [
      {"role": "user", "content": "Write a short release note."}
    ]
  }'
```

為 Python，Anthropic SDK 可為您從流中提取文字。隨著 `client` 設定在 [快速入門](#quickstart)，在每個文字片段到達時列印它。當流結束時迭代器結束；一個連接或 API 錯誤引發異常。

```python theme={null}
with client.messages.stream(
    model="claude-opus-5-5",
    max_tokens=256,
    messages=[{"role": "user", "content": "Write a short release note."}],
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)
print()
```

## 支援的 Claude 型號

使用這些精確模型 ID 之一以及上面顯示的兼容 API 格式。

* `claude-fable-5-2`
* `claude-fable-5-1`
* `claude-fable-5`
* `claude-opus-5-5`
* `claude-opus-5`
* `claude-opus-4-8`
* `claude-opus-4-7`
* `claude-opus-4-6`
* `claude-opus-4-5-20251101`
* `claude-sonnet-5-5`
* `claude-sonnet-5`
* `claude-sonnet-4-6`
* `claude-sonnet-4-5-20250929`
* `claude-haiku-5-5`
* `claude-haiku-4-5-20251001`

若要切換型號，請保留端點系列、API金鑰和請求格式，然後變更型號ID。

## 故障排除

* `401`：API 金鑰遺失或無效
* `400`：Messages API 請求主體無效、型號不受支援 ID、缺少 `max_tokens` 或缺少 `anthropic-version`
* `429`：速率限製或暫時容量限制
* `502`/`504`：服務錯誤或逾時

使用退避重試 `429`、`502` 和 `504`。重試前修復 `400` 和 `401`。

## 相關連結

* [Chat API概述](https://apixo.ai/docs/zh-hant/llm)
* [支援的型號](https://apixo.ai/docs/zh-hant/llm/supported-models.md)
* [LLM 身分驗證](https://apixo.ai/docs/zh-hant/llm/authentication.md)
* [LLM 串流](https://apixo.ai/docs/zh-hant/llm/streaming.md)
* [LLM 錯誤並重試](https://apixo.ai/docs/zh-hant/llm/errors-retry.md)
* [安裝APIXO MCP](https://apixo.ai/docs/zh-hant/integrations/mcp/installation.md)
* [AnthropicAPI版本控制](https://platform.claude.com/docs/en/api/versioning)
* [探索 Claude 模型上 APIXO](https://apixo.ai/models/llm/claude)
* [API定價](https://apixo.ai/pricing/api)

## 在 APIXO 上開啟模型

使用 [API 定價](https://apixo.ai/pricing/api) 了解目前型號的可用性和價格。即使 Playground 選擇器尚未新增模型，也可以直接使用上面的 API 模型 ID。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.