Anthropic Compatibility Guide
Use the Anthropic Messages API format with Ask Sage — works with Claude Code out of the box
Table of Contents
Instance-Specific Base URL: The base URL shown reflects the instance at chat.asksage.ai. The api. prefix and path suffix stay the same across deployments — only the instance segment in the middle changes based on which Ask Sage instance you are logging into. Always use the instance approved by your organization and applicable regulatory requirements, and match the base URL to the instance you authenticate against.
What’s New?
Ask Sage now supports the Anthropic Messages API format, making it easy to:
Messages
The main endpoint for creating messages using the standard Anthropic format. Requests are routed to AWS Bedrock or Google Vertex AI based on the resolved model.
Authorization header, or pass your token via x-access-tokens or x-api-key. Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
Authorization | string (header) | Required | Bearer token: Bearer YOUR_API_KEY |
model | string | Required | Claude model — see naming formats below |
messages | array | Required | Array of message objects with role (user/assistant) and content |
system | string or array | Optional | System prompt — string or array of content blocks with optional cache control |
max_tokens | integer | Required | Maximum number of tokens to generate |
temperature | number | Optional | Controls randomness (0.0–1.0). Default: 1.0 |
tools | array | Optional | Array of tool definitions for function calling |
tool_choice | object | Optional | {"type": "auto"}, {"type": "any"}, or {"type": "tool", "name": "..."} |
Model Naming Formats
The model field accepts multiple naming formats:
- Simple names:
sonnet,opus,haiku - Anthropic-style IDs (as returned by
GET /server/anthropic/v1/models):claude-opus-5,claude-sonnet-5,claude-fable-5-1,claude-opus-4-8,claude-opus-4-7,claude-opus-4-6,claude-sonnet-4-6,claude-opus-4-5,claude-sonnet-4-5,claude-sonnet-4-5-vertex,claude-haiku-4-5 - Date- or tag-suffixed and Vertex forms are also accepted, for example
claude-opus-4-8-default,claude-sonnet-5,claude-opus-4-8@default - Ask Sage IDs (as returned by
POST /server/get-models):google-claude-opus-5,google-claude-sonnet-5,google-claude-fable-5,aws-bedrock-claude-fable-5-1-gov,google-claude-48-opus,aws-bedrock-claude-45-sonnet-gov
Response
| Status | Description |
|---|---|
200 Success | Returns id, type, role, model, content (array of text/tool_use blocks), stop_reason (end_turn/max_tokens/tool_use), and usage (input_tokens, output_tokens) |
400 Error | Invalid request format or missing required parameters |
401 Error | Authentication failure — invalid or missing API key |
429 Error | Rate limit exceeded — retry after a moment |
Example: Basic Message
curl -X POST 'https://api.asksage.ai/server/anthropic/v1/messages' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "What is Ask Sage?"}
]
}'Example: Multi-Turn Conversation with System Prompt
curl -X POST 'https://api.asksage.ai/server/anthropic/v1/messages' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"system": "You are a helpful cybersecurity assistant.",
"messages": [
{"role": "user", "content": "What is zero trust architecture?"},
{"role": "assistant", "content": "Zero trust is a security framework that requires all users to be authenticated and authorized before accessing resources."},
{"role": "user", "content": "How does it apply to cloud environments?"}
]
}'Example: Function Calling
curl -X POST 'https://api.asksage.ai/server/anthropic/v1/messages' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "What'\''s the weather like in San Francisco?"}
],
"tools": [
{
"name": "get_weather",
"description": "Get the current weather in a location",
"input_schema": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "The city and state, e.g. San Francisco, CA"},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
},
"required": ["location"]
}
}
]
}'Token Counting
Count the number of input tokens for a message payload before sending the full request. Useful for context-window management.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
Authorization | string (header) | Required | Bearer token: Bearer YOUR_API_KEY |
model | string | Required | The Claude model to count tokens for |
messages | array | Required | Array of message objects (same format as Messages endpoint) |
Response
| Field | Type | Description |
|---|---|---|
input_tokens | integer | Number of input tokens in the request |
Example
curl -X POST 'https://api.asksage.ai/server/anthropic/v1/messages/count_tokens' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "claude-sonnet-5",
"messages": [
{"role": "user", "content": "Hello, how are you?"}
]
}'Claude Code Integration
Ask Sage's Anthropic endpoint is fully compatible with Claude Code. Connect your Claude Code CLI or VS Code extension to Ask Sage with minimal configuration.
Method 1 — Settings File (Recommended)
Create or edit ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.asksage.ai/server/anthropic",
"ANTHROPIC_AUTH_TOKEN": "your-asksage-token-here",
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": 4096,
"MAX_THINKING_TOKENS": 1024
},
"permissions": {
"allow": ["*"],
"deny": ["Delete"]
}
}
CLAUDE_CODE_MAX_OUTPUT_TOKENS must be greater than MAX_THINKING_TOKENS. Anthropic recommends setting these values when using Bedrock-hosted Claude models due to burndown throttling. Method 2 — Environment Variables
Export variables in your terminal before launching Claude Code:
export ANTHROPIC_BASE_URL="https://api.asksage.ai/server/anthropic"
export ANTHROPIC_API_KEY="your-asksage-token-here"
Available Models
| Model | Ask Sage ID | Hosting | Capability |
|---|---|---|---|
claude-opus-5 | google-claude-opus-5 | Google Vertex AI | Most capable — coding, agents, long-horizon work |
claude-sonnet-5 | google-claude-sonnet-5 | Google Vertex AI | Default — balanced speed and quality |
claude-fable-5-1 | aws-bedrock-claude-fable-5-1-gov | AWS Bedrock (Gov) | Flagship on government infrastructure |
claude-opus-4-8 | google-claude-48-opus | Google Vertex AI | Previous generation Opus |
claude-opus-4-7 | google-claude-47-opus | Google Vertex AI | Previous generation Opus |
claude-opus-4-6 | google-claude-46-opus | Google Vertex AI | Previous generation Opus |
claude-sonnet-4-6 | google-claude-46-sonnet | Google Vertex AI | Previous generation Sonnet |
claude-opus-4-5 | google-claude-45-opus | Google Vertex AI | Previous generation Opus |
claude-sonnet-4-5 | aws-bedrock-claude-45-sonnet-gov | AWS Bedrock (Gov) | Previous generation Sonnet on government infrastructure |
claude-sonnet-4-5-vertex | google-claude-45-sonnet | Google Vertex AI | Previous generation Sonnet |
claude-haiku-4-5 | google-claude-45-haiku | Google Vertex AI | Fastest — lightweight tasks |
List the current set at any time with GET /server/anthropic/v1/models (returns id and display_name for each model).
Model IDs change. The IDs in this guide were verified on 2026-09-16. New models are added and older ones retired regularly, so list what your account can use before hard-coding an ID: POST /server/get-models (native API) or GET /server/openai/v1/models (OpenAI-style, no credential needed for the list).
How It Works
Ask Sage's anthropic/v1/* endpoints follow the Anthropic Messages API specification, making integration seamless.
- Your application sends a request to
https://api.asksage.ai/server/anthropic/v1/messages - Ask Sage validates your authentication token
- The model name is resolved and routed to the appropriate backend (AWS Bedrock or Google Vertex AI)
- The response is returned in standard Anthropic Messages API format
https://api.anthropic.com), use Ask Sage's base URL (https://api.asksage.ai/server/anthropic). Supported Features
"stream": true for Server-Sent Events, or omit it for the full message in a single payload. GET /server/anthropic/v1/models returns the Claude models available to your account in Anthropic's list format. anthropic-beta header.