LLM API
LLM API
透過 OpenAI-compatible 和 Anthropic-compatible 協議呼叫 Felo 模型 endpoints。
/api/v1/models認證
Bearer API key or X-API-Key
Content type
application/json
限流說明
Model service limits may apply. Retry with backoff on 429 or 503.
LLM API 透過 Felo API Platform 提供直接模型呼叫 endpoints。適合呼叫通用語言模型、複用 OpenAI-compatible 或 Anthropic-compatible 客戶端,或把 agent framework 接入 Felo API Platform。
LLM API 目前包含三個模型呼叫入口:
POST /api/v1/responses: OpenAI Responses 相容POST /api/v1/chat/completions: OpenAI Chat Completions 相容POST /api/v1/messages: Anthropic Messages 相容
待開放:Decisions API
此介面尚未在公開 API 開放,請確認可用後再執行範例。
POST https://openapi.felo.ai/api/v1/decisions向 jev-1.13(也接受 typesafe/jev-1.13)提供上下文與明確的型別化問題。呼叫 /api/v1/decisions,不能使用 Chat Completions、Messages 或 Responses 入口。不支援串流請求。
請求欄位
model:jev-1.13state: 待判斷的上下文,可以是字串或 JSON 值。questions: 以名稱為鍵的問題物件,每個問題包含type、instructions和criteria。
import os
import requests
response = requests.post(
"https://openapi.felo.ai/api/v1/decisions",
headers={"Authorization": f"Bearer {os.environ['FELO_API_KEY']}"},
json={
"model": "jev-1.13",
"state": "Help! My payouts have been failing for 3 days.",
"questions": {
"is_urgent": {
"type": "noul",
"instructions": "Does this message convey urgency?",
"criteria": {"true": "Time-sensitive", "false": "No urgency"},
},
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Payments, invoicing, refunds",
"technical": "Bugs, outages, integrations",
"sales": "Pricing, upgrades, new accounts",
},
},
"frustration": {
"type": "score",
"instructions": "How frustrated is the customer?",
"criteria": ["Calm", "Frustrated", "Very angry"],
},
},
},
timeout=60,
)
response.raise_for_status()
answers = response.json()["answers"]
print(answers["is_urgent"]["noul"])
print(answers["department"]["choice"], answers["department"]["probabilities"])
print(answers["frustration"]["score"])回傳型別
noul:0 到 1 的機率;choice:選中的選項與機率分布;score:有序標準對應的數值得分與機率分布。
錯誤使用數值 HTTP 狀態碼 error.code 和 error.message。讀取 answers 前先處理非 2xx 回應。
用量與價格
回應包含 usage.input_tokens、usage.output_tokens,也可能包含 usage.cost。2026-09-22 核對的參考費率:輸入每百萬 tokens 0.042 美元,輸出 0 美元。輸出零價不代表輸入免費。價格可能更新,估算時以公布的模型價格與帳戶適用折扣為準。
認證
LLM API 請求需要 Felo API Platform key。可以使用 Authorization: Bearer ... 或 X-API-Key。
Authorization: Bearer YOUR_API_KEYX-API-Key: YOUR_API_KEY更多 key 建立和管理方式,請檢視 認證指南。
Base URL
https://openapi.felo.aiAnthropic SDK 請使用 https://openapi.felo.ai/api,因為 SDK 會自動追加 /v1/messages。
通用 Headers
| Header | 必填 | 說明 |
|---|---|---|
Authorization | Yes, unless X-API-Key is used | Bearer YOUR_API_KEY 格式的 API key |
X-API-Key | Yes, unless Authorization is used | Bearer header 的替代方式 |
Content-Type | Yes | 必須是 application/json |
X-Request-Id | No | 可選 request ID,便於排查問題 |
Model Discovery
總目錄保留全部模型類型。需要影片或決策模型時,可直接查詢對應目錄:
| 介面 | 模型範圍 |
|---|---|
GET /api/v1/models | 全部類型(保持相容) |
GET /api/v1/videos/models | 影片生成 (video_generation) |
GET /api/v1/decisions/models | 決策模型,包含 Jev (decisions) |
三個介面皆支援選用查詢參數 provider(如 openrouter),回傳 {"object":"list","data":[...]}。每項包含 id、object、created、owned_by 和 model_kind。分類清單使用已啟用供應商映射覆寫後的最終類型。
清單只回傳未刪除、已啟用、開啟顯示且具有符合供應商條件之現行價格的模型,價格為 0 也有效。新同步模型預設隱藏,需要管理員開啟顯示。三個清單共用人工排序,同值按模型名稱和 ID 排序。無符合項目時回傳 HTTP 200 和空的 data 陣列。查詢只讀取本機目錄,不觸發模型呼叫或計費。
僅 GET /api/v1/models 支援 exclude_video_and_decisions(布林值,預設 false)。設為 true 時依最終類型排除 video_generation 和 decisions,圖片模型仍保留。可與 provider 組合;省略或設為 false 時保留完整目錄。無效布林值回傳 HTTP 422。
curl "https://openapi.felo.ai/api/v1/models?exclude_video_and_decisions=true&provider=openrouter" \
-H "Authorization: Bearer ${FELO_API_KEY}"
curl "https://openapi.felo.ai/api/v1/videos/models?provider=openrouter" \
-H "Authorization: Bearer ${FELO_API_KEY}"
curl "https://openapi.felo.ai/api/v1/decisions/models?provider=openrouter" \
-H "Authorization: Bearer ${FELO_API_KEY}"依 model_kind 選擇呼叫入口:chat 使用該模型支援的 Responses、Chat Completions 或 Messages;video_generation 使用 POST /api/v1/videos/generations;decisions 使用 POST /api/v1/decisions;image_generation 使用 POST /api/v1/images/generations。詳細資料仍透過 GET /api/v1/models/{model_id} 查詢。清單中的模型並非都能用於對話入口。
模型與價格
價格以 USD 展示。Token rates 按 1M tokens 展示。Web search usage 如果由模型服務返回,則按 $0.01 每次 search 收費。
| Model ID | Context | Max output | Input / 1M tokens | Output / 1M tokens | Cache read / 1M tokens | Cache write / 1M tokens |
|---|---|---|---|---|---|---|
claude-haiku-4-5 | 200K | 64K | $1.00 | $5.00 | $0.10 | $1.25 |
claude-sonnet-4-6 | 1M | 128K | $3.00 | $15.00 | $0.30 | $3.75 |
claude-opus-4-8 | 1M | 128K | $5.00 | $25.00 | $0.50 | $6.25 |
claude-sonnet-5 | 1M | 128K | $2.00 | $10.00 | $0.20 | $2.50 |
claude-haiku-5-5 | 1M | 128K | $0.10 | $0.50 | $0.01 | $0.0125 |
gpt-5.5 | 1.05M | 128K | $5.00 | $30.00 | $0.50 | - |
gpt-5.5-pro | 1.05M | 128K | $30.00 | $180.00 | - | - |
gpt-5.6-luna | 1.05M | 128K | $1.00 | $6.00 | $0.10 | $1.25 |
gpt-5.6-terra | 1.05M | 128K | $2.50 | $15.00 | $0.25 | $3.125 |
gpt-5.6-sol | 1.05M | 128K | $5.00 | $30.00 | $0.50 | $6.25 |
grok-4.5 | 500K | - | $2.00 | $6.00 | $0.50 | - |
deepseek-v4-flash | 1M | 384K | $0.09 | $0.18 | $0.018 | - |
Claude Haiku 5.5 採用分檔計價:prompt 不超過 100K tokens 時按上表標準費率計費;當單次請求的 prompt 超過 100K tokens 時,整個請求按長上下文費率計費——輸入 $0.50、輸出 $2.50、快取讀 $0.05、快取寫 $0.0625(每 100 萬 tokens)。
GPT-5.6 提供三個檔位:Luna 適合快速、低成本工作負載;Terra 適合均衡的 coding、推理和 agentic 任務;Sol 適合旗艦級複雜推理和 coding。每個檔位也提供 -pro 模型 ID(gpt-5.6-luna-pro、gpt-5.6-terra-pro 和 gpt-5.6-sol-pro),使用相同底層模型並開啟 pro reasoning mode。-pro ID 的價格、上下文長度和最大輸出保持不變。
DeepSeek V4 Flash 支援思考與非思考模式、JSON 輸出、工具呼叫、Responses API 和 Anthropic API 相容性。可透過 Felo 的 Responses、Chat Completions 和 Messages 介面呼叫;快取寫入價格尚未發布。
Basic Usage
export FELO_API_KEY="YOUR_API_KEY"import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.FELO_API_KEY,
baseURL: "https://openapi.felo.ai/api",
});
const message = await client.messages.create({
model: "claude-sonnet-4-6",
max_tokens: 128,
messages: [{ role: "user", content: "Summarize direct model APIs in one sentence." }],
});Protocol Reference
回應s
POST https://openapi.felo.ai/api/v1/responses常用欄位:model、input、instructions、stream、temperature、max_output_tokens。
Chat Completions
POST https://openapi.felo.ai/api/v1/chat/completions適合 OpenAI-compatible chat clients。常用欄位包括 model、messages、stream、temperature、max_tokens、tools 和 response_format。
Messages
POST https://openapi.felo.ai/api/v1/messages適合 Anthropic-compatible clients 和 Claude Code。常用欄位包括 model、messages、max_tokens、stream 和 tools。