Skip to main content
POST
Create a message (Anthropic)

Headers

x-api-key
string

Singularity Layer compute API key, billed to credits. Authorization: Bearer x402c_... or a session token also work. Omit to pay per request with x402 X-Payment.

Example:

"x402c_..."

anthropic-version
string

Accepted, not enforced.

Example:

"2023-06-01"

Body

application/json
model
string
required

A Grid model id from GET /v1/models, never a Claude model id.

Example:

"qwen-2.5-32b"

max_tokens
integer
required

Lowered to fit the room left in the model's context. Output is capped at 8192.

Required range: x >= 1
Example:

512

messages
object[]
required

Conversation turns, user and assistant. Must not end with an assistant message (no prefill). A mid-conversation system message is folded into the user turn it follows.

Example:
system

System prompt, as a string or text blocks.

stream
boolean
default:false

Server-sent events in Anthropic order. Use it for long replies.

temperature
number
stop_sequences
string[]

Applied by the Grid. Tokens the node generated past the match are still billed.

tools
object[]

Your own tools with an input_schema. Server tools and Anthropic-defined tools are refused.

tool_choice
object

{type: auto | any | tool | none}. disable_parallel_tool_use: true is refused.

thinking
object

Accepted as a no-op for adaptive, disabled, between_tools. enabled with budget_tokens is refused.

metadata
object

Accepted, no effect.

Response

The message, or an SSE stream when stream is true.

id
string
type
string
Example:

"message"

role
string
Example:

"assistant"

model
string
content
object[]
stop_reason
enum<string>
Available options:
end_turn,
max_tokens,
stop_sequence,
tool_use,
refusal
stop_sequence
string | null
usage
object