Skip to main content
POST
Claude Messages API
  • Fully compatible with Claude Messages API format
  • Supports multi-turn conversations and single queries
  • Supports multimodal content including text and images
For parameter details, see the official Anthropic Messages API documentation: https://platform.claude.com/docs/en/api/messages/create

Usage Examples

Basic Conversation

Streaming Response

Tool Use

Structured Output With Cache

Vision Understanding

Notes

  • Use max_tokens to control the output length.
  • Thinking tokens count toward max_tokens.
  • Image input can use supported base64 media payloads.

Authentication

Send the API key in either header:
x-api-key lets the official Anthropic SDKs work by changing only the base URL to https://api.poyo.ai.

Response

Non-streaming requests return the Anthropic Message object directly, without a code / data wrapper. With extended thinking, content can include thinking blocks before the text block, and usage.output_tokens_details.thinking_tokens counts them.

Streaming

With "stream": true, the response follows the Anthropic event format: each event has an event: line and a data: line. The stream ends with message_stop and has no [DONE] marker.
  • Text arrives in content_block_delta events with delta.type: "text_delta".
  • message_delta carries stop_reason and the final usage.

Errors

  • 401: missing or invalid API key.
  • 400: invalid parameters, or the model does not support Anthropic Messages. The message lists the supported URIs.
  • 404: unknown model id.
See Error Codes for example bodies, and LLM Models for which models support this format.

Authorizations

x-api-key
string
header
required

API key authentication. This endpoint also accepts Authorization: Bearer YOUR_API_KEY.

Create an API key: sign in to PoYo, open Dashboard → API Key at poyo.ai/dashboard/api-key, and click to create a key.

Add it to the request header:

Body

application/json
model
string
required

Model name. Example: claude-sonnet-4-5-20250929.

Example:

"claude-sonnet-4-5-20250929"

messages
object[]
required

List of conversation messages in order. Each message contains a role and content. Use user for user input and assistant for previous model output in multi-turn conversations. Example: [{"role": "user", "content": "Summarize the purpose of feature canary releases in two sentences."}].

max_tokens
integer

Maximum number of tokens to generate.

Required range: x >= 1
Example:

1024

system

System prompt for the assistant. Supports a string or structured text blocks.

Example:

"You are a product announcement editor, keep it objective and concise."

cache_control
object

Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request.

stream
boolean

Whether to use streaming output.

Example:

false

stop_sequences
string[]

Stop sequences. The model stops when it encounters any of these strings.

metadata
object

Additional metadata such as user_id.

output_config
object

Configuration options for the model's output, such as output format and effort level.

thinking
object

Configuration for Claude extended thinking. Supported on Claude models with extended thinking. Thinking tokens count toward max_tokens.

tools
object[]

Tool definitions available to the model.

tool_choice

Controls tool usage behavior. Examples: auto, or an object such as {"type": "tool", "name": "get_weather"}.

Example:

"auto"

Response

Message created

id
string
Example:

"msg_013zva2CMHNLnXJNN3QKQ2EF"

type
string
Example:

"message"

role
string
Example:

"assistant"

content
object[]
model
string
Example:

"claude-sonnet-4-5-20250929"

stop_reason
string
Example:

"end_turn"

stop_sequence
string | null
usage
object