Claude API
Anthropic's LLM for complex reasoning, code, analysis, and extended-context tasks.
# Base URL
https://runapi.ai
# Endpoints
POST /v1/chat/completions
POST /v1/responses
POST /v1/messages
POST /v1beta/models/{model}:generateContent
POST /v1beta/models/{model}:streamGenerateContent
curl https://runapi.ai/v1/messages \
-H "Authorization: Bearer $RUNAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Review this pull request for security vulnerabilities, performance issues, and suggest concrete improvements."
}
]
}'
import anthropic
client = anthropic.Anthropic(
base_url="https://runapi.ai",
api_key="your-runapi-key"
)
message = client.messages.create(
model="claude-sonnet-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Review this pull request for security vulnerabilities, performance issues, and suggest concrete improvements."}]
)
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://runapi.ai",
apiKey: "your-runapi-key"
});
const message = await client.messages.create({
model: "claude-sonnet-5",
max_tokens: 1024,
messages: [{ role: "user", content: "Review this pull request for security vulnerabilities, performance issues, and suggest concrete improvements." }]
});
Claude is Anthropic's large language model family available in Opus, Sonnet, and Haiku tiers, designed for nuanced reasoning, long-context analysis, and code generation. It emphasizes accuracy, instruction following, and predictable outputs.
- 多個變體,對應不同速度/品質層級
- Model skill 包含文件、schema 與 setup 備註
- 支援 app-focused coding workflows
- 生成失敗不收費
比較所有 API 變體
| Variant | Billing | From | |
|---|---|---|---|
| claude-fable-5 | 1K tokens | $0.250 | 查看 → |
| claude-haiku-4-5-20251001 | 1K tokens | $0.030 | 查看 → |
| claude-opus-4-1-20250805 | 1K tokens | $0.380 | 查看 → |
| claude-opus-4-5-20251101 | 1K tokens | $0.130 | 查看 → |
| claude-opus-4-6 | 1K tokens | $0.130 | 查看 → |
| claude-opus-4-7 | 1K tokens | $0.130 | 查看 → |
| claude-opus-4-8 | 1K tokens | $0.130 | 查看 → |
| claude-opus-5 | 1K tokens | $0.130 | 查看 → |
| claude-sonnet-4-5-20250929 | 1K tokens | $0.080 | 查看 → |
| claude-sonnet-4-6 | 1K tokens | $0.080 | 查看 → |
| claude-sonnet-5 | 1K tokens | $0.050 | 查看 → |
Claude API 端點
使用 OpenAI 或 Anthropic SDK 搭配 RunAPI key 呼叫,不需額外 SDK。
| Endpoint | Protocol |
|---|---|
| /v1/chat/completions | OpenAI compatible |
| /v1/responses | OpenAI Responses |
| /v1/messages | Anthropic compatible |
| /v1beta/models/{model}:generateContent | Gemini generateContent |
| /v1beta/models/{model}:streamGenerateContent | Gemini streamGenerateContent |
從 model skill 到第一次結果,只需四步
選擇模型
挑選符合輸出類型、品質門檻與延遲目標的模型與變體。
設定
設定 RunAPI key,並在 coding workspace 安裝 model skill。
開發
使用 skill 指引,在你的 app 內加入模型功能。
接收
透過 task ID 查詢、在支援時串流,或處理 webhook callback。
Claude API 是甚麼?
Claude is Anthropic's LLM family, spanning Opus (frontier), Sonnet (balanced), and Haiku (fast). Through RunAPI, all Claude variants share the same API shape and per-token billing.
為何透過 RunAPI 使用 Claude API
一個驗證,對應所有 provider
一組 RunAPI key 即可解鎖整個 catalog。無需分開帳戶,亦無需為每個整合輪換密鑰。
統一定價與計費
按次以 USD 收費,每月結算。失敗的生成不會收費。
內含 schema 的 skill
型別化 schema 與 setup 備註打包在 model skill 內,讓實作從正確契約開始。
常見問題
What is the context window size?
Most Claude models support 200K tokens of context, with 1M-token context available on the latest Opus and Sonnet models. Pricing is the same per-token regardless of context size.
What is extended thinking?
Extended thinking lets Claude reason step-by-step before answering. Thinking tokens are billed as output tokens and count toward the context limit.
How do Opus, Sonnet, and Haiku compare?
Opus is the most capable for complex reasoning. Sonnet balances quality and speed. Haiku is the fastest and cheapest for high-throughput tasks.
Does Claude support tool use?
Yes — Claude can call tools, execute code, search the web, and fetch URLs. Tool use is generally available with no beta header required.
Is prompt caching available?
Yes — cache reads are charged at roughly 10% of the standard input rate, significantly reducing cost for repeated contexts.
我應該先用邊個版本?
先選最平而且符合你質素要求的版本。大多數團隊會先用快速版本,之後再升級到 pro 用於正式生產。
有免費方案嗎?
新帳戶可獲得每個模型的首次呼叫免費。之後按次收費。
你哋支援串流結果嗎?
如有提供串流,RunAPI 會端到端串流。
失敗會點樣收費?
生成失敗不會收費。
輸出有快取嗎?
已生成輸出會儲存,並可按任務 ID 取回。輸入內容不會快取。
可以商業使用嗎?
可以——除非模型授權明確限制,否則每個版本都包括商業使用。相關限制會在版本頁面列明。
限流點樣計?
每個密鑰的限流會跟使用等級而提升。最新限制請參考定價頁。
可以在邊度報告問題?
可以在公開 GitHub repo 開 issue,或者電郵支援。