> ## Documentation Index
> Fetch the complete documentation index at: https://aisa.one/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> - Base URLs: models `https://api.aisa.one/v1` (Gemini GenerateContent: `https://api.aisa.one/v1beta`); data APIs `https://api.aisa.one/apis/v1`. The `servers` of each operation in https://aisa.one/openapi.yaml is authoritative.
> - Auth: `Authorization: Bearer $AISA_API_KEY`. Never print, log, or commit the key.
> - MCP (preferred for agents): `https://mcp.aisa.one/mcp`, signed in with OAuth, so there is no key to paste.
> - Agent Skill: `npx skills add AIsa-team/agent-skills --skill aisa`. Fallback with the AIsa CLI: `aisa skills install aisa`.
> - Spending: docs, https://aisa.one/models, https://aisa.one/api, `/v1/models`, and MCP `search`, `list_categories`, `get_details`, `batch_quote`, and the `account` operation are free. Quote the exact calls before running them (MCP `batch_quote`, CLI `aisa quote --json`). If the quote reports `auto_execute_eligible: true`, run it unless the user set a tighter limit or asked only for a quote. Otherwise, tell the user in one message the planned calls, the quoted price, and a total USD budget for the task, then wait for approval. Direct HTTP calls follow the stricter rule at https://aisa.one/docs/get-started/cli.md#direct-http-fallback. Do not make paid calls to test availability. Full rule: https://aisa.one/llms.txt

# Claude Messages

> Create a message

