---
title: "Create Message"
method: POST
path: "/v1/messages"
tags: ["messages"]
---

# Create Message

`POST /v1/messages`

Anthropic Messages API-compatible endpoint.

Supports MCP tool-use loops, sandboxed code execution, and SearXNG
web_search in both standalone mode and hybrid mode. Hybrid-mode requests
resolve credentials via the platform service and get multi-attempt
fallback across the resolved route, tool-loop requests included (fallback
applies up to the pre-lock-in point, same as chat).

## Request body

- MessagesRequest — Anthropic Messages API-compatible request. The wire fields are derived from any-llm's ``MessagesParams`` (see ``_schema_derive``) so the schema cannot silently drop a param any-llm forwards. Gateway-internal fields (``mcp_servers``, ``mcp_server_ids``, ``guardrails``, ``tools_header``, ``max_tool_iterations``) opt the request into gateway-managed MCP / sandbox / web_search / guardrails without changing the upstream wire shape. They're stripped before the request is forwarded.
  - `betas` string[], nullable
  - `cache_control` object, nullable
  - `context_management` object, nullable
  - `guardrails` GuardrailConfig[], nullable
    - `mode` 'block' | 'monitor'
    - `on` string[]
    - `on_unavailable` 'block' | 'monitor'
    - `profile` string, required
    - `url` string, nullable
    - `validate_kwargs` object
  - `max_tokens` integer, required
  - `max_tool_iterations` integer, nullable
  - `mcp_server_ids` string[], nullable
  - `mcp_servers` McpServerConfig[], nullable
    - `allowed_tools` string[], nullable
    - `authorization_token` string, nullable
    - `name` string, required
    - `purpose_hint` string, nullable
    - `url` string, required
  - `messages` object[], required
  - `metadata` object, nullable
  - `model` string, required
  - `output_format` object, nullable
  - `session_label` string, nullable — Optional caller-supplied label for cost attribution (per run, experiment, or conversation). In hybrid mode it is forwarded onto the platform usage report so spend can be sliced by session without standing up OpenTelemetry. Stripped before the request is forwarded upstream to the provider. Has no effect in standalone mode, where there is no platform to report it to.
  - `stop_sequences` string[], nullable
  - `stream` boolean
  - `system` union
    - string
    - object[]
  - `temperature` number, nullable
  - `thinking` object, nullable
  - `tool_choice` object, nullable
  - `tools` object[], nullable
  - `tools_header` string, nullable
  - `top_k` integer, nullable
  - `top_p` number, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/mozilla-ai/apis/otari.md) · [All operations](https://skmtc.net/mozilla-ai/apis/otari/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mozilla-ai/otari/revisions/527a5fbf816a/schema)
