Skip to main content
POST
/
v1
/
messages
Claude Messages API
curl --request POST \
  --url https://api.poyo.ai/v1/messages \
  --header 'Content-Type: application/json' \
  --header 'anthropic-version: <api-key>' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "model": "claude-sonnet-4-5-20250929",
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": "Rewrite the following product announcement to be more gentle and user-friendly: We will have maintenance for 2 hours this weekend, services will be unavailable during this time."
    }
  ]
}
'
{
  "code": 200,
  "data": {
    "id": "msg_013zva2CMHNLnXJNN3QKQ2EF",
    "type": "message",
    "role": "assistant",
    "content": [
      {
        "type": "text",
        "text": "Hello! I'm Claude. Nice to meet you."
      }
    ],
    "model": "claude-sonnet-4-5-20250929",
    "stop_reason": "end_turn",
    "stop_sequence": null,
    "usage": {
      "input_tokens": 10,
      "output_tokens": 13
    }
  }
}
  • Fully compatible with Claude Messages API format
  • Supports multi-turn conversations and single queries
  • Supports multimodal content including text and images

Authorizations

x-api-key
string
required
API key for authenticationVisit the API Key Management Page to get your API KeyAdd to the request header:
x-api-key: PoYo_API_KEY
anthropic-version
string
required
API versionExample: 2025-10-01

Body

model
string
required
Model name. Example: claude-sonnet-4-5-20250929
messages
array
required
List of conversation messagesExample:
[{"role": "user", "content": "Summarize the purpose of feature canary releases in two sentences."}]
Multi-turn conversation:
[
  {"role": "user", "content": "Help me polish this sentence: This feature is still in testing."},
  {"role": "assistant", "content": "How about: This feature is currently in internal beta testing."},
  {"role": "user", "content": "Give me a more formal version."}
]
max_tokens
integer
required
Maximum number of tokens to generate
system
string or array
System prompt (string or structured blocks)String example:
"You are a product announcement editor, keep it objective and concise."
Structured example:
[{"type": "text", "text": "You are a product announcement editor, keep it objective and concise."}]
temperature
number
Controls output randomness, range 0-1
top_p
number
Nucleus sampling parameter, range 0-1
top_k
integer
Top-k sampling parameter
stream
boolean
Whether to use streaming output
stop_sequences
array
Stop sequences where generation stops
metadata
object
Additional metadata such as user_id
tools
array
Tool definitions available to the model
[
  {
    "name": "get_weather",
    "description": "Get weather by city",
    "input_schema": {
      "type": "object",
      "properties": {
        "city": {"type": "string"}
      },
      "required": ["city"]
    }
  }
]
tool_choice
string or object
Controls tool usage behaviorExamples: "auto", {"type": "tool", "name": "get_weather"}

Response

id
string
Unique identifier for the response
type
string
Object type, fixed as message
role
string
Role type, fixed as assistant
content
array
Content blocks
model
string
The actual model name used
stop_reason
string
Reason for completion
stop_sequence
string
Stop sequence that triggered completion (if any)
usage
object
Token usage statistics

Usage Examples

Basic Conversation

{
  "model": "claude-sonnet-4-5-20250929",
  "max_tokens": 256,
  "messages": [
    {"role": "user", "content": "Explain the meaning of 'rate limiting' in three sentences."}
  ]
}

Streaming Response

{
  "model": "claude-sonnet-4-5-20250929",
  "max_tokens": 256,
  "stream": true,
  "messages": [
    {"role": "user", "content": "Write a product update announcement under 80 words, professional yet friendly."}
  ]
}

Tool Use

{
  "model": "claude-sonnet-4-5-20250929",
  "max_tokens": 256,
  "tools": [
    {
      "name": "get_weather",
      "description": "Get weather by city",
      "input_schema": {
        "type": "object",
        "properties": {
          "city": {"type": "string"}
        },
        "required": ["city"]
      }
    }
  ],
  "tool_choice": "auto",
  "messages": [
    {"role": "user", "content": "Check the weather in Tokyo and provide a one-sentence travel suggestion."}
  ]
}

Vision Understanding

{
  "model": "claude-sonnet-4-5-20250929",
  "max_tokens": 256,
  "messages": [
    {
      "role": "user",
      "content": [
        {"type": "text", "text": "Describe the main subject and scene in the image, and provide an alt text for it."},
        {
          "type": "image",
          "source": {
            "type": "base64",
            "media_type": "image/png",
            "data": "BASE64_IMAGE_DATA"
          }
        }
      ]
    }
  ]
}

Authorizations

x-api-key
string
header
required

API key for authentication.

Visit the API Key Management Page to get your API Key

Add to the request header:

x-api-key: YOUR_API_KEY
anthropic-version
string
header
required

API version. Example: 2025-10-01.

Body

application/json
model
string
required

Claude model name.

Example:

"claude-sonnet-4-5-20250929"

messages
object[]
required

Conversation messages in order. Example: [{"role": "user", "content": "Summarize the purpose of feature canary releases in two sentences."}].

max_tokens
integer
required

Maximum tokens to generate.

Required range: x >= 1
Example:

1024

system

System prompt for the assistant.

Example:

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

temperature
number

Sampling temperature. Higher values are more random.

Required range: 0 <= x <= 1
Example:

1

top_p
number

Nucleus sampling parameter. Higher values are more random.

Required range: 0 <= x <= 1
Example:

1

top_k
integer

Top-k sampling parameter.

Required range: x >= 1
Example:

40

stream
boolean

Enable streaming responses.

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.

tools
object[]

Tool definitions available to the model.

tool_choice

Controls tool usage behavior.

Example:

"auto"

Response

200 - application/json

Message created

code
integer
Example:

200

data
object