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 formatprovider/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 authenticationContent-Type: application/json- Request content type
Optional
HTTP-Referer: <YOUR_SITE_URL>- Identifies your applicationX-Title: <YOUR_APP_NAME>- Sets application name for analytics
Finish Reasons
Thefinish_reason field indicates why generation stopped:
stop: Model generated a stop sequence or natural completionlength: Reachedmax_tokenslimittool_calls: Model requested tool executioncontent_filter: Content was filtered by safety systemsnull: Generation incomplete (streaming)
Prompt Caching
Check Caching Support
For models that support prompt caching and current pricing, visit anannas.ai/models.
OpenAI Models
Useprompt_cache_key to cache prompt prefixes:
- Cache reads: 50% of input token price
- Cache writes: No additional cost
Anthropic Models
Usecache_control in message content parts:
- 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.
- Maximum 4 content blocks with
cache_controlper request - Cache expires after 5 minutes
Error Responses
Errors follow this format:invalid_request_error: Malformed request, missing required fieldsauthentication_error: Invalid or missing API keyrate_limit_error: Rate limit exceededinsufficient_quota_error: Insufficient credits (402)server_error: Internal server error
Model Routing
Ifmodel is omitted, Anannas selects the default model for your account. The routing system automatically:
- Selects optimal provider based on price, availability, and latency
- Falls back to alternative providers if primary fails
- Respects
providerpreferences when specified
fallbacks for explicit cross-model fallback chains:
See Also
- Parameters - Complete parameter reference
- Streaming - Server-Sent Events implementation
- Authentication - Security and API keys
- Models - Available models and capabilities