Skip to content

Messages (Anthropic format)

POST
/v1/messages
curl --request POST \
--url https://api.openpike.dev/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'anthropic-version: 2023-06-01' \
--header 'x-openpike-no-log: 1' \
--header 'x-openpike-run: task-8841' \
--header 'x-openpike-run-max-usd: 5' \
--header 'x-openpike-tags: agent=reviewer,env=prod' \
--data '{ "model": "anthropic/claude-haiku-5-5", "max_tokens": 100, "messages": [ { "role": "user", "content": "Say hello in five words." } ] }'

Anthropic’s messages format, for Anthropic and for DeepSeek’s Anthropic-compatible endpoint. The body is passed through; the anthropic-version and anthropic-beta headers are forwarded. Use https://api.openpike.dev (without /v1) as the Anthropic SDK’s base URL.

Streaming: with "stream": true the response is Anthropic’s server-sent events, passed through. Token usage is read from message_start and message_delta.

Errors on this endpoint use Anthropic’s shape. OpenPike’s own 429 blocks have the type rate_limit_error; they come without an x-openpike-provider header, which tells them apart from a provider’s rate limit.

x-openpike-tags
string

Example

agent=reviewer,env=prod

Comma-separated key=value pairs merged over the virtual key’s tags for this request, for example agent=reviewer,env=prod. At most 10 pairs; keys and values at most 64 characters. Not forwarded to the provider.

x-openpike-no-log
string
Allowed values: 1 true

1 or true keeps this request out of prompt logging even when the workspace has it on. Not forwarded to the provider.

x-openpike-run
string
>= 1 characters <= 128 characters

Example

task-8841

The run this request belongs to, 1 to 128 printable ASCII characters, for example a task or session ID. Run limits on matching budgets cap each run’s spend, requests and wall time; a run at a cap gets 429 run_limit_exceeded. Not forwarded to the provider.

x-openpike-run-label
string
<= 200 characters

A human name for the run, at most 200 characters. Needs x-openpike-run. Not forwarded.

x-openpike-run-max-usd
string

Example

5

A spend cap in dollars for the run, above zero. Only lowers a budget’s run spend cap. Needs x-openpike-run. Not forwarded.

anthropic-version
string

Example

2023-06-01

Forwarded to the provider. Anthropic’s SDKs set it.

anthropic-beta
string

Forwarded to the provider.

Media typeapplication/json

Anthropic’s messages request. Only the fields OpenPike reads are listed; every other field is passed to the provider unchanged.

object
model
required

provider/model or openpike/<alias>.

string
max_tokens
required
integer
messages
required
Array<object>
object
key
additional properties
any
stream
boolean
key
additional properties
any

Example

{
"model": "anthropic/claude-haiku-5-5",
"max_tokens": 100,
"messages": [
{
"role": "user",
"content": "Say hello in five words."
}
]
}

The provider’s response, passed through. JSON, or server-sent events when stream is true.

Anthropic’s message object, as returned by the provider.

object
id
string
type
string
model
string
content
Array<object>
object
key
additional properties
any
usage
object
key
additional properties
any
key
additional properties
any

Example

{
"id": "msg_123",
"type": "message",
"role": "assistant",
"model": "claude-haiku-5-5",
"content": [
{
"type": "text",
"text": "Hello, nice to meet you."
}
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 14,
"output_tokens": 9
}
}
x-openpike-request-id
string
Example
req_QhMBW1esl4VW2o8NXDEcOLsS

The request ID, also shown in Logs.

x-openpike-provider
string
Example
deepseek

The provider that served the request, or that returned an upstream error.

x-openpike-model
string
Example
deepseek/deepseek-flash

The provider/model that served the request; differs from the request for aliases.

x-openpike-attempts
integer
Example
1

Upstream attempts, 1 when no fallback happened.

server-timing
string
Example
gate;dur=4.2

gate;dur=<ms>: time spent checking budgets, pauses and plan limits.

The same errors as on the other endpoints, in Anthropic’s shape. See the errors page for the type each status maps to.

Media typeapplication/json

The error shape of /v1/messages, Anthropic’s own.

object
type
required
string
Allowed value: error
error
required
object
type
required

