---
title: LLM API — 兼容 OpenAI | RunAPI
description: 透過一個兼容 OpenAI 的 API endpoint 存取 RunAPI 語言模型。
url: https://runapi.ai/zh-HK/llm.md
canonical: https://runapi.ai/zh-HK/llm
locale: zh-HK
site: RunAPI
image: https://runapi.ai/assets/opengraph-bfaaa0f0.png
alternates:
  en: https://runapi.ai/llm
  zh-CN: https://runapi.ai/zh-CN/llm
  es: https://runapi.ai/es/llm
  ja: https://runapi.ai/ja/llm
  de: https://runapi.ai/de/llm
  fr: https://runapi.ai/fr/llm
  pt-BR: https://runapi.ai/pt-BR/llm
  ko: https://runapi.ai/ko/llm
  it: https://runapi.ai/it/llm
  nl: https://runapi.ai/nl/llm
  pl: https://runapi.ai/pl/llm
  tr: https://runapi.ai/tr/llm
  zh-TW: https://runapi.ai/zh-TW/llm
  zh-HK: https://runapi.ai/zh-HK/llm
  ar: https://runapi.ai/ar/llm
  x-default: https://runapi.ai/llm
---

> HTML version: https://runapi.ai/zh-HK/llm
> Site index for agents: https://runapi.ai/llms.txt

<!-- llm-api-slot: api-hero-metrics owner=API-1983 state=ready -->

# LLM API — 兼容 OpenAI

