Endpoints

Messages

POST /v1/messages: the Anthropic-compatible endpoint for text generation.

Create a message. This endpoint is a drop-in Anthropic Messages API, so any Anthropic-compatible client works when pointed at the Spoof base URL.

POSThttps://api.spoofzone.com/v1/messages

Request parameters

modelstringrequired

The model ID to call, for example claude-sonnet-4-6. See Models.

max_tokensintegerrequired

The maximum number of tokens to generate before stopping. Large values are capped by a server ceiling; when that happens the response carries an x-spoof-clamped-max-tokens header with your original value.

messagesarrayrequired

The conversation so far, as an array of { role, content } objects. role is user or assistant; content is a string or an array of content blocks (text, images, tool results).

systemstring | array

A system prompt: instructions and context applied to the whole conversation.

temperaturenumberdefault: 1.0

Amount of randomness, between 0.0 and 1.0. Lower is more deterministic. See the repair note below for newer models.

top_pnumber

Nucleus sampling. Use either temperature or top_p, not both.

top_kinteger

Only sample from the top K options for each token.

stop_sequencesarray

Custom text sequences that will stop generation.

streambooleandefault: false

When true, tokens are streamed back as server-sent events. See Streaming.

toolsarray

Tool definitions the model may call. See Tool use.

tool_choiceobject

Controls whether and which tool the model must use (auto, any, or a specific tool).

thinkingobject

Enable extended thinking with a token budget. On newer models this is adapted automatically to effort. See Extended thinking.

metadataobject

An object with a user_id and other opaque metadata about the request.

Any other field from the Anthropic Messages API is accepted and passed through.

Parameter repair

Newer models reject some legacy sampling controls. Spoof adjusts the request for you rather than failing it: temperature, top_p, and top_k are stripped where a model no longer accepts them, and a legacy fixed-budget thinking is rewritten to the model's effort control. Anything adjusted is listed in the x-spoof-repaired-params response header.

Example

curl https://api.spoofzone.com/v1/messages \
-H "x-api-key: $SPOOF_API_KEY" \
-H "content-type: application/json" \
-d '{
  "model": "claude-sonnet-4-6",
  "max_tokens": 1024,
  "system": "You are a concise assistant.",
  "messages": [{ "role": "user", "content": "Hello, Spoof!" }]
}'
bash · 9 lines

Response

A successful call returns a message object:

{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
  "model": "claude-sonnet-4-6",
  "content": [{ "type": "text", "text": "Hello! How can I help you today?" }],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 12,
    "output_tokens": 11,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0
  }
}
json · 15 lines

The usage block is what you are billed on. Cache writes are billed at 1.25x the input rate (5-minute cache) or 2x (1-hour cache).

Response headers

Alongside the body, responses carry a few Spoof headers:

HeaderMeaning
x-request-idTrace ID for the request. Include it in any support question.
x-spoof-billing-chainThe chain this call settled on.
x-spoof-repaired-paramsAny stale parameters that were adjusted for the target model.
x-spoof-clamped-max-tokensPresent when max_tokens was reduced to the server ceiling.

Errors

See Errors for status codes. Common cases: 401 (bad key), 402 (wallet underfunded for this call), 429 (rate limited).

Messages | Spoof