User Guide
General Model

Claude Messages

Compatible with Claude Messages API; supports system, tools, image content, and streaming events; successful responses follow the original Claude protocol.

  • Route: POST /v1/messages
  • Protocol shape aligned with Claude Messages API
  • Successful responses are Claude original JSON or Claude original SSE, without wrapping code / data

Request Example

curl https://api.magickapi.com/v1/messages \
  -H "x-api-key: YOUR_API_KEY" \
  -H "anthropic-version: 2025-10-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-5-20250929",
    "system": "You are a professional AI assistant.",
    "max_tokens": 1024,
    "messages": [
      {
        "role": "user",
        "content": "Hello, world"
      }
    ]
  }'

Successful Response Example

{
  "id": "msg_013Zva2CMHLNnXjNJJKqJ2EF",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Hello! I am Claude."
    }
  ],
  "model": "claude-sonnet-4-5-20250929",
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 12,
    "output_tokens": 18
  }
}

Error Response Example

{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "Invalid request parameters"
  }
}

Authentication

x-api-key

  • Type: string
  • Required: Yes

anthropic-version

  • Type: string

  • Required: Yes

    It is recommended to be sent normally by Claude SDK or Claude Code following the Anthropic protocol.

Common Parameters

model

  • Type: string
  • Required: Yes

system

  • Type: string | array

    Claude's system prompt is an independent parameter and is not placed inside messages.

messages

  • Type: array

  • Required: Yes

    Supports user / assistant roles.

max_tokens

  • Type: integer

stream

  • Type: boolean

    When set to true, returns Claude original SSE event stream.

tools / tool_choice

  • Type: array / object

    The current project transparently passes tool-related fields according to the Claude native protocol.

Multimodal and Extended Capabilities

  • Text content: Supported
  • Image content: Supported
  • Tool calling: Supported
  • Streaming response: Supported
  • thinking / output_config / context_management: The project DTO already supports these; they can be sent according to Claude protocol fields.

Compatibility Notes

  • If you are using Claude Code, please refer to "Development Tools / Claude Code Usage Guide" first.

Last updated on

On this page