LM Studio Anthropic Compatibility API

Anthropic-compatible messages endpoint.

OpenAPI Specification

lm-studio-anthropic-compatibility-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: LM Studio Local Server Anthropic Compatibility API
  version: 1.0.0-beta
  description: 'LM Studio runs large language models locally and exposes a local HTTP server with three families of endpoints: the native LM Studio REST API (beta) under `/api/v1`, an OpenAI-compatible surface under `/v1`, and an Anthropic-compatible surface (`/v1/messages`). The server runs on the developer''s own machine (default `http://localhost:1234`). The native `/api/v1` API adds LM Studio-specific capabilities such as MCP via API, stateful chats, model download/load/unload, generation stats (tokens-per-second, time-to-first-token), and optional API-token authentication. Endpoints and paths are transcribed from the public LM Studio developer documentation; request/response bodies follow the documented OpenAI-style message shapes.'
  contact:
    name: LM Studio
    url: https://lmstudio.ai/docs
  license:
    name: Proprietary (LM Studio application)
    url: https://lmstudio.ai/terms
  x-provenance:
    method: generated
    source: https://lmstudio.ai/docs/app/api/endpoints/rest
    generated: '2026-07-20'
servers:
- url: http://localhost:1234
  description: Default local LM Studio server (bind host/port configurable)
tags:
- name: Anthropic Compatibility
  description: Anthropic-compatible messages endpoint.
paths:
  /v1/messages:
    post:
      tags:
      - Anthropic Compatibility
      operationId: anthropicMessages
      summary: Create a message (Anthropic-compatible)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                messages:
                  type: array
                  items:
                    $ref: '#/components/schemas/Message'
                max_tokens:
                  type: integer
              required:
              - model
              - messages
              - max_tokens
      responses:
        '200':
          description: Anthropic-style message response.
components:
  schemas:
    Message:
      type: object
      properties:
        role:
          type: string
          enum:
          - system
          - user
          - assistant
          - tool
        content:
          type: string
      required:
      - role
      - content
  securitySchemes:
    ApiToken:
      type: http
      scheme: bearer
      description: Optional API token. The native `/api/v1` server can be configured to require a bearer token; by default the local server accepts unauthenticated requests from the loopback interface.