RequestBeam

Documentation

RequestBeam Docs

Claude Messages

Native Claude Messages-compatible API. This endpoint uses Anthropic Messages request and response shapes, including tool calls and Anthropic SSE events.

POSThttps://api.requestbeam.com/anthropic/v1/messages

Native Claude Messages-compatible API. This endpoint uses Anthropic Messages request and response shapes, including tool calls and Anthropic SSE events.

text
POST https://api.requestbeam.com/anthropic/v1/messages

Authentication

All requests require a RequestBeam API Key. Anthropic SDKs, Claude Code, and compatible clients usually use x-api-key; plain HTTP clients may also use Bearer Token authentication.

http
x-api-key: YOUR_REQUESTBEAM_API_KEY
anthropic-version: 2023-06-01
http
Authorization: Bearer YOUR_REQUESTBEAM_API_KEY
anthropic-version: 2023-06-01

Body

modelstringrequiredDefault: claude-sonnet-4-6

Supported Claude model IDs.

  • claude-fable-5
  • claude-fable-5-1
  • claude-haiku-4-5
  • claude-opus-4-5
  • claude-opus-4-6
  • claude-opus-4-7
  • claude-opus-4-8
  • claude-opus-5
  • claude-opus-5-5
  • claude-sonnet-4-5
  • claude-sonnet-4-6
  • claude-sonnet-5

Use GET https://api.requestbeam.com/v1/models for the models currently available to your API Key.

max_tokensintegerrequired

Maximum number of output tokens, as a positive safe integer. This budget includes both thinking and final text output tokens. Missing, zero, negative, fractional, string, or unsafe-integer values return HTTP 400 with invalid_request_error before generation or billing. The model may impose a lower maximum.

For models that produce thinking, a small budget such as 128 may yield only thinking blocks before ending with stop_reason: "max_tokens", without text output. Set an explicit budget for the task and the selected model, allowing room for thinking and the final answer. The values in the examples are editable allowances, not upstream defaults or model limits; larger allowances may increase output usage and cost.

messagesobject[]required

Conversation messages. Each message contains role and content.

role supports user and assistant. content may be a string or an array of content blocks.

systemstring | object[]

System prompt. Anthropic Messages uses a top-level system field instead of a system role in messages.

streambooleanDefault: false

Whether to return Anthropic SSE events.

temperaturenumber

Sampling temperature. Accepted values and effects vary by the selected model.

top_pnumber

Nucleus sampling parameter. Acceptance does not guarantee that it changes generation behavior.

top_kinteger

Top-k sampling parameter. Support depends on the selected model.

stop_sequencesstring[]

Stop sequences.

Requests with nonempty stop sequences avoid model services known not to support them; if no compatible service is available, the request returns 400 before generation or billing.

toolsobject[]

Anthropic tool definitions. Function tools usually include name, description, and input_schema.

tool_choiceobject

Tool selection policy, such as { "type": "auto" } or { "type": "tool", "name": "..." }.

thinkingobject

Native Anthropic thinking configuration, subject to the selected model and provider's support. Claude 4.5 uses { "type": "enabled", "budget_tokens": 1024 }; Claude Sonnet/Opus 4.6 also support adaptive thinking. Do not apply a manual budget to every model version. In tool continuations, return the complete ordered assistant content, including thinking, signature, redacted_thinking and tool_use, unchanged. Keep the thinking configuration and required anthropic-beta headers consistent through the tool round trip. For SSE, concatenate signature_delta.signature fragments for the same content block; an empty thinking summary does not mean its signature can be discarded. A provider account access rejection is an upstream failure, not evidence of an invalid signature. Recognized Bedrock account access rejections return HTTP 502 with api_error; ordinary client validation errors retain HTTP 400. Acceptance still requires an enabled upstream account.

metadataobject

Request metadata.

Prompt Caching

Add cache_control: { "type": "ephemeral" } to a system or message content block. Cache usage may include cache_creation_input_tokens, cache_read_input_tokens, and supported 5-minute or 1-hour creation buckets. A 1-hour TTL also requires the corresponding anthropic-beta header.

Request Examples

Non-Streaming

json
{
  "model": "claude-sonnet-4-6",
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": "Hello, introduce yourself in one sentence."
    }
  ],
  "stream": false
}

Streaming

json
{
  "model": "claude-haiku-4-5",
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": "Reply exactly OK."
    }
  ],
  "stream": true
}

Response

Non-streaming responses keep the Anthropic Message shape.

idstring

Response ID, such as msg_....

typestring

Object type, usually message.

rolestring

Usually assistant.

modelstring

Actual Claude model used.

contentobject[]

Native output content blocks, including text, tool_use, and thinking when used.

stop_reasonstring

Stop reason, such as end_turn, max_tokens, stop_sequence, or tool_use.

usageobject

Token usage, including input_tokens and output_tokens. Cache token fields are included when present.

Success Example

json
{
  "id": "msg_01...",
  "type": "message",
  "role": "assistant",
  "model": "claude-sonnet-4-6",
  "content": [
    {
      "type": "text",
      "text": "Hello, I am Claude and can help with writing, coding, and analysis tasks."
    }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 18,
    "output_tokens": 24
  }
}

Streaming Response

When stream: true, the endpoint returns Anthropic SSE events. Common events include:

  • message_start
  • content_block_start
  • content_block_delta
  • content_block_stop
  • ping
  • message_delta
  • message_stop

Error Response

See Error Codes and Troubleshooting for the full code reference, protocol differences, and diagnostic steps.

Error responses use the Anthropic-style shape:

json
{
  "type": "error",
  "error": {
    "type": "authentication_error",
    "message": "Invalid credentials or API key has expired."
  }
}