Skip to content

Claude Messages

POST /v1/messages with Anthropic-compatible messages, tools, and streaming.

http
POST https://api.webway.sh/v1/messages

Use this endpoint with Anthropic SDKs and Claude Code. Unlike the OpenAI-style endpoints, it uses x-api-key authentication.

Request

bash
curl https://api.webway.sh/v1/messages \
  -H "x-api-key: $WEBWAY_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-5",
    "max_tokens": 256,
    "messages": [{"role": "user", "content": "Say hello."}]
  }'
Field Type Notes
model string Required Claude model ID
messages array Required user and assistant messages
max_tokens integer Required maximum output
system string or array System prompt
tools array Anthropic-compatible tool definitions
temperature number Sampling temperature
stream boolean Streams message events when true

Response

json
{
  "id": "msg_01…",
  "type": "message",
  "role": "assistant",
  "model": "anthropic/claude-sonnet-5",
  "content": [{"type": "text", "text": "Hello!"}],
  "stop_reason": "end_turn",
  "usage": {"input_tokens": 9, "output_tokens": 2}
}

The Anthropic SDK base URL is https://api.webway.sh, without /v1; the SDK adds /v1/messages.