Skip to main content
POST
/
v1
/
messages
Create message (Anthropic format)
curl --request POST \
  --url https://api.edgee.ai/v1/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "claude-sonnet-4.5",
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": "<string>"
    }
  ],
  "system": "<string>",
  "stream": false,
  "tools": [
    {
      "name": "<string>",
      "input_schema": {},
      "description": "<string>"
    }
  ],
  "tool_choice": {
    "type": "auto"
  }
}
'
{
  "id": "<string>",
  "model": "<string>",
  "content": [
    {
      "type": "text",
      "text": "<string>"
    }
  ],
  "usage": {
    "input_tokens": 1,
    "output_tokens": 1,
    "cache_read_input_tokens": 1,
    "cache_creation_input_tokens": 1
  },
  "stop_reason": "end_turn"
}

Documentation Index

Fetch the complete documentation index at: https://www.edgee.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Creates a message using Anthropic’s native Messages API format. This endpoint provides the same API format as Anthropic’s official API, making it easy to migrate existing integrations or use Anthropic-specific features.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your API key. More info here

Headers

X-Edgee-Tags
string

Comma-separated list of tags for categorizing and filtering requests in analytics and logs. Example: production,agent,codex

X-Edgee-Debug
boolean

Enable debug mode to include additional debugging information in the response.

X-Edgee-Compression-Model
enum<string>

Compression bundle to apply.

Available options:
claude,
opencode,
cursor,
codex
x-edgee-api-key
string

Claude CLI passthrough authentication. When set, the gateway uses this key instead of x-api-key / Authorization to authenticate the request. Used by the Claude Code CLI when proxying requests through Edgee.

x-edgee-session-id
string

Claude CLI session identifier. Used to group all messages from a single CLI session in analytics.

Body

application/json
model
string
required

The model ID to use (Anthropic format, without provider prefix)

Example:

"claude-sonnet-4.5"

max_tokens
integer
required

Maximum number of tokens to generate

Required range: x >= 1
Example:

1024

messages
object[]
required

Array of message objects

Minimum array length: 1
system

System prompt as a string

stream
boolean
default:false

Enable streaming responses

tools
object[]

Tool definitions

tool_choice
object

Response

Message created successfully

id
string
required

Unique identifier for this message

model
string
required

The model that generated the response

content
object[]
required

Array of content blocks

usage
object
required
stop_reason
enum<string>

Why the model stopped generating

Available options:
end_turn,
max_tokens,
tool_use