Creates a Claude model response using the Anthropic-compatible Messages API. This endpoint mirrors the [Anthropic `/v1/messages` specification](https://platform.claude.com/docs/en/api/messages/create), routed through the AIsa gateway at `https://api.aisa.one/v1/messages`.

Use this endpoint when you want to call Claude models (`claude-opus-4-7`, `claude-sonnet-4-6`, `claude-haiku-4-5-20251001`, etc.) with Anthropic's native request format — including extended thinking, tool use, and prompt caching. If you prefer OpenAI-style chat completions, the same Claude models are also available via the [OpenAI Chat](https://aisa.one/docs/api-reference/chat/post_chat-completions.md) endpoint.

Authentication uses your AIsa API key as a Bearer token. See the [model catalog](https://aisa.one/docs/guides/models.md) for the full list of supported Claude variants and context windows, and [pricing](https://aisa.one/docs/guides/pricing.md#models) for per-token rates.

## Request contract

* **Method and path:** POST /messages
* **Request URL template:** `https://api.aisa.one/v1/messages`

[Complete OpenAPI definition](https://aisa.one/docs/reference-contracts/claude-messages.json)

Effective request declaration (including authentication and referenced schemas):

```json theme={null}
{
  "operationId": "createMessage",
  "method": "POST",
  "path": "/messages",
  "servers": [
    {
      "url": "https://api.aisa.one/v1"
    }
  ],
  "parameters": [],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "properties": {
            "max_tokens": {
              "description": "Maximum number of tokens to generate before stopping.",
              "example": 1024,
              "type": "integer"
            },
            "messages": {
              "description": "Conversation turns.",
              "example": [
                {
                  "content": "Hello, Claude",
                  "role": "user"
                }
              ],
              "items": {
                "properties": {
                  "content": {
                    "description": "String or array of content blocks.",
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "items": {
                          "type": "object"
                        },
                        "type": "array"
                      }
                    ]
                  },
                  "role": {
                    "enum": [
                      "user",
                      "assistant"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "role",
                  "content"
                ],
                "type": "object"
              },
              "type": "array"
            },
            "metadata": {
              "properties": {
                "user_id": {
                  "description": "External user ID (no PII).",
                  "type": "string"
                }
              },
              "type": "object"
            },
            "model": {
              "description": "Claude model identifier. Examples: claude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5-20251001.",
              "example": "claude-sonnet-4-6",
              "type": "string"
            },
            "service_tier": {
              "default": "auto",
              "enum": [
                "auto",
                "standard_only"
              ],
              "type": "string"
            },
            "stop_sequences": {
              "description": "Custom sequences that stop generation.",
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "stream": {
              "default": false,
              "description": "Enable SSE streaming.",
              "type": "boolean"
            },
            "system": {
              "description": "System prompt. String or array of text blocks.",
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "items": {
                    "type": "object"
                  },
                  "type": "array"
                }
              ]
            },
            "temperature": {
              "default": 1.0,
              "description": "Randomness. 0 = deterministic, 1 = creative.",
              "format": "float",
              "maximum": 1.0,
              "minimum": 0.0,
              "type": "number"
            },
            "thinking": {
              "description": "Enable extended thinking for complex reasoning.",
              "properties": {
                "budget_tokens": {
                  "example": 10000,
                  "type": "integer"
                },
                "display": {
                  "enum": [
                    "summarized",
                    "omitted"
                  ],
                  "type": "string"
                },
                "type": {
                  "enum": [
                    "enabled"
                  ],
                  "type": "string"
                }
              },
              "type": "object"
            },
            "tool_choice": {
              "description": "How the model uses tools.",
              "properties": {
                "disable_parallel_tool_use": {
                  "default": false,
                  "type": "boolean"
                },
                "name": {
                  "description": "Required when type is tool.",
                  "type": "string"
                },
                "type": {
                  "enum": [
                    "auto",
                    "any",
                    "tool",
                    "none"
                  ],
                  "type": "string"
                }
              },
              "type": "object"
            },
            "tools": {
              "description": "Tools the model may use.",
              "items": {
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "input_schema": {
                    "type": "object"
                  },
                  "name": {
                    "type": "string"
                  },
                  "type": {
                    "example": "custom",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "input_schema"
                ],
                "type": "object"
              },
              "type": "array"
            },
            "top_k": {
              "description": "Only sample from the top K options for each token.",
              "type": "integer"
            },
            "top_p": {
              "description": "Nucleus sampling. Use instead of temperature.",
              "format": "float",
              "type": "number"
            }
          },
          "required": [
            "model",
            "max_tokens",
            "messages"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "bearerFormat": "AISA API Key",
        "description": "Your AIsa API key as a Bearer token.",
        "scheme": "bearer",
        "type": "http"
      }
    }
  }
}
```


## OpenAPI

````yaml reference-contracts/claude-messages.json POST /messages
openapi: 3.0.3
info:
  description: >-
    Anthropic-compatible Messages API, exposed through AIsa. Send structured
    messages and generate responses using Claude models.
  title: Claude Messages API
  version: 1.0.0
servers:
  - url: https://api.aisa.one/v1
security:
  - BearerAuth: []
paths:
  /messages:
    post:
      summary: Create a message
      description: >-
        Send a structured conversation to a Claude model and receive a response.
        Compatible with the Anthropic Messages API.
      operationId: createMessage
      requestBody:
        content:
          application/json:
            schema:
              properties:
                max_tokens:
                  description: Maximum number of tokens to generate before stopping.
                  example: 1024
                  type: integer
                messages:
                  description: Conversation turns.
                  example:
                    - content: Hello, Claude
                      role: user
                  items:
                    properties:
                      content:
                        description: String or array of content blocks.
                        oneOf:
                          - type: string
                          - items:
                              type: object
                            type: array
                      role:
                        enum:
                          - user
                          - assistant
                        type: string
                    required:
                      - role
                      - content
                    type: object
                  type: array
                metadata:
                  properties:
                    user_id:
                      description: External user ID (no PII).
                      type: string
                  type: object
                model:
                  description: >-
                    Claude model identifier. Examples: claude-opus-4-7,
                    claude-sonnet-4-6, claude-haiku-4-5-20251001.
                  example: claude-sonnet-4-6
                  type: string
                service_tier:
                  default: auto
                  enum:
                    - auto
                    - standard_only
                  type: string
                stop_sequences:
                  description: Custom sequences that stop generation.
                  items:
                    type: string
                  type: array
                stream:
                  default: false
                  description: Enable SSE streaming.
                  type: boolean
                system:
                  description: System prompt. String or array of text blocks.
                  oneOf:
                    - type: string
                    - items:
                        type: object
                      type: array
                temperature:
                  default: 1
                  description: Randomness. 0 = deterministic, 1 = creative.
                  format: float
                  maximum: 1
                  minimum: 0
                  type: number
                thinking:
                  description: Enable extended thinking for complex reasoning.
                  properties:
                    budget_tokens:
                      example: 10000
                      type: integer
                    display:
                      enum:
                        - summarized
                        - omitted
                      type: string
                    type:
                      enum:
                        - enabled
                      type: string
                  type: object
                tool_choice:
                  description: How the model uses tools.
                  properties:
                    disable_parallel_tool_use:
                      default: false
                      type: boolean
                    name:
                      description: Required when type is tool.
                      type: string
                    type:
                      enum:
                        - auto
                        - any
                        - tool
                        - none
                      type: string
                  type: object
                tools:
                  description: Tools the model may use.
                  items:
                    properties:
                      description:
                        type: string
                      input_schema:
                        type: object
                      name:
                        type: string
                      type:
                        example: custom
                        type: string
                    required:
                      - name
                      - input_schema
                    type: object
                  type: array
                top_k:
                  description: Only sample from the top K options for each token.
                  type: integer
                top_p:
                  description: Nucleus sampling. Use instead of temperature.
                  format: float
                  type: number
              required:
                - model
                - max_tokens
                - messages
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  content:
                    description: Response content blocks (text, tool_use, thinking, etc.).
                    items:
                      type: object
                    type: array
                  id:
                    example: msg_024e7cf42f5d47cfa6982b5ff8b55642
                    type: string
                  model:
                    example: claude-sonnet-4-6
                    type: string
                  role:
                    example: assistant
                    type: string
                  stop_reason:
                    enum:
                      - end_turn
                      - stop_sequence
                      - max_tokens
                      - tool_use
                    type: string
                  stop_sequence:
                    nullable: true
                    type: string
                  type:
                    example: message
                    type: string
                  usage:
                    properties:
                      cache_creation_input_tokens:
                        type: integer
                      cache_read_input_tokens:
                        type: integer
                      input_tokens:
                        type: integer
                      output_tokens:
                        type: integer
                    type: object
                type: object
          description: Successful response
        '400':
          description: Invalid request parameters
        '401':
          description: Missing or invalid API key
        '429':
          description: Rate limit exceeded
        '500':
          description: Internal server error
      security:
        - BearerAuth: []
components:
  securitySchemes:
    BearerAuth:
      bearerFormat: AISA API Key
      description: Your AIsa API key as a Bearer token.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.