Claude Fable 5 API
Anthropic によって提供される Claude Fable 5 LLM モデルの完全な API リファレンスです。
モデルバリアント {#}
この API は 3 つの Claude Fable 5 モデルバリアントをサポートします。
クイック比較
Claude Fable 5 Text to Text
エンドポイント
POST /api/v1/chat/completions
リクエストパラメータ
必須
メッセージ対応
任意
リクエスト例
const response = await fetch('https://api.flaq.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'text/event-stream',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'claude-fable-5-text-to-text',
messages: [
{
role: 'user',
content: 'Draft a technical decision memo for this architecture choice.'
}
],
stream: true,
max_tokens: 2048,
top_p: 0.9,
top_k: 50
})
});
Claude Fable 5 Web Search
エンドポイント
POST /api/v1/chat/completions
リクエストパラメータ
必須
メッセージ対応
任意
リクエスト例
const response = await fetch('https://api.flaq.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'text/event-stream',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'claude-fable-5-web-search',
messages: [
{
role: 'user',
content: 'Find the latest public information about Claude Fable 5 and summarize it for a product brief.'
}
],
stream: true,
max_tokens: 2048,
top_p: 0.9,
top_k: 50
})
});
Claude Fable 5 File Analysis
エンドポイント
POST /api/v1/chat/completions
リクエストパラメータ
必須
メッセージ対応
任意
リクエスト例
const response = await fetch('https://api.flaq.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'text/event-stream',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'claude-fable-5-file-analysis',
messages: [
{
role: 'user',
content: [
{ type: 'text', text: 'Summarize this file and extract the key risks.' },
{
type: 'file',
file: {
filename: 'demo.pdf',
file_data: 'https://example.com/demo.pdf'
}
}
]
}
],
stream: true,
max_tokens: 4096,
top_p: 0.9,
top_k: 50
})
});
応答形式
Claude Fable 5 LLM モデルは OpenAI 互換の completion 応答を返します。stream: true の場合、応答は Server-Sent Events です。stream: false の場合、応答は単一の JSON オブジェクトです。
成功レスポンス
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"claude-fable-5-file-analysis","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"claude-fable-5-file-analysis","choices":[{"index":0,"delta":{"content":"Here is a concise summary"},"finish_reason":null}]}
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"claude-fable-5-file-analysis","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"claude-fable-5-file-analysis","choices":[],"usage":{"prompt_tokens":12,"completion_tokens":8,"total_tokens":20}}
data: [DONE]
エラーレスポンス
event: error
data: {"error":{"message":"API requests too frequent, exceeding rate limit","type":"rate_limit_error","code":"1302","param":null}}
ベストプラクティス
- 構造化メッセージを使用する: コンテキストを 1 つの prompt に平坦化するのではなく、
messages[] を通じて会話履歴を送信します。
- 適切なモデルバリアントを選択する: テキストのみの推論には Text to Text、最新のオンラインコンテキストが必要な場合は Web Search、ファイルまたは画像が必要な場合は File Analysis を使用します。
- Claude パラメータを慎重に調整する:
top_p と top_k は Claude Fable 5 の各バリアントでサポートされ、出力の多様性を変えることがあります。
- SSE イベントを処理する: ストリーミング表示では
choices[0].delta.content を追加し、data: [DONE] を正常完了として扱います。
- サポートされる入力のみを送信する: Text to Text または Web Search ルートにファイル部分や画像部分を送信しないでください。