---
title: "Messages (Anthropic-compatible)"
method: POST
path: "/v1/messages"
tags: ["anthropic-compat"]
---

# Messages (Anthropic-compatible)

`POST /v1/messages`

Anthropic Messages API compatible endpoint. Works with the Anthropic Python SDK by setting `base_url="https://api.pioneer.ai"`. Set `stream=true` for SSE streaming in Anthropic event format. Extended-thinking is supported via the `thinking` field.

## Request body

- AnthropicMessagesRequest
  - `model` string, required — Model ID (e.g. `claude-sonnet-4-6`, `claude-opus-4-8`).
  - `messages` object[], required
    - `role` 'user' | 'assistant', required
    - `content` union, required
      - string
      - object[]
  - `max_tokens` integer, required
  - `system` union — System prompt. Accepts a plain string or list of Anthropic system content blocks (with cache_control support).
    - string
    - object[]
  - `temperature` number
  - `top_p` number
  - `top_k` integer
  - `stream` boolean
  - `stop_sequences` string[]
  - `tools` object[]
  - `tool_choice` object
  - `thinking` object — Anthropic-native extended-thinking config. Examples: `{"type": "enabled", "budget_tokens": 8000}` for manual mode; `{"type": "adaptive", "effort": "high"}` for adaptive mode (required on Opus 4.7+); `{"type": "disabled"}` to turn off. Pioneer auto-upgrades manual configs on models that require adaptive.
  - `store` boolean — Persist to inference history. Set false to opt out.
  - `schema` union — Pioneer encoder extension: extraction schema dict.
    - object
    - string[]

## Response `200`

Message response. `application/json` when `stream=false`, `text/event-stream` SSE (Anthropic event format) when `stream=true`.

- AnthropicMessagesResponse
  - `id` string, required
  - `type` 'message', required
  - `role` 'assistant', required
  - `content` object[], required
    - `type` 'text' | 'tool_use' | 'thinking'
    - `text` string
  - `model` string, required
  - `stop_reason` 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use', required
  - `stop_sequence` string
  - `usage` object, required
    - `input_tokens` integer
    - `output_tokens` integer
    - `cache_read_input_tokens` integer
    - `cache_creation_input_tokens` integer

## Other responses

- `401` — Missing or invalid API key.
- `402` — Insufficient credits or no active billing plan.
- `404` — Model ID not found or not yet deployed.
- `422` — Request body failed schema validation.
- `429` — Rate limit exceeded. Retry after the duration in the `Retry-After` response header.

---

[API](https://skmtc.net/fastino-ai/apis/pioneer-inference-api.md) · [All operations](https://skmtc.net/fastino-ai/apis/pioneer-inference-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/fastino-ai/pioneer-inference-api/revisions/2541b0de636c/schema)
