Skip to content
docs

Create message

POST
/messages
curl https://api.waibee.com/v1/messages \
-H "x-api-key: $WAIBEE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4.6",
"max_tokens": 1024,
"messages": [{ "role": "user", "content": "Hello!" }]
}'

Anthropic-compatible Messages endpoint, used by Claude Code and the Anthropic SDK. max_tokens is required. Accepts x-api-key or Authorization: Bearer. Streaming uses Anthropic SSE events and ends after message_stop (no [DONE] frame).

Media typeapplication/json
object
model
required
string
max_tokens
required

Required by the Anthropic spec.

integer
messages
required
Array<object>
>= 1 items

Message in the selected endpoint’s format. Messages takes the system prompt separately.

object
role
required
string
content
Array<object> | string | null
object
key
additional properties
any
key
additional properties
any
system

System prompt (string or array of text blocks).

Array<object> | string | null
object
key
additional properties
any
stream
boolean
temperature
number
top_k
integer
top_p
number
stop_sequences
Array<string>
tools
Array<object>

Messages function (name, description, input_schema) or built-in search (type, name).

object
name
string
description
string
input_schema
object
key
additional properties
any
type
string
key
additional properties
any
thinking

Extended thinking configuration (Anthropic).

object
type

Thinking mode. Support depends on the model.

string
budget_tokens

Token budget for the thinking phase.

integer
output_config

Anthropic output configuration (Messages endpoint only).

object
effort

Reasoning effort. Support depends on the model.

string
format

Structured output format.

object
key
additional properties
any
plugins

Per-request plugins.

object
dlp

Data-loss-prevention scan, mask or block. Optional: a DLP policy set for your API key applies as a floor of strictness even when this object is absent, and this object can only make the check stricter. entity_types is unioned with the policy’s categories, so the scan may be wider than the list you send.

object
mode

Applies to the rules you declare yourself. Where the key’s policy declares the same rule, the stricter of the two modes wins; the policy’s own categories keep the mode the administrator set.

string
Allowed values: alert mask block
entity_types

Unioned with the categories of the key’s policy, never narrowing them.

Array<string>
report_scope

Which messages’ findings come back to you. Narrowing it does not narrow the scan: every message is still scanned, and the block decision counts every finding.

string
default: all
Allowed values: all last_message latest_user_message
stop_words

Values that are a finding on their own, whatever the categories say. Unioned with the key’s policy.

Array<object>
object
value
required
string
match
string
default: exact
Allowed values: exact fuzzy
allowlist

Exceptions, matched on the whole value only. They reach your own rules only: an exception never lifts a finding raised by a rule of the key’s policy. Within your own config a stop word beats an exception on the same value.

Array<object>
object
value
required
string
match

Exact only. A substring exception would exempt every lookalike containing it.

string
default: exact
Allowed values: exact
regexes

Named patterns, run by RE2. Unioned with the key’s policy.

Array<object>
object
name
required
string
pattern
required
string
injected_context_names

Marks a message as inserted by the platform rather than typed by a person, by the value of its name field, and takes it out of the scan. Ignored while a policy applies to your key: on this path the same caller supplies both the marker and the content, so it would be a way to opt out of the check.

Array<string>
acknowledged

Reserved, and currently changes nothing: alert reports the findings and forwards the request, so there is no hold to confirm.

boolean
keep_masks

Keep masks in the response text, reasoning and tool call arguments instead of revealing them, the same with and without streaming. Under block a finding in message text is masked instead of rejecting the request. On its own this field does not turn DLP on.

boolean

Model response.

Media typeapplication/json
object
id
string
type
string
Allowed value: message
role
string
Allowed value: assistant
model
string
stop_reason
string
Allowed values: end_turn max_tokens stop_sequence tool_use
content
Array<object>
object
type
string
Allowed value: text
text
string
usage
object
input_tokens
integer
output_tokens
integer
cache_read_input_tokens
integer
cache_creation_input_tokens
integer
Example
{
"id": "gen-...",
"type": "message",
"role": "assistant",
"model": "anthropic/claude-sonnet-4.6",
"stop_reason": "end_turn",
"content": [
{
"type": "text",
"text": "Paris"
}
],
"usage": {
"input_tokens": 16,
"output_tokens": 4,
"cache_read_input_tokens": 0,
"cache_creation_input_tokens": 0
}
}

Invalid request (Anthropic format). Includes unsupported-feature rejections.

Media typeapplication/json

Anthropic-format error envelope (used by /v1/messages).

object
type
string
Allowed value: error
error
object
type
string
code

Machine-readable code, same value as error.code in the OpenAI format. Several causes share one Anthropic type, so branch on this.

string
message
string
details

Additional error data; fields depend on the code.

