Documentazione API

Claude Fable 5 API

Claude Fable 5 offre long-context reasoning, coding, vision e agentic workflows tramite una Messages API compatibile con Claude e context window da 1M token.

Endpoint
POST https://api.defapi.org/api/v1/messages
Model
anthropic/claude-fable-5
Prezzo
$5 input / $25 output per 1M tokens

Autenticazione

Invia la tua API key nell header Authorization usando il formato Bearer token.

Authorization: Bearer <your-api-key>

Crea un Message

L endpoint e compatibile con Claude-style Messages requests e supporta risposte JSON non-streaming e 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
  }'

Request Parameters

NomeTipoDescrizione
modelstringRequired. Use anthropic/claude-fable-5.
messagesarrayRequired. Conversation messages with role and content.
max_tokensintegerMaximum number of tokens to generate.
temperaturenumberControls randomness. Supported range: 0 to 2.
top_pnumberNucleus sampling parameter. Supported range: 0 to 1.
streambooleanSet true to receive server-sent event style streaming.
stopstringUp to 4 sequences where generation should stop.
userstringA unique identifier for your end user.

Streaming request

Imposta stream su true per ricevere chunk in stile 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

Un request non-streaming riuscito restituisce assistant message e 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
  }
}

Error responses

400
Bad request

Parametri non validi o campi obbligatori mancanti.

401
Unauthorized

API key non valida o mancante.

500
Internal server error

Errore server-side inatteso.