Skip to main content
POST
/
anthropic
/
v1
/
messages
Create message (Anthropic format)
curl --request POST \
  --url http://localhost:8080/anthropic/v1/messages \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "claude-3-opus-20240229",
  "max_tokens": 123,
  "messages": [
    {
      "role": "user",
      "content": "<string>"
    }
  ],
  "system": "<string>",
  "metadata": {
    "user_id": "<string>"
  },
  "stream": true,
  "temperature": 0.5,
  "top_p": 123,
  "top_k": 123,
  "stop_sequences": [
    "<string>"
  ],
  "tools": [
    {
      "type": "custom",
      "name": "<string>",
      "description": "<string>",
      "input_schema": {},
      "cache_control": {
        "type": "ephemeral",
        "ttl": "<string>"
      },
      "display_width_px": 123,
      "display_height_px": 123,
      "display_number": 123,
      "enable_zoom": true,
      "max_uses": 123,
      "allowed_domains": [
        "<string>"
      ],
      "blocked_domains": [
        "<string>"
      ],
      "user_location": {
        "type": "approximate",
        "city": "<string>",
        "country": "<string>",
        "timezone": "<string>"
      }
    }
  ],
  "tool_choice": {
    "type": "auto",
    "name": "<string>",
    "disable_parallel_tool_use": true
  },
  "mcp_servers": [
    {
      "type": "<string>",
      "name": "<string>",
      "url": "<string>",
      "authorization_token": "<string>",
      "tool_configuration": {
        "enabled": true,
        "allowed_tools": [
          "<string>"
        ]
      }
    }
  ],
  "thinking": {
    "type": "enabled",
    "budget_tokens": 123
  },
  "output_format": {},
  "fallbacks": [
    "<string>"
  ]
}
'
{
  "id": "<string>",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "<string>",
      "thinking": "<string>",
      "signature": "<string>",
      "data": "<string>",
      "tool_use_id": "<string>",
      "id": "<string>",
      "name": "<string>",
      "input": {},
      "server_name": "<string>",
      "content": "<string>",
      "source": {
        "type": "base64",
        "media_type": "<string>",
        "data": "<string>",
        "url": "<string>"
      },
      "cache_control": {
        "type": "ephemeral",
        "ttl": "<string>"
      },
      "citations": {
        "enabled": true
      },
      "context": "<string>",
      "title": "<string>"
    }
  ],
  "model": "<string>",
  "stop_reason": "end_turn",
  "stop_sequence": "<string>",
  "usage": {
    "input_tokens": 123,
    "output_tokens": 123,
    "cache_creation_input_tokens": 123,
    "cache_read_input_tokens": 123,
    "cache_creation": {
      "ephemeral_5m_input_tokens": 123,
      "ephemeral_1h_input_tokens": 123
    }
  }
}

Body

application/json
model
string
required

Model identifier (e.g., claude-3-opus-20240229)

Example:

"claude-3-opus-20240229"

max_tokens
integer
required

Maximum tokens to generate

messages
object[]
required

List of messages in the conversation

system

System prompt

metadata
object
stream
boolean

Whether to stream the response

temperature
number
Required range: 0 <= x <= 1
top_p
number
top_k
integer
stop_sequences
string[]
tools
object[]
tool_choice
object
mcp_servers
object[]

MCP servers configuration (requires beta header)

thinking
object
output_format
object

Structured output format (requires beta header)

fallbacks
string[]

Response

Successful response

id
string
type
string
default:message
role
string
default:assistant
content
object[]
model
string
stop_reason
enum<string>
Available options:
end_turn,
max_tokens,
stop_sequence,
tool_use,
pause_turn,
refusal,
model_context_window_exceeded,
stop_sequence
string | null
usage
object