object
key
additional properties
any
Example
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "Invalid request"
}
}

Missing or invalid API key.

Media typeapplication/json
object
error
string
Example
{
"error": "unauthorized"
}

Rate limited or insufficient credits (Anthropic format).

Media typeapplication/json

Anthropic-format error envelope (used by /v1/messages).

object
type
string
Allowed value: error
error
object
type
string
code

Machine-readable code, same value as error.code in the OpenAI format. Several causes share one Anthropic type, so branch on this.

string
message
string
details

Additional error data; fields depend on the code.

object
key
additional properties
any
Example
{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "Rate limit exceeded"
}
}

Request blocked by an access policy or by DLP (Anthropic format). One permission_error covers both, so branch on error.code.

Media typeapplication/json

Anthropic-format error envelope (used by /v1/messages).

object
type
string
Allowed value: error
error
object
type
string
code

Machine-readable code, same value as error.code in the OpenAI format. Several causes share one Anthropic type, so branch on this.

string
message
string
details

Additional error data; fields depend on the code.

object
key
additional properties
any
Examples

Model not allowed for this group

{
"type": "error",
"error": {
"type": "permission_error",
"code": "policy_violation",
"message": "Model not allowed for this group"
}
}

Model not found (Anthropic format).

Media typeapplication/json

Anthropic-format error envelope (used by /v1/messages).

object
type
string
Allowed value: error
error
object
type
string
code

Machine-readable code, same value as error.code in the OpenAI format. Several causes share one Anthropic type, so branch on this.

string
message
string
details

Additional error data; fields depend on the code.

object
key
additional properties
any
Example
{
"type": "error",
"error": {
"type": "not_found_error",
"message": "Model does not exist in the catalog"
}
}

Internal error (Anthropic format).

Media typeapplication/json

Anthropic-format error envelope (used by /v1/messages).

object
type
string
Allowed value: error
error
object
type
string
code

Machine-readable code, same value as error.code in the OpenAI format. Several causes share one Anthropic type, so branch on this.

string
message
string
details

Additional error data; fields depend on the code.

object
key
additional properties
any
Example
{
"type": "error",
"error": {
"type": "api_error",
"message": "Internal error"
}
}

Request body or an attachment exceeds the limit (Anthropic format).

Media typeapplication/json

Anthropic-format error envelope (used by /v1/messages).

object
type
string
Allowed value: error
error
object
type
string
code

Machine-readable code, same value as error.code in the OpenAI format. Several causes share one Anthropic type, so branch on this.

string
message
string
details

Additional error data; fields depend on the code.

object
key
additional properties
any
Example
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "Request body too large"
}
}

Request failed validation (Anthropic format).

Media typeapplication/json

Anthropic-format error envelope (used by /v1/messages).

object
type
string
Allowed value: error
error
object
type
string
code

Machine-readable code, same value as error.code in the OpenAI format. Several causes share one Anthropic type, so branch on this.

string
message
string
details

Additional error data; fields depend on the code.

object
key
additional properties
any
Example
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "Invalid request: body.max_tokens: Field required"
}
}

Rate limited or insufficient credits (Anthropic format).

Media typeapplication/json

Anthropic-format error envelope (used by /v1/messages).

object
type
string
Allowed value: error
error
object
type
string
code

Machine-readable code, same value as error.code in the OpenAI format. Several causes share one Anthropic type, so branch on this.

string
message
string
details

Additional error data; fields depend on the code.

object
key
additional properties
any
Example
{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "Rate limit exceeded"
}
}

Internal error (Anthropic format).

Media typeapplication/json

Anthropic-format error envelope (used by /v1/messages).

object
type
string
Allowed value: error
error
object
type
string
code

Machine-readable code, same value as error.code in the OpenAI format. Several causes share one Anthropic type, so branch on this.

string
message
string
details

Additional error data; fields depend on the code.

object
key
additional properties
any
Example
{
"type": "error",
"error": {
"type": "api_error",
"message": "Internal error"
}
}

Temporarily unavailable (Anthropic format). dlp_policy_unavailable arrives as api_error, the type a client retries by the standard, and carries Retry-After.

Media typeapplication/json

Anthropic-format error envelope (used by /v1/messages).

object
type
string
Allowed value: error
error
object
type
string
code

Machine-readable code, same value as error.code in the OpenAI format. Several causes share one Anthropic type, so branch on this.

string
message
string
details

Additional error data; fields depend on the code.

object
key
additional properties
any
Examples
Exampledlp_policy_unavailable

DLP policy could not be resolved (retryable)

{
"type": "error",
"error": {
"type": "api_error",
"code": "dlp_policy_unavailable",
"message": "DLP policy is temporarily unavailable; retry the request"
}
}
Retry-After
integer

Seconds to wait before retrying.