Документация API
Claude Fable 5 API
Claude Fable 5 через Claude-совместимый Messages API поддерживает длинный контекст, coding, vision и agentic workflow с окном контекста 1M token.
Endpoint
POST https://api.defapi.org/api/v1/messages
Model
anthropic/claude-fable-5
Цена
$5 input / $25 output per 1M tokens
Аутентификация
Передавайте API key в header Authorization в формате Bearer token.
Authorization: Bearer <your-api-key>Создать Message
Endpoint совместим с Claude-style Messages requests и поддерживает как non-streaming JSON responses, так и streaming responses.
curl https://api.defapi.org/api/v1/messages \
-H "Authorization: Bearer dk-1234567890abcdef" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-fable-5",
"messages": [
{
"role": "user",
"content": "Explain how to migrate a large Next.js codebase."
}
],
"max_tokens": 512,
"temperature": 0.7,
"stream": false
}'Параметры запроса
| Имя | Тип | Описание |
|---|---|---|
| model | string | Обязательно. Используйте anthropic/claude-fable-5. |
| messages | array | Обязательно. Conversation messages с role и content. |
| max_tokens | integer | Максимальное число token для генерации. |
| temperature | number | Управляет randomness. Диапазон: от 0 до 2. |
| top_p | number | Параметр nucleus sampling. Диапазон: от 0 до 1. |
| stream | boolean | true включает streaming в стиле server-sent events. |
| stop | string | До 4 sequences, на которых generation должна остановиться. |
| user | string | Уникальный identifier вашего end user. |
Streaming request
Установите stream в true, чтобы получать chunks в стиле server-sent events.
{
"model": "anthropic/claude-fable-5",
"messages": [
{
"role": "user",
"content": "Tell me a short story about a brave knight."
}
],
"max_tokens": 512,
"temperature": 0.7,
"stream": true
}Non-streaming response
Успешный non-streaming request возвращает assistant message и token usage.
{
"id": "msg_01ABCDxyz",
"type": "message",
"role": "assistant",
"model": "anthropic/claude-fable-5",
"stop_reason": "end_turn",
"stop_sequence": null,
"content": [
{
"type": "text",
"text": "Hello! How can I help you today?"
}
],
"usage": {
"input_tokens": 20,
"output_tokens": 50,
"cache_read_input_tokens": 0,
"cache_creation_input_tokens": 0
}
}Ошибки
400
Bad request
Некорректные параметры или отсутствуют обязательные поля.
401
Unauthorized
API key отсутствует или недействителен.
500
Internal server error
Неожиданный server-side failure.