Skip to main content
POST
/
v1
/
messages
Create message (Anthropic format)
curl --request POST \
  --url https://edgee.io/v1/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "claude-sonnet-4.5",
  "max_tokens": 1024,
  "messages": [
    {
      "content": "<string>"
    }
  ],
  "system": "<string>",
  "stream": false,
  "tools": [
    {
      "name": "<string>",
      "input_schema": {},
      "description": "<string>"
    }
  ],
  "tool_choice": {
    "type": "auto"
  }
}
'
import requests

url = "https://edgee.io/v1/messages"

payload = {
"model": "claude-sonnet-4.5",
"max_tokens": 1024,
"messages": [{ "content": "<string>" }],
"system": "<string>",
"stream": False,
"tools": [
{
"name": "<string>",
"input_schema": {},
"description": "<string>"
}
],
"tool_choice": { "type": "auto" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'claude-sonnet-4.5',
max_tokens: 1024,
messages: [{content: '<string>'}],
system: '<string>',
stream: false,
tools: [{name: '<string>', input_schema: {}, description: '<string>'}],
tool_choice: {type: 'auto'}
})
};

fetch('https://edgee.io/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://edgee.io/v1/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'claude-sonnet-4.5',
'max_tokens' => 1024,
'messages' => [
[
'content' => '<string>'
]
],
'system' => '<string>',
'stream' => false,
'tools' => [
[
'name' => '<string>',
'input_schema' => [

],
'description' => '<string>'
]
],
'tool_choice' => [
'type' => 'auto'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://edgee.io/v1/messages"

payload := strings.NewReader("{\n \"model\": \"claude-sonnet-4.5\",\n \"max_tokens\": 1024,\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"system\": \"<string>\",\n \"stream\": false,\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"input_schema\": {},\n \"description\": \"<string>\"\n }\n ],\n \"tool_choice\": {\n \"type\": \"auto\"\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://edgee.io/v1/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"claude-sonnet-4.5\",\n \"max_tokens\": 1024,\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"system\": \"<string>\",\n \"stream\": false,\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"input_schema\": {},\n \"description\": \"<string>\"\n }\n ],\n \"tool_choice\": {\n \"type\": \"auto\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://edgee.io/v1/messages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"claude-sonnet-4.5\",\n \"max_tokens\": 1024,\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"system\": \"<string>\",\n \"stream\": false,\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"input_schema\": {},\n \"description\": \"<string>\"\n }\n ],\n \"tool_choice\": {\n \"type\": \"auto\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "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
  }
}
{
"error": {
"message": "<string>",
"code": "bad_model_id",
"param": "<string>"
}
}
{
"error": {
"message": "<string>",
"code": "bad_model_id",
"param": "<string>"
}
}
{
"error": {
"message": "<string>",
"code": "bad_model_id",
"param": "<string>"
}
}
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