Skip to content

Create a message (Anthropic format)

POST
/v1/messages
curl --request POST \
--url https://api.aderra.ai/v1/messages \
--header 'Content-Type: application/json' \
--header 'anthropic-version: 2023-06-01' \
--header 'x-api-key: <x-api-key>' \
--data '{ "model": "deepseek-v4.1-flash-uncensored", "max_tokens": 1024, "messages": [ { "role": "user", "content": "Write a haiku about the sea." } ] }'

Anthropic Messages. With the Anthropic SDK, set the base URL to https://api.aderra.ai (without /v1). The key can be sent as x-api-key or Authorization: Bearer.

max_tokens is optional here: when absent, the model’s output limit is used. When present it must be a positive integer. The answer comes without extended thinking unless you send thinking, reasoning_effort or reasoning.

A web_search server tool ({"type": "web_search_20250305", "name": "web_search"}) is supported. Each search is billed on top of the tokens. A web-search turn is answered in one piece: with stream: true the events arrive together at the end.

Errors use Anthropic’s types (authentication_error, billing_error, rate_limit_error, invalid_request_error, api_error) with the reason in the message.

anthropic-version
string

Example

2023-06-01

Sent by the Anthropic SDKs. Accepted; it does not change the response.

Media typeapplication/json
object
model
required
string
messages
required
Array<object>
object
role
required
string
Allowed values: user assistant
content
required
One of:
string
system

Your system prompt, a string or text blocks. Passed through untouched with an API key; Aderra adds one safety line after it.

One of:
string
max_tokens

Optional. Capped at the model’s output limit; absent means the limit.

integer
>= 1
stream
boolean
temperature
number
top_p
number
top_k
integer
stop_sequences
Array<string>
tools

Function tools, and the web_search_* server tool.

Array<object>
object
key
additional properties
any
tool_choice
object
key
additional properties
any
thinking

{"type": "enabled", "budget_tokens": n} turns thinking on; the budget is kept under max_tokens.

object
key
additional properties
any
reasoning_effort
string

Example

{
"model": "deepseek-v4.1-flash-uncensored",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Write a haiku about the sea."
}
]
}

The message. JSON, or Anthropic’s server-sent events when stream is true (message_start, content_block_delta, message_delta with the usage, message_stop).

object
id
string
type
string
Allowed value: message
role
string
Allowed value: assistant
model
string
content
Array<object>
object
key
additional properties
any
stop_reason
string | null
usage
object
input_tokens
integer
output_tokens
integer

Example

{
"type": "message",
"role": "assistant"
}
x-aderra-reservation
string format: uuid

The id of the credit hold for this call. Quote it when you contact support about a charge.

invalid_request_error: invalid JSON, unknown model <id>, n other than 1, or a max_tokens that is not a positive integer.

Media typeapplication/json
object
type
required
string
Allowed value: error
error
required
object
type
string
Allowed values: invalid_request_error authentication_error permission_error billing_error rate_limit_error request_too_large api_error overloaded_error
message
string

Example

{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "unknown model gpt-4o"
}
}

authentication_error: invalid api key or unauthorized.

Media typeapplication/json
object
type
required
string
Allowed value: error
error
required
object
type
string
Allowed values: invalid_request_error authentication_error permission_error billing_error rate_limit_error request_too_large api_error overloaded_error
message
string

Example

{
"type": "error",
"error": {
"type": "invalid_request_error"
}
}

billing_error: the API wallet is empty, the key hit its monthly cap, or (terminal keys) the plan is out of credits. The reason is in the message.

Media typeapplication/json
object
type
required
string
Allowed value: error
error
required
object
type
string
Allowed values: invalid_request_error authentication_error permission_error billing_error rate_limit_error request_too_large api_error overloaded_error
message
string

Example

{
"type": "error",
"error": {
"type": "invalid_request_error"
}
}

permission_error: the account is suspended.

Media typeapplication/json
object
type
required
string
Allowed value: error
error
required
object
type
string
Allowed values: invalid_request_error authentication_error permission_error billing_error rate_limit_error request_too_large api_error overloaded_error
message
string

Example

{
"type": "error",
"error": {
"type": "invalid_request_error"
}
}

request_too_large: the request is too big to send to the model.

Media typeapplication/json
object
type
required
string
Allowed value: error
error
required
object
type
string
Allowed values: invalid_request_error authentication_error permission_error billing_error rate_limit_error request_too_large api_error overloaded_error
message
string

Example

{
"type": "error",
"error": {
"type": "invalid_request_error"
}
}

rate_limit_error: the key passed its requests per minute, or the account has 8 requests in progress.

Media typeapplication/json
object
type
required
string
Allowed value: error
error
required
object
type
string
Allowed values: invalid_request_error authentication_error permission_error billing_error rate_limit_error request_too_large api_error overloaded_error
message
string

Example

{
"type": "error",
"error": {
"type": "invalid_request_error"
}
}
Retry-After
integer
Example
12

Whole seconds to wait before trying again.

api_error: the model failed or could not be reached. Not charged. The status can also be the upstream status (for example 429 when the model is busy).

Media typeapplication/json
object
type
required
string
Allowed value: error
error
required
object
type
string
Allowed values: invalid_request_error authentication_error permission_error billing_error rate_limit_error request_too_large api_error overloaded_error
message
string

Example

{
"type": "error",
"error": {
"type": "invalid_request_error"
}
}

overloaded_error: Aderra is busy receiving other large requests. Retry after Retry-After (5) seconds.

Media typeapplication/json
object
type
required
string
Allowed value: error
error
required
object
type
string
Allowed values: invalid_request_error authentication_error permission_error billing_error rate_limit_error request_too_large api_error overloaded_error
message
string

Example

{
"type": "error",
"error": {
"type": "invalid_request_error"
}
}
Retry-After
integer
Example
12

Whole seconds to wait before trying again.