---
title: "Interact with various LLMs models with Anthropic compatible"
method: POST
path: "/v1/messages"
tags: ["AIs"]
---

# Interact with various LLMs models with Anthropic compatible

`POST /v1/messages`

## Request body

- object
  - `model` string — The LLM model of the AI, see /v1/models for more
  - `messages` object[]
    - `role` 'user' | 'assistant' | 'system' — The role of the entity in the conversation
    - `content` string — The actual message content
  - `max_tokens` number — max_tokens field required

## Response `200`

Success - AI response retrieved successfully.

- object
  - `content` object[]
    - `type` string — The type of the entity in the conversation
    - `content` string — The actual message content
  - `stop_reason` string — Indicates why the response was stopped, e.g., 'end_turn' for normal completion
  - `stop_sequence` string — Indicates why the response was stopped, e.g., 'end_turn' for normal completion
  - `usage` object
    - `input_tokens` integer — Count tokens in the prompt/message
    - `output_tokens` integer — Count tokens on completion/response

## Other responses

- `400` — Bad Request - Invalid or missing parameters.
- `500` — Server Error - Unable to process the request.

---

[API](https://skmtc.dev/paxsenix/apis/paxsenix-api.md) · [All operations](https://skmtc.dev/paxsenix/apis/paxsenix-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/paxsenix/paxsenix-api/revisions/a09b8775685e/schema)
