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

# Create Anthropic-compatible message

> Anthropic-compatible Messages invocation. Authorization Bearer is recommended; x-api-key is accepted only for SDK compatibility.



## OpenAPI

````yaml /openapi/v0-api/public.openapi.yaml post /anthropic/v1/messages
openapi: 3.1.0
info:
  title: MyRouter V0 Public API
  version: 0.1.0
  description: >-
    Customer-facing MyRouter V0 API. Core paths follow OpenRouter where
    possible; billing is a MyRouter extension using Stripe-style resource
    naming.
  license:
    name: Proprietary
    identifier: LicenseRef-Proprietary
  x-platform-contract-commit: 56b047ef2c076be151e090aa4e2f5e974180ea14
  x-phase-sources:
    - phase1/2026-05-28-source-inventory.md
    - phase8/2026-05-28-public-v0-api-review-matrix.md
servers:
  - url: https://api.myrouter.example
    description: Placeholder until public environment is finalized.
security:
  - bearerApiKey: []
paths:
  /anthropic/v1/messages:
    post:
      tags:
        - Runtime
      summary: Create Anthropic-compatible message
      description: >-
        Anthropic-compatible Messages invocation. Authorization Bearer is
        recommended; x-api-key is accepted only for SDK compatibility.
      operationId: createAnthropicMessage
      parameters:
        - $ref: '#/components/parameters/RequestIdHeader'
        - name: anthropic-version
          in: header
          required: true
          schema:
            type: string
          description: Anthropic API version.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
        - name: x-api-key
          in: header
          required: false
          schema:
            type: string
          description: >-
            Anthropic SDK-compatible API key header. Prefer Authorization:
            Bearer for MyRouter.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnthropicMessageRequest'
      responses:
        '200':
          description: Create Anthropic-compatible message response.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicMessageResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    RequestIdHeader:
      name: x-request-id
      in: header
      required: false
      schema:
        type: string
      description: Optional caller request id.
      x-source: Platform error contracts and product API convention
      x-owner: shared
      x-status: product-to-build
      x-platform-dependency: Platform runtime errors and product API errors
      x-rationale: Every API needs a stable supportable error envelope with request id.
  schemas:
    AnthropicMessageRequest:
      type: object
      additionalProperties: true
      required:
        - model
        - messages
        - max_tokens
      properties:
        model:
          type: string
          description: Public MyRouter model id exposed through Anthropic-compatible API.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
        messages:
          type: array
          items:
            $ref: '#/components/schemas/AnthropicInputMessage'
          description: Anthropic-style input messages.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
          minItems: 1
        max_tokens:
          type: integer
          description: Maximum output tokens.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
          minimum: 1
        stream:
          type: boolean
          description: Whether to stream SSE events.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
        system:
          oneOf:
            - type: string
            - type: array
              items:
                type: object
                additionalProperties: true
          description: System prompt content.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
        stop_sequences:
          type: array
          items:
            type: string
          description: Stop sequences.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
        temperature:
          type: number
          description: Sampling temperature.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
        top_p:
          type: number
          description: Nucleus sampling value.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
        top_k:
          type: integer
          description: Top-k sampling value.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
        tools:
          type: array
          items:
            type: object
            additionalProperties: true
          description: Anthropic tool definitions.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
        tool_choice:
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
          description: Tool choice.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
        metadata:
          type: object
          description: Customer metadata.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
          additionalProperties: true
      x-source: >-
        Anthropic Messages API plus platform Anthropic-compatible
        invocation@56b047e
      x-owner: platform
      x-status: current-platform-supported
      x-platform-dependency: Platform Anthropic-compatible messages
      x-rationale: >-
        Anthropic namespace is a compatibility extension; product recommends
        Authorization Bearer and documents x-api-key only for SDK compatibility.
    AnthropicMessageResponse:
      type: object
      additionalProperties: false
      required:
        - id
        - type
        - role
        - content
        - model
      properties:
        id:
          type: string
          description: Message id.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
        type:
          type: string
          description: Anthropic response type.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
        role:
          type: string
          description: Assistant role.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
        content:
          type: array
          items:
            type: object
            additionalProperties: true
          description: Output content blocks.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
        model:
          type: string
          description: Public MyRouter model id.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
        stop_reason:
          type: string
          description: Why generation stopped.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
        usage:
          $ref: '#/components/schemas/TokenUsage'
          description: Runtime usage facts, not invoice-grade charge evidence.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
      x-source: >-
        Anthropic Messages API plus platform Anthropic-compatible
        invocation@56b047e
      x-owner: platform
      x-status: current-platform-supported
      x-platform-dependency: Platform Anthropic-compatible messages
      x-rationale: >-
        Anthropic namespace is a compatibility extension; product recommends
        Authorization Bearer and documents x-api-key only for SDK compatibility.
    AnthropicInputMessage:
      type: object
      additionalProperties: false
      required:
        - role
        - content
      properties:
        role:
          type: string
          description: Anthropic message role.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
          enum:
            - user
            - assistant
        content:
          oneOf:
            - type: string
            - type: array
              items:
                type: object
                additionalProperties: true
          description: Message content.
          x-source: >-
            Anthropic Messages API plus platform Anthropic-compatible
            invocation@56b047e
          x-owner: platform
          x-status: current-platform-supported
          x-platform-dependency: Platform Anthropic-compatible messages
          x-rationale: >-
            Anthropic namespace is a compatibility extension; product recommends
            Authorization Bearer and documents x-api-key only for SDK
            compatibility.
      x-source: >-
        Anthropic Messages API plus platform Anthropic-compatible
        invocation@56b047e
      x-owner: platform
      x-status: current-platform-supported
      x-platform-dependency: Platform Anthropic-compatible messages
      x-rationale: >-
        Anthropic namespace is a compatibility extension; product recommends
        Authorization Bearer and documents x-api-key only for SDK compatibility.
    TokenUsage:
      type: object
      additionalProperties: false
      required: []
      properties:
        input_tokens:
          type: integer
          description: Input token count when available.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
          minimum: 0
        output_tokens:
          type: integer
          description: Output token count when available.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
          minimum: 0
        total_tokens:
          type: integer
          description: Total token count when available.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
          minimum: 0
        cache_read_tokens:
          type: integer
          description: Cache-read token count when available.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
          minimum: 0
        cache_write_tokens:
          type: integer
          description: Cache-write token count when available.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
          minimum: 0
        reasoning_tokens:
          type: integer
          description: Reasoning token count when available.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
          minimum: 0
      x-source: >-
        OpenAI/Anthropic usage report pattern plus June 4 platform usage
        aggregation
      x-owner: shared
      x-status: june-4-dependent
      x-platform-dependency: Platform usage aggregation by API key/account with 5-minute granularity
      x-rationale: Usage reports expose physical meters only, not customer charge amounts.
    ErrorEnvelope:
      type: object
      additionalProperties: false
      required:
        - error
        - request_id
      properties:
        error:
          type: object
          additionalProperties: false
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable machine-readable error code.
              x-source: Platform error contracts and product API convention
              x-owner: shared
              x-status: product-to-build
              x-platform-dependency: Platform runtime errors and product API errors
              x-rationale: >-
                Every API needs a stable supportable error envelope with request
                id.
            message:
              type: string
              description: Human-readable error message.
              x-source: Platform error contracts and product API convention
              x-owner: shared
              x-status: product-to-build
              x-platform-dependency: Platform runtime errors and product API errors
              x-rationale: >-
                Every API needs a stable supportable error envelope with request
                id.
            type:
              type: string
              description: Error category.
              x-source: Platform error contracts and product API convention
              x-owner: shared
              x-status: product-to-build
              x-platform-dependency: Platform runtime errors and product API errors
              x-rationale: >-
                Every API needs a stable supportable error envelope with request
                id.
          x-source: Platform error contracts and product API convention
          x-owner: shared
          x-status: product-to-build
          x-platform-dependency: Platform runtime errors and product API errors
          x-rationale: Every API needs a stable supportable error envelope with request id.
        request_id:
          type: string
          description: Effective request id for support.
          x-source: Platform error contracts and product API convention
          x-owner: shared
          x-status: product-to-build
          x-platform-dependency: Platform runtime errors and product API errors
          x-rationale: Every API needs a stable supportable error envelope with request id.
      x-source: Platform error contracts and product API convention
      x-owner: shared
      x-status: product-to-build
      x-platform-dependency: Platform runtime errors and product API errors
      x-rationale: Every API needs a stable supportable error envelope with request id.
  headers:
    RequestId:
      schema:
        type: string
      description: Effective request id.
      x-source: Platform error contracts and product API convention
      x-owner: shared
      x-status: product-to-build
      x-platform-dependency: Platform runtime errors and product API errors
      x-rationale: Every API needs a stable supportable error envelope with request id.
  responses:
    BadRequest:
      description: Invalid request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Unauthorized:
      description: Missing or invalid authentication.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Forbidden:
      description: Authenticated principal is not allowed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    RateLimited:
      description: Rate limit exceeded.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    InternalError:
      description: Internal error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    bearerApiKey:
      type: http
      scheme: bearer
      bearerFormat: MyRouter API key

````