Skip to main content
POST
/
v1
/
messages
cURL
curl https://api.deerapi.com/v1/messages \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DEERAPI_KEY" \
  -d '{
    "max_tokens": 1024,
    "system": "You are a concise technical assistant.",
    "messages": [
      {
        "content": "Summarize the benefits of retry logic for production API clients.",
        "role": "user"
      }
    ],
    "model": "claude-sonnet-4-6"
  }'
{
  "id": "<string>",
  "type": "message",
  "role": "assistant",
  "model": "<string>",
  "content": [
    {
      "text": "<string>",
      "thinking": "<string>",
      "signature": "<string>",
      "id": "<string>",
      "name": "<string>",
      "input": {},
      "citations": [
        {}
      ]
    }
  ],
  "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
    },
    "inference_geo": "<string>",
    "server_tool_use": {
      "web_search_requests": 123,
      "web_fetch_requests": 123
    },
    "service_tier": "<string>"
  },
  "container": {
    "id": "<string>",
    "expires_at": "<string>"
  },
  "stop_sequence": "<string>"
}

Overview

Use this endpoint to call the Anthropic Messages workflow through DeerAPI. The API reference on this page shows the request schema, response schema, authentication requirements, and runnable examples for the configured endpoint.

Before you start

Use the DeerAPI base URL and pass your API Key in the Authorization header:
https://api.deerapi.com
Authorization: Bearer $DEERAPI_KEY

Model selection

Choose a current model ID from the live pricing page. Model availability changes over time, so avoid copying a model ID from an old project without checking the live list first.

Implementation notes

  • Use the OpenAPI playground for the exact request fields accepted by this endpoint.
  • Keep API Keys on the server side when you build production applications.
  • Log the request ID from failed calls so support can investigate the request.
  • Retry 429, 500, and 503 responses with exponential backoff.

Authorizations

Authorization
string
header
required

Use a DeerAPI API Key as a Bearer token.

Body

application/json

Use this field according to the endpoint schema.

model
string
default:claude-sonnet-4-6
required

Use this field according to the endpoint schema.

messages
object[]
required

Use this field according to the endpoint schema.

max_tokens
integer
default:1024
required

Use this field according to the endpoint schema.

cache_control
object

Use this field according to the endpoint schema.

container
string

Use this field according to the endpoint schema.

inference_geo
string

Use this field according to the endpoint schema.

context_management
object

Use this field according to the endpoint schema.

mcp_servers
object[]

Use this field according to the endpoint schema.

metadata
object

Use this field according to the endpoint schema.

output_config
object

Use this field according to the endpoint schema.

service_tier
enum<string>

Use this field according to the endpoint schema.

Available options:
auto,
standard_only
stop_sequences
string[]

Use this field according to the endpoint schema.

stream
boolean

Use this field according to the endpoint schema.

system

Use this field according to the endpoint schema.

temperature
number

Use this field according to the endpoint schema.

Required range: 0 <= x <= 1
thinking
object

Use this field according to the endpoint schema.

tool_choice
object

Use this field according to the endpoint schema.

tools
object[]

Use this field according to the endpoint schema.

top_k
integer

Use this field according to the endpoint schema.

top_p
number

Use this field according to the endpoint schema.

Required range: 0 <= x <= 1

Response

200 - application/json

Successful Response

id
string
required

Use this field according to the endpoint schema.

type
enum<string>
required

Use this field according to the endpoint schema.

Available options:
message
role
enum<string>
required

Use this field according to the endpoint schema.

Available options:
assistant
model
string
required

Use this field according to the endpoint schema.

content
object[]
required

Use this field according to the endpoint schema.

stop_reason
enum<string>
required

Use this field according to the endpoint schema.

Available options:
end_turn,
max_tokens,
stop_sequence,
tool_use,
pause_turn,
refusal
usage
object
required

Use this field according to the endpoint schema.

container
object

Use this field according to the endpoint schema.

stop_sequence
string | null

Use this field according to the endpoint schema.