Overview
Anannas provides full compatibility with the Anthropic Messages API format, allowing you to use Anannas with any tool or SDK designed for Anthropic’s API. This includes Claude Code, the official Anthropic SDK, and other tools in the Anthropic ecosystem.
The /v1/messages endpoint converts Anthropic Messages API requests to Anannas’ internal format and works with all models that Anannas supports, not just Anthropic models. You can use any model (OpenAI, Google, Anthropic, etc.) through this endpoint by specifying the model in Anannas’ provider/model-name format.
Base URL
The Anannas Anthropic-compatible endpoint is available at:
https://api.anannas.ai/v1/messages
Alternatively, you can use:
https://api.anannas.ai/api/v1/messages
Authentication
All requests require a Bearer token in the Authorization header using your Anannas API key:
Authorization: Bearer <ANANNAS_API_KEY>
Get your API key from the Anannas dashboard.
Model IDs
The /v1/messages endpoint accepts any model that Anannas supports, not just Anthropic models. Specify models using Anannas’ standard provider/model-name format. The API will automatically route to the appropriate provider.
Example Models from Different Providers
OpenAI Models:
Google Models:
gemini-2.5-pro
gemini-2.5-flash
Other Providers:
grok-4-1-fast-non-reasoning-latest
mistralai/mistral-large
meta-llama/llama-3-70b
- And many more…
For a complete list of available models, visit anannas.ai/models or query GET https://api.anannas.ai/v1/models.
The endpoint converts Anthropic Messages API format to Anannas’ internal format, allowing you to use any supported model through the Anthropic-compatible interface. Model routing and provider selection are handled automatically.
Using Claude Code
Claude Code is an agentic coding tool that lives in your terminal and helps you code faster through natural language commands. You can configure Claude Code to use Anannas instead of the default Anthropic API.
Step 1: Install Claude Code
npm install -g @anthropic-ai/claude-code
If you encounter permission issues during installation, try using sudo (macOS/Linux) or running the command prompt as an administrator (Windows).
Set up environment variables to point Claude Code to Anannas:
macOS/Linux:
export ANTHROPIC_BASE_URL=https://api.anannas.ai
export ANTHROPIC_AUTH_TOKEN=<ANANNAS_API_KEY>
export API_TIMEOUT_MS=600000
export ANTHROPIC_MODEL=grok-4-1-fast-non-reasoning-latest
export ANTHROPIC_SMALL_FAST_MODEL=gpt-5-mini
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
Windows (PowerShell):
$env:ANTHROPIC_BASE_URL="https://api.anannas.ai"
$env:ANTHROPIC_AUTH_TOKEN="<ANANNAS_API_KEY>"
$env:API_TIMEOUT_MS="600000"
$env:ANTHROPIC_MODEL="grok-4-1-fast-non-reasoning-latest"
$env:ANTHROPIC_SMALL_FAST_MODEL="gpt-5-mini"
$env:CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"
Windows (Command Prompt):
set ANTHROPIC_BASE_URL=https://api.anannas.ai
set ANTHROPIC_AUTH_TOKEN=<ANANNAS_API_KEY>
set API_TIMEOUT_MS=600000
set ANTHROPIC_MODEL=grok-4-1-fast-non-reasoning-latest
set ANTHROPIC_SMALL_FAST_MODEL=gpt-5-mini
set CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
The API_TIMEOUT_MS parameter is configured to prevent excessively long outputs that could cause the Claude Code client to time out. Here, we set the timeout duration to 10 minutes (600000ms).
Step 3: Start Claude Code
Navigate to your project directory and run:
If prompted with “Do you want to use this API key,” select “Yes.”
After launching, grant Claude Code permission to access files in your folder. You can now use Claude Code with Anannas.
Model Configuration
Claude Code uses internal model environment variables that map to specific models. The default configuration maps:
ANTHROPIC_DEFAULT_OPUS_MODEL: Maps to Claude Code’s “opus” tier (most capable)
ANTHROPIC_DEFAULT_SONNET_MODEL: Maps to Claude Code’s “sonnet” tier (balanced)
ANTHROPIC_DEFAULT_HAIKU_MODEL: Maps to Claude Code’s “haiku” tier (fastest)
You can customize these mappings to use any Anannas-supported model. For example, you could use OpenAI models:
export ANTHROPIC_DEFAULT_OPUS_MODEL=gpt-4.1-mini
export ANTHROPIC_DEFAULT_SONNET_MODEL=grok-4-1-fast-non-reasoning-latest
export ANTHROPIC_DEFAULT_HAIKU_MODEL=gpt-5-mini
Or mix providers:
export ANTHROPIC_DEFAULT_OPUS_MODEL=anthropic/claude-opus-4
export ANTHROPIC_DEFAULT_SONNET_MODEL=grok-4-1-fast-non-reasoning-latest
export ANTHROPIC_DEFAULT_HAIKU_MODEL=gemini-2.5-flash
Alternatively, you can configure model mappings in Claude Code’s settings file (~/.claude/settings.json):
{
"env": {
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-5-mini",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "grok-4-1-fast-non-reasoning-latest",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "gpt-4.1-mini"
}
}
It is generally not recommended to manually adjust the model mapping, as hardcoding the model mapping makes it inconvenient to automatically update to the latest model when Anannas adds new models. If you want to use the latest default mappings, simply delete the model mapping configuration in settings.json.
Using the Anthropic SDK
You can use the official Anthropic SDK with Anannas by configuring the base URL.
Step 1: Install the Anthropic SDK
Python:
Node.js:
npm install @anthropic-ai/sdk
Python:
import anthropic
client = anthropic.Anthropic(
base_url="https://api.anannas.ai/v1",
api_key="<ANANNAS_API_KEY>"
)
Node.js:
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({
baseURL: 'https://api.anannas.ai/v1',
apiKey: '<ANANNAS_API_KEY>',
});
Step 3: Make API Calls
Python:
message = client.messages.create(
model="grok-4-1-fast-non-reasoning-latest",
max_tokens=1000,
system="You are a helpful assistant.",
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "Hi, how are you?"
}
]
}
]
)
print(message.content)
Node.js:
const message = await client.messages.create({
model: 'grok-4-1-fast-non-reasoning-latest',
max_tokens: 1000,
system: 'You are a helpful assistant.',
messages: [
{
role: 'user',
content: [
{
type: 'text',
text: 'Hi, how are you?',
},
],
},
],
});
console.log(message.content);
Direct HTTP Requests
You can also make direct HTTP requests to the endpoint:
import requests
response = requests.post(
"https://api.anannas.ai/v1/messages",
headers={
"Authorization": "Bearer <ANANNAS_API_KEY>",
"Content-Type": "application/json",
"anthropic-version": "2023-06-01"
},
json={
"model": "grok-4-1-fast-non-reasoning-latest",
"max_tokens": 1000,
"system": "You are a helpful assistant.",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Explain quantum computing in simple terms"
}
]
}
]
}
)
data = response.json()
print(data["content"][0]["text"])
API Compatibility Details
| Field | Support Status |
|---|
anthropic-beta | Ignored |
anthropic-version | Ignored |
x-api-key | Fully Supported (use Authorization: Bearer instead) |
Authorization | Fully Supported |
Request Fields
| Field | Support Status | Notes |
|---|
model | Fully Supported | Use any Anannas model format (e.g., grok-4-1-fast-non-reasoning-latest, anthropic/claude-4.5-sonnet, gemini-2.5-pro) |
max_tokens | Fully Supported | Required field |
messages | Fully Supported | Required field, minimum 1 message |
system | Supported | String or array of system blocks (cache_control in array blocks is not preserved) |
temperature | Fully Supported | Range [0.0 ~ 2.0] |
top_p | Fully Supported | Range [0.0 ~ 1.0] |
top_k | Ignored | Not supported by all models. Not allowed when thinking is enabled |
stop_sequences | Fully Supported | Array of stop sequences |
stream | Fully Supported | Server-Sent Events (SSE) |
tools | Fully Supported | Tool definitions for function calling |
tool_choice | Fully Supported | none, auto, any, or specific tool. When thinking is enabled, only "auto" or "none" are allowed |
thinking | Supported | budget_tokens is converted to reasoning.max_tokens. Interleaved thinking is automatically enabled when tools are present and tool_choice is "auto" |
metadata | Partially Supported | user_id is supported |
| Field | Support Status | |
|---|
name | Fully Supported | |
description | Fully Supported | |
input_schema | Fully Supported | |
cache_control | Supported | Prompt caching support for tools |
| Value | Support Status | Notes |
|---|
none | Fully Supported | |
auto | Supported | disable_parallel_tool_use is ignored. Required for interleaved thinking when thinking is enabled |
any | Supported | disable_parallel_tool_use is ignored. Not allowed when thinking is enabled |
tool | Supported | disable_parallel_tool_use is ignored. Not allowed when thinking is enabled |
Message Content Types
| Content Type | Support Status | Notes |
|---|
text | Fully Supported | String or content block |
image | Supported | Base64-encoded images |
tool_use | Fully Supported | Tool call from assistant |
tool_result | Fully Supported | Tool result from user |
thinking | Supported | Reasoning/thinking blocks |
document | Not Supported | |
search_result | Not Supported | |
redacted_thinking | Supported | Redacted/encrypted thinking blocks are supported and preserved |
server_tool_use | Not Supported | |
mcp_tool_use | Not Supported | |
Responses follow the Anthropic Messages API format:
{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Response text here"
}
],
"model": "grok-4-1-fast-non-reasoning-latest",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 10,
"output_tokens": 50
}
}
Streaming
When stream: true is set, the API returns Server-Sent Events (SSE) with the following event types:
message_start: Initial message metadata
content_block_start: Start of a content block
content_block_delta: Incremental content updates
content_block_stop: End of a content block
message_delta: Message-level updates (stop_reason, usage)
message_stop: End of the message stream
ping: Keep-alive heartbeat events
error: Error events
Troubleshooting
Claude Code Configuration Not Working
If you manually modified the ~/.claude/settings.json configuration file but found the changes did not take effect:
- Close all Claude Code windows, open a new command-line window, and run
claude again
- If the issue persists, try deleting the
~/.claude/settings.json file and then reconfigure the environment variables
- Confirm that the JSON format of the configuration file is correct - check variable names and ensure there are no missing or extra commas
Model Not Found Errors
If you receive a “model not found” error:
- Verify the model ID format is correct:
provider/model-name (e.g., grok-4-1-fast-non-reasoning-latest, anthropic/claude-3.7-sonnet)
- Check available models at anannas.ai/models or via
GET https://api.anannas.ai/v1/models
- Ensure your API key has access to the requested model
- Remember: you can use any model supported by Anannas, not just Anthropic models
Authentication Errors
If you receive authentication errors:
- Verify your API key is correct and active in the Anannas dashboard
- Ensure you’re using
Authorization: Bearer <ANANNAS_API_KEY> header format
- Check that your API key has sufficient credits
Next Steps