Skip to content

Anthropic Messages API

Generate a message with the Anthropic SDK. Choose a model that lists /v1/messages in supported_endpoints.

POST /v1/messages

Authorization

Authorizationheader · string
x-api-key: $BOARDWALK_API_KEY or Bearer authorization. Requires inference:write and sufficient credits. Send anthropic-version: 2023-06-01; the SDK supplies it. Conflicting keys and beta headers are rejected.
Content-Typeheader · stringrequired
application/json

Request

Request · cURL
curl https://api.boardwalk.cloud/v1/messages \
  -H "x-api-key: $BOARDWALK_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model":"support-agent","messages":[{"role":"user","content":"Hello"}],"max_tokens":256}'

Request body

modelstringrequired
Public repository ID or private deployment name; optionally append @revision_id.
messagesobject[]required
user and assistant turns, with string content or ordered text, image, tool_use, tool_result and thinking blocks as permitted by the role. Qualified images use URL or base64 sources.
max_tokenspositive integerrequired
Maximum generated tokens, including reasoning. Input and output share the context window.
systemstring | text block[]
System instructions are top-level, not a system-role message.
streamboolean
Receive native Messages server-sent events.
temperature / top_p / top_knumber
temperature: 0–1; top_p: greater than 0 through 1; top_k: nonnegative integer.
stop_sequencesstring[]
Up to four stop sequences.
toolsobject[]
Client tools with name, optional description and input_schema. Your application executes them. Strict tool flags and hosted tools are unsupported.
tool_choiceobject
type is auto, any, none, or tool with name. Check the model’s tool controls. disable_parallel_tool_use is not supported.
output_configobject
format: {type:"json_schema", schema}. Available only when the endpoint advertises json_schema; currently the qualified vLLM binding.
thinkingobject
Only {type:"disabled"} on models advertising thinking_toggle. Explicit budgets and enabled/adaptive controls are unsupported.

Response

Example response. IDs, token counts, and rates are illustrative.

200 · application/json
{
  "id": "msg_example",
  "type": "message",
  "model": "support-agent",
  "role": "assistant",
  "content": [
    { "type": "text", "text": "Hello!" }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": { "input_tokens": 12, "output_tokens": 3 }
}
contentobject[]
Ordered text, tool_use, or thinking blocks. Tool arguments are objects, not JSON strings.
stop_reasonstring
For example end_turn, tool_use, stop_sequence, or max_tokens. max_tokens can leave structured output incomplete.
usageobject
input_tokens excludes separately reported cache reads/writes. output_tokens includes generated reasoning. Boardwalk settles each usage dimension once.

Anthropic SDK

TypeScript
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: process.env.BOARDWALK_API_KEY,
  baseURL: "https://api.boardwalk.cloud",
});

const message = await client.messages.create({
  model: "support-agent",
  max_tokens: 256,
  messages: [{ role: "user", content: "Hello" }],
});
console.log(message.content);

History and tools

Keep history in your application. Append the assistant's returned content, then a user tool_result block with its original tool_use_id and your result. Preserve block order and IDs. Thinking text can be replayed when the engine needs it; engine signatures do not represent Anthropic signature verification.

Streaming

Use client.messages.stream(...).finalMessage(). Streams have message and content-block start/delta/stop events. Tool arguments arrive as partial JSON. Usage updates are cumulative, so do not sum each update. Interrupted streams may lack final usage; consult the receipt.

Invalid images, schemas, and parameters return 400. See image inputs and structured output.

Errors

Errors use a Messages envelope with type: "error" and nested error.type and error.message. The request-id header is also returned. Save the x-request-id response header for receipts and support.