Base URL 與端點

OpenAI 相容 SDK 與工具請使用此 Base URL:

https://getrouter.ai/v1

若直接傳送 HTTP 請求,請附加下方所列的端點路徑。

常用端點

功能方法完整端點
列出 OpenAI 格式的模型GEThttps://getrouter.ai/v1/models
Chat CompletionsPOSThttps://getrouter.ai/v1/chat/completions
ResponsesPOSThttps://getrouter.ai/v1/responses
壓縮 Responses 上下文POSThttps://getrouter.ai/v1/responses/compact
EmbeddingsPOSThttps://getrouter.ai/v1/embeddings
圖片生成POSThttps://getrouter.ai/v1/images/generations
圖片編輯POSThttps://getrouter.ai/v1/images/edits
音訊轉錄POSThttps://getrouter.ai/v1/audio/transcriptions
音訊翻譯POSThttps://getrouter.ai/v1/audio/translations
文字轉語音POSThttps://getrouter.ai/v1/audio/speech
建立影片任務POSThttps://getrouter.ai/v1/videos
影片任務狀態GEThttps://getrouter.ai/v1/videos/{task_id}
RerankPOSThttps://getrouter.ai/v1/rerank
Claude MessagesPOSThttps://getrouter.ai/v1/messages
Gemini 格式的模型GEThttps://getrouter.ai/v1beta/models
Gemini generateContentPOSThttps://getrouter.ai/v1beta/models/{model}:generateContent

Base URL 與完整端點的差異

SDK 通常會要求輸入 Base URL,再自行附加操作路徑:

在 OpenAI SDK 中輸入的 Base URL:
https://getrouter.ai/v1

SDK 將請求傳送至:
https://getrouter.ai/v1/chat/completions

部分工具則要求輸入完整端點。手動加入 /chat/completions/responses/messages 前,請先查看欄位標籤與整合指南。

避免重複路徑

路徑重複是造成 404 Not Found 錯誤的常見原因。

正確的 OpenAI Base URL:
https://getrouter.ai/v1

若工具已自行附加 /v1,以下設定不正確:
https://getrouter.ai/v1/v1

若工具已自行附加 /chat/completions,以下設定不正確:
https://getrouter.ai/v1/chat/completions/chat/completions
Tip

如果工具分別提供 API HostAPI VersionEndpoint 欄位,請依該工具專用的整合指南操作,不要猜測工具會附加哪一段路徑。

驗證

除非整合指南另有說明,否則請傳送:

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

使用 curl -F 或 SDK 時,音訊轉錄與影片建立等 multipart 端點會自動設定自己的 Content-Type boundary。

後續步驟