Skip to main content

Endpoint

Request Schema

The Anannas API follows the OpenAI Chat Completions format with Anannas-specific extensions. The request body is JSON.

Required Fields

  • model (string): Model identifier in format provider/model-name (e.g., openai/gpt-5-mini, anthropic/claude-3-sonnet)
  • messages (array): Array of message objects. Minimum 1 message required.

Request Type Definition

Message Object

Example Request

Response Schema

Responses follow the OpenAI Chat Completions format:

Example Response

Headers

Required

  • Authorization: Bearer <ANANNAS_API_KEY> - API key authentication
  • Content-Type: application/json - Request content type

Optional

  • HTTP-Referer: <YOUR_SITE_URL> - Identifies your application
  • X-Title: <YOUR_APP_NAME> - Sets application name for analytics

Finish Reasons

The finish_reason field indicates why generation stopped:
  • stop: Model generated a stop sequence or natural completion
  • length: Reached max_tokens limit
  • tool_calls: Model requested tool execution
  • content_filter: Content was filtered by safety systems
  • null: Generation incomplete (streaming)

Prompt Caching

Check Caching Support

For models that support prompt caching and current pricing, visit anannas.ai/models.

OpenAI Models

Use prompt_cache_key to cache prompt prefixes:
Pricing:
  • Cache reads: 50% of input token price
  • Cache writes: No additional cost

Anthropic Models

Use cache_control in message content parts:
Pricing:
  • Cache creation: 1.25x input token price
  • Cache reads: 0.1x input token price (90% discount)

Verify Caching Pricing

For current caching pricing and supported models, check anannas.ai/models.
Limits:
  • Maximum 4 content blocks with cache_control per request
  • Cache expires after 5 minutes

Error Responses

Errors follow this format:
Common error types:
  • invalid_request_error: Malformed request, missing required fields
  • authentication_error: Invalid or missing API key
  • rate_limit_error: Rate limit exceeded
  • insufficient_quota_error: Insufficient credits (402)
  • server_error: Internal server error

Model Routing

If model is omitted, Anannas selects the default model for your account. The routing system automatically:
  1. Selects optimal provider based on price, availability, and latency
  2. Falls back to alternative providers if primary fails
  3. Respects provider preferences when specified
Use fallbacks for explicit cross-model fallback chains:

See Also