透過一個 兼容 OpenAI 的 endpoint 存取 [Claude](https://runapi.ai/zh-HK/models/claude.md)、GPT、[Gemini](https://runapi.ai/zh-HK/models/gemini.md)、[DeepSeek](https://runapi.ai/zh-HK/models/deepseek.md) 及 Grok。/v1/chat/completions、/v1/messages、/v1/responses。

[取得 API Key](https://runapi.ai/zh-HK/login) [瀏覽模型](https://runapi.ai/zh-HK/models.md)

67 個模型 · 直接替換 base_url · 按 token 付費

| Value | Metric |
| --- | --- |
| 67 | LLM 模型 |
| 15-25% | 低於官方價格 |
| 2 行 | 遷移只需 |


<!-- llm-api-slot: llm-playground owner=API-1987 state=dependency_pending -->


<!-- llm-api-slot: multi-model-comparison owner=API-1984 state=ready -->

## 多模型比較

提示詞: `用一句話解釋量子計算`

| Model | Provider | Price |
| --- | --- | --- |
| Claude/claude-fable-5 (`/v1/messages`) | Anthropic | Input $10.00 / 1M tokens \| Output $50.00 / 1M tokens |
| Claude/claude-fable-5-1 (`/v1/messages`) | Anthropic | Input $10.00 / 1M tokens \| Output $50.00 / 1M tokens |
| Claude/claude-haiku-4-5-20251001 (`/v1/messages`) | Anthropic | Input $0.60 / 1M tokens \| Output $3.00 / 1M tokens |


<!-- llm-api-slot: endpoint-shape-cards owner=API-1985 state=ready -->

## 4 種 endpoint 格式，一個 key

- **Chat completion** - 每個 SDK 都已支援的 OpenAI 格式。替換 base_url，保留現有請求程式碼。
- **Message** - 適用於 system prompts、工具使用及結構化內容區塊的 Messages API 格式。
- **Response** - 適用於多輪 agent 迴圈的有狀態格式，並由 server 處理對話。
- **Embedding** - 用於檢索的向量 embeddings，以同一個 RunAPI key 按 token 計費。


<!-- llm-api-slot: model-pricing-list owner=API-1986 state=ready -->
## 一個 key 使用所有 LLM

| Model | Provider | Price |
| --- | --- | --- |
| Claude/claude-fable-5 | Anthropic | $10.00 / 1M in |
| Claude/claude-fable-5-1 | Anthropic | $10.00 / 1M in |
| Claude/claude-haiku-4-5-20251001 | Anthropic | $0.60 / 1M in |
| Claude/claude-opus-4-1-20250805 | Anthropic | $9.00 / 1M in |
| Claude/claude-opus-4-5-20251101 | Anthropic | $3.00 / 1M in |
| Claude/claude-opus-4-6 | Anthropic | $3.00 / 1M in |
| Claude/claude-opus-4-7 | Anthropic | $3.00 / 1M in |
| Claude/claude-opus-4-8 | Anthropic | $3.00 / 1M in |


[查看全部 67 個 LLM 模型](https://runapi.ai/zh-HK/models.md)


<!-- llm-api-slot: quickstart-code-panel owner=API-1988 state=ready -->
## 快速入門

### 使用 OpenAI 格式呼叫任何模型

#### curl

```bash
curl https://runapi.ai/v1/chat/completions \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"Explain the difference between concurrency and parallelism."}]}'
```

#### 回應

```json
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "model": "deepseek-v4-flash",
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 8,
    "total_tokens": 20
  }
}
```


<!-- llm-api-slot: four-step-flow owner=API-1989 state=ready -->
## 四步完成第一次生成

**使用方式**

1. **取得 API Key** - 為你的 RunAPI 帳戶建立一個 Key。
2. **使用 OpenAI 格式** - 透過文件中的 OpenAI 相容端點傳送請求。
3. **智能路由** - RunAPI 為你的請求選擇受支援的路由。
4. **串流回應** - 當所選端點支援 SSE 時接收串流輸出。


<!-- llm-api-slot: benefit-cards owner=API-1990 state=ready -->

## 開發者選擇 RunAPI 的原因

### 一個 Key，所有模型

告別多個 API key 的煩惱。一次整合即可存取來自各大供應商的 230+ 個模型。

### 節省15-25%費用

我們與供應商的批量協議，價格比直接購買更低，絕無額外加價。

### 自動故障轉移

如供應商服務中斷，我們會路由至下一個最佳選項。你的 app 持續運作。

### 兼容 OpenAI

OpenAI SDK 的直接替代方案。更改一行程式碼即可存取任何模型。

### 實時計費

只為實際用量付費。按請求計費，沒有最低消費。按模型、按專案追蹤成本。

### 資料私隱

私隱政策說明了請求資料和生成內容的處理與保存方式。



<!-- llm-api-slot: related-api-cards owner=API-1991 state=ready -->

### 探索

## 更多AI API

- [Video API](https://runapi.ai/zh-HK/models.md?modality=video) - 使用80個模型生成、編輯及放大影片 [了解更多](https://runapi.ai/zh-HK/models.md?modality=video)
- [Image API](https://runapi.ai/zh-HK/models.md?modality=image) - 使用49個模型創建及轉換圖像 [了解更多](https://runapi.ai/zh-HK/models.md?modality=image)
- [Music API](https://runapi.ai/zh-HK/models.md?modality=audio_music) - 以AI創作原創音樂 [了解更多](https://runapi.ai/zh-HK/models.md?modality=audio_music)
- [Audio API](https://runapi.ai/zh-HK/models.md?modality=audio_music) - 使用 31 個模型進行文字轉語音 [了解更多](https://runapi.ai/zh-HK/models.md?modality=audio_music)


<!-- llm-api-slot: team-use-case-cards owner=API-1992 state=ready -->

## 團隊如何使用

**Coding Agents**

在同一個 key 和同一張帳單下，將規劃路由至 Opus，將編輯路由至低成本模型。

**RAG Pipelines**

在同一 endpoint 上進行 embeddings 和生成，讓檢索與回答共用預算。

**內容生成**

跨模型同時產生草稿並保留最佳版本，無需簽訂五家供應商合約。

**多模型比較**

只需更改一個字串，即可在 Claude、GPT 和 Gemini 之間對同一 prompt 作 A/B 測試。



<!-- llm-api-slot: comparison-matrix owner=API-1993 state=ready -->

## RunAPI與其他方案比較

| 功能 | RunAPI | OpenRouter | Direct API |
| --- | --- | --- | --- |
| LLM 模型 | 66 | 300+ | 1個供應商 |
| 其他模態 | 影片、圖片、音樂、音訊 | 否 | 按供應商 |
| 定價 | 比官方價格低 15-25% | 市價 | 官方費率 |
| 原生 Messages API | 是 | 否 | 是 |
| 統一 credits | 是 | 是 | 否 |
| MCP server + CLI | 是 | 否 | 否 |


<!-- llm-api-slot: faq-accordion owner=API-1994 state=ready -->

## LLM API 常見問題

### 如何從 OpenAI-compatible client 遷移？

將 client 指向文件列出的 RunAPI base URL，並使用你的 RunAPI key。保留所選 endpoint 支援的請求格式。

### 支援串流嗎？

當所選模型和 endpoint 提供串流回應時，即可使用串流。

### 支援工具呼叫嗎？

在 runtime contract 中聲明支援工具的模型和 endpoint 格式可使用 tool calling。

### token 如何計費？

輸入及輸出費率列於模型目錄。用量會按請求回報的 token 數量計費。

### 應該使用哪個 endpoint？

選擇符合現有 client 及請求所需功能的 endpoint 格式。

### 如果 route 無法使用怎麼辦？

API 會透過文件列明的 response contract 回傳請求狀態，讓你的應用程式可重試或選用另一個支援的模型。



<!-- llm-api-slot: final-cta owner=API-1995 state=ready -->
## 替換兩行程式碼，保留你的程式碼

你已部署的 OpenAI 格式背後有 67 個模型。免費開始，無需信用卡。

- [取得 API Key](https://runapi.ai/zh-HK/login)
- [閱讀文件](https://runapi.ai/zh-HK/docs/guides)




---

## More from RunAPI

- [Home](https://runapi.ai/zh-HK/.md)
### 產品
- [模型目錄](https://runapi.ai/zh-HK/models.md)
- [收費](https://runapi.ai/zh-HK/pricing.md)
- [服務商](https://runapi.ai/zh-HK/models#all-models)
### 開發者
- [文件](https://runapi.ai/zh-HK/docs/guides)
- [SDK](https://runapi.ai/zh-HK/sdk.md)
- [CLI](https://runapi.ai/zh-HK/cli.md)
- [MCP Server](https://runapi.ai/zh-HK/mcp.md)
### 指南
- [Claude Code 與 Cursor](https://runapi.ai/zh-HK/claude-code-vs-cursor.md)
- [Cursor API 設定](https://runapi.ai/zh-HK/cursor-api-setup.md)
- [RunAPI 與 OpenRouter](https://runapi.ai/zh-HK/openrouter-alternative.md)
### 公司
- [企業版](https://runapi.ai/zh-HK/contact.md)
- [聯絡](https://runapi.ai/zh-HK/contact.md)
### 法律
- [條款](https://runapi.ai/zh-HK/terms.md)
- [私隱](https://runapi.ai/zh-HK/privacy.md)
- [Site index for agents](https://runapi.ai/llms.txt)

Contact: contact@runapi.ai

## Structured data

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-HK",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-HK",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/zh-HK/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-HK",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-HK",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/zh-HKicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  }
]
```