invalid_request_error, authentication_error, permission_error, not_found_error, rate_limit_error, api_error, or the provider’s own type on upstream errors.

string
message
required
string

Example

{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "The hard budget for agent=reviewer is used up for this period."
}
}
retry-after
integer

Seconds until the request may succeed. Set on OpenPike’s 429 blocks, and passed through from the provider on upstream errors.

x-openpike-request-id
string
Example
req_QhMBW1esl4VW2o8NXDEcOLsS

The request ID, also shown in Logs.

The same errors as on the other endpoints, in Anthropic’s shape. See the errors page for the type each status maps to.

Media typeapplication/json

The error shape of /v1/messages, Anthropic’s own.

object
type
required
string
Allowed value: error
error
required
object
type
required

invalid_request_error, authentication_error, permission_error, not_found_error, rate_limit_error, api_error, or the provider’s own type on upstream errors.

string
message
required
string

Example

{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "The hard budget for agent=reviewer is used up for this period."
}
}
retry-after
integer

Seconds until the request may succeed. Set on OpenPike’s 429 blocks, and passed through from the provider on upstream errors.

x-openpike-request-id
string
Example
req_QhMBW1esl4VW2o8NXDEcOLsS

The request ID, also shown in Logs.

The same errors as on the other endpoints, in Anthropic’s shape. See the errors page for the type each status maps to.

Media typeapplication/json

The error shape of /v1/messages, Anthropic’s own.

object
type
required
string
Allowed value: error
error
required
object
type
required

invalid_request_error, authentication_error, permission_error, not_found_error, rate_limit_error, api_error, or the provider’s own type on upstream errors.

string
message
required
string

Example

{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "The hard budget for agent=reviewer is used up for this period."
}
}
retry-after
integer

Seconds until the request may succeed. Set on OpenPike’s 429 blocks, and passed through from the provider on upstream errors.

x-openpike-request-id
string
Example
req_QhMBW1esl4VW2o8NXDEcOLsS

The request ID, also shown in Logs.

The same errors as on the other endpoints, in Anthropic’s shape. See the errors page for the type each status maps to.

Media typeapplication/json

The error shape of /v1/messages, Anthropic’s own.

object
type
required
string
Allowed value: error
error
required
object
type
required

invalid_request_error, authentication_error, permission_error, not_found_error, rate_limit_error, api_error, or the provider’s own type on upstream errors.

string
message
required
string

Example

{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "The hard budget for agent=reviewer is used up for this period."
}
}
retry-after
integer

Seconds until the request may succeed. Set on OpenPike’s 429 blocks, and passed through from the provider on upstream errors.

x-openpike-request-id
string
Example
req_QhMBW1esl4VW2o8NXDEcOLsS

The request ID, also shown in Logs.

The same errors as on the other endpoints, in Anthropic’s shape. See the errors page for the type each status maps to.

Media typeapplication/json

The error shape of /v1/messages, Anthropic’s own.

object
type
required
string
Allowed value: error
error
required
object
type
required

invalid_request_error, authentication_error, permission_error, not_found_error, rate_limit_error, api_error, or the provider’s own type on upstream errors.

string
message
required
string

Example

{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "The hard budget for agent=reviewer is used up for this period."
}
}
retry-after
integer

Seconds until the request may succeed. Set on OpenPike’s 429 blocks, and passed through from the provider on upstream errors.

x-openpike-request-id
string
Example
req_QhMBW1esl4VW2o8NXDEcOLsS

The request ID, also shown in Logs.

The same errors as on the other endpoints, in Anthropic’s shape. See the errors page for the type each status maps to.

Media typeapplication/json

The error shape of /v1/messages, Anthropic’s own.

object
type
required
string
Allowed value: error
error
required
object
type
required

invalid_request_error, authentication_error, permission_error, not_found_error, rate_limit_error, api_error, or the provider’s own type on upstream errors.

string
message
required
string

Example

{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "The hard budget for agent=reviewer is used up for this period."
}
}
retry-after
integer

Seconds until the request may succeed. Set on OpenPike’s 429 blocks, and passed through from the provider on upstream errors.

x-openpike-request-id
string
Example
req_QhMBW1esl4VW2o8NXDEcOLsS

The request ID, also shown in Logs.