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

# Messages

`POST /v1/messages`

## Request

- Base URL: `https://api.fastino.ai`
- URL: `https://api.fastino.ai/v1/messages`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/fastino-ai/apis/pioneer-inference-api/docs/v1/messages/post.ts> (a function with typed inputs; its response is checked against the schema)

Serve an Anthropic-compatible Messages request.

## Request body

- AnthropicMessagesRequest: Anthropic Messages API request format.
  - `cache_control` object, nullable
  - `include_confidence` boolean
  - `include_spans` boolean
  - `max_tokens` integer
  - `messages` AnthropicMessage[], required
    - `content` union, required
      - string
      - union[]
        - union
          - ContentBlock: A content block in Anthropic format. Supports ``text``, ``tool_use``, and ``tool_result`` block types so that tool-calling round-trips work with Anthropic SDK clients.
            - `content` union
              - …
            - `id` string, nullable
            - `input` object, nullable
            - `name` string, nullable
            - `text` string, nullable
            - `tool_use_id` string, nullable
            - `type` string
          - ImageContentBlock: Anthropic image content block.
            - `source` ImageSource, required: Anthropic image source (base64 or HTTPS URL).
              - …
            - `type` 'image'
          - object
    - `role` string, required
  - `model` string, required
  - `output_config` AnthropicOutputConfig: Anthropic output configuration passed through supported providers.
    - `effort` string, nullable
    - `format` object, nullable
    - `task_budget` object, nullable
  - `schema` union: Schema for the Fastino encoder (GLiNER models). A decoder model refuses it with a 400; send a JSON Schema in ``output_config.format`` for structured output. **Deprecated when supplied as a flat list** of entity labels; use the unified dict shape instead. Deprecated submissions emit ``Deprecation: true`` and ``Sunset: <RFC 7231 date>`` headers.
    - string[]
    - object
  - `speed` 'standard' | 'fast', nullable: Anthropic inference speed mode. ``"fast"`` opts into high output-tokens-per-second inference on supported models (e.g. the latest Opus). Fastino forwards this only to the native Anthropic upstream (with the required ``fast-mode`` beta header); Bedrock and gateway routes ignore it.
  - `stop_sequences` string[], nullable
  - `store` boolean
  - `stream` boolean
  - `system` union
    - string
    - SystemContentBlock[]
      - `cache_control` object, nullable
      - `text` string
      - `type` string
  - `task_type` string, nullable: **Deprecated.** Legacy task hint. The unified schema disambiguates the task automatically. Submitting this field emits ``Deprecation: true`` and ``Sunset: <RFC 7231 date>`` headers.
  - `temperature` number, nullable
  - `thinking` object, nullable: Opt-in Anthropic-style extended-thinking controls. Fastino does not enable thinking by default; send the Anthropic-native object: {'type': 'enabled', 'budget_tokens': N, 'display'?: 'summarized'|'omitted'} for manual mode, {'type': 'adaptive', 'effort'?: tier, 'display'?: ...} for adaptive mode (required on Opus 4.7+ / Mythos, recommended on Opus 4.6 / Sonnet 4.6), or {'type': 'disabled'} to turn thinking off on models that have it on by default. Fastino canonicalizes this into InferenceRequest.reasoning at the adapter boundary so the request routes correctly whether the upstream is Anthropic native, Bedrock, or the Vercel AI Gateway (which advertises the normalized ``reasoning`` field rather than ``thinking``). On models that require adaptive mode, Fastino auto-upgrades manual configs (mapping ``budget_tokens`` to the nearest ``effort`` tier) rather than letting the upstream return a 400.
  - `tool_choice` object, nullable
  - `tools` object[], nullable
  - `top_k` integer, nullable
  - `top_p` number, nullable

## Response `200`

Non-streaming Anthropic Messages response. When the request sets ``stream=true`` the server emits an Anthropic-shaped SSE event stream over ``text/event-stream`` instead; that stream shape is documented in the Anthropic Messages API reference.

- AnthropicMessagesResponse: Anthropic Messages API response format. ``fastino_inference_id`` is a Fastino-only identifier for the persisted inference. It mirrors ``x_fastino.inference_id`` on OpenAI-compatible chat completions and can be used with ``GET /inferences/{id}`` to poll for evaluation results. It is null when persistence did not run.
  - `content` object[], required
  - `fastino_inference_id` string, nullable
  - `id` string, required
  - `model` string, required
  - `role` string
  - `stop_reason` string, nullable
  - `stop_sequence` string, nullable
  - `type` string
  - `usage` AnthropicUsage, required: Usage statistics in Anthropic format. ``input_tokens`` is Anthropic's non-cached input contract — cached reads / writes live in the separate ``cache_read_input_tokens`` / ``cache_creation_input_tokens`` fields. Fastino mirrors the same shape on the ``/v1/messages`` wire so SDK consumers reading the fields directly stay correct.
    - `cache_creation_input_tokens` integer
    - `cache_read_input_tokens` integer
    - `input_tokens` integer
    - `output_tokens` integer
    - `server_tool_use` object, nullable
    - `service_tier` string, nullable
    - `speed` string, nullable
    - `thinking_tokens` integer, nullable

## Other responses

- `422`: Validation Error
- `425`: The model is temporarily warming. Wait the number of seconds in `Retry-After`, then retry the same request with a bounded retry policy.

## Changes

- **2026-10-12** `43d7e06a824b`: 1 info
  - added the non-success response with the status `425`
- **2026-09-28** `54da122a2879`: 5 warning, 1 info
  - removed the request property `effort`
  - removed the request property `models`
  - removed the optional property `pioneer_inference_id` from the response with the `200` status
  - removed the optional property `pioneer_routed_model` from the response with the `200` status
  - …2 more
- **2026-09-23** `620970c6f5f2`: 11 breaking, 3 warning, 44 info
  - removed the enum value `assistant` of the request property `messages/items/role`
  - removed the enum value `user` of the request property `messages/items/role`
  - removed `subschema #1, subschema #2` from the `messages/items/content` request property `oneOf` list
  - added `#/components/schemas/HTTPValidationError, #/components/schemas/AnthropicError` to the response body `oneOf` list for the response status `422`
  - …54 more

[Operation history](https://skmtc.dev/fastino-ai/apis/pioneer-inference-api/changes/v1/messages/post.md)

---

[API](https://skmtc.dev/fastino-ai/apis/pioneer-inference-api.md) - [All operations](https://skmtc.dev/fastino-ai/apis/pioneer-inference-api/llms.txt) - [OpenAPI document](https://skmtc.dev/fastino-ai/apis/pioneer-inference-api/revisions/81465e18c1d2?raw)
