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

# Messages (Anthropic-compatible)

> The Anthropic Messages API, so Claude Code and the Anthropic SDKs work with a Runcrate key and Runcrate model ids. Same billing, limits and models as chat completions. Errors use Anthropic's shape: `{type: error, error: {type, message, code}}`.



## OpenAPI

````yaml /api-reference/openapi.json post /messages
openapi: 3.1.0
info:
  title: Runcrate API
  version: 1.0.0
  summary: OpenAI-compatible inference API + GPU infrastructure API.
  description: >-
    Runcrate exposes two API surfaces. The inference API at
    `https://api.runcrate.ai/v1` is OpenAI-compatible: it accepts the standard
    OpenAI SDK with the base URL changed. The infrastructure API at
    `https://www.runcrate.ai/api/v1` manages GPU instances, jobs, persistent
    volumes, environments, SSH keys, templates, and billing. Both share a single
    `rc_live_*` API key.


    Pricing is per-token, per-image, per-second, or per-minute on the inference
    API (varies by model; see https://www.runcrate.ai/api/models/catalog for
    live rates) and per-second on GPU rentals (see
    https://www.runcrate.ai/pricing for hourly rates per GPU class).


    All infrastructure API responses are wrapped in `{ "data": ... }`. List
    responses also include a `meta` object with pagination cursors. Error
    responses use `{ "error": { "code": "...", "message": "..." } }`.
  termsOfService: https://www.runcrate.ai/terms
  contact:
    name: Runcrate
    url: https://www.runcrate.ai/contact
  license:
    name: Proprietary
    url: https://www.runcrate.ai/terms
servers:
  - url: https://api.runcrate.ai/v1
    description: Inference API (OpenAI-compatible)
  - url: https://www.runcrate.ai/api/v1
    description: >-
      Infrastructure API (instances, jobs, storage, environments, ssh-keys,
      templates, billing)
security:
  - ApiKeyAuth: []
tags:
  - name: Chat
    description: OpenAI-compatible chat completions.
  - name: Messages
    description: Anthropic-compatible Messages API, for Claude Code and the Anthropic SDKs.
  - name: Responses
    description: >-
      OpenAI-compatible Responses API, for Codex and responses.create. Nothing
      is stored.
  - name: Images
    description: Text-to-image generation.
  - name: Videos
    description: Async text-to-video and image-to-video generation.
  - name: Audio
    description: Text-to-speech and speech-to-text.
  - name: Embeddings
    description: Vector embeddings for RAG and search.
  - name: Models
    description: Model catalog discovery.
  - name: Instances
    description: GPU instance lifecycle.
  - name: Jobs
    description: >-
      Run one command on its own GPU machine. The machine stops, and billing
      ends, when the command exits.
  - name: Schedules
    description: >-
      Start an instance or a job later: once at a set time, or on a repeating
      cron schedule in your timezone.
  - name: Storage
    description: Persistent volume management.
  - name: Environments
    description: Resource isolation containers within a workspace.
  - name: Secrets
    description: >-
      Names of the secrets an environment's machines get. Values are set in the
      dashboard and never returned.
  - name: SSH Keys
    description: SSH key management for instance access.
  - name: Templates
    description: Pre-built instance images and configurations.
  - name: Billing
    description: Credit balance, transactions, usage metrics.
paths:
  /messages:
    post:
      tags:
        - Messages
      summary: Messages (Anthropic-compatible)
      description: >-
        The Anthropic Messages API, so Claude Code and the Anthropic SDKs work
        with a Runcrate key and Runcrate model ids. Same billing, limits and
        models as chat completions. Errors use Anthropic's shape: `{type: error,
        error: {type, message, code}}`.
      operationId: createMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessagesRequest'
      responses:
        '200':
          description: >-
            A message (or an SSE stream of message_start, content_block_start,
            content_block_delta, content_block_stop, message_delta, message_stop
            and ping events when stream=true).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessagesResponse'
            text/event-stream:
              schema:
                type: string
                description: Anthropic Messages stream events.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '404':
          description: >-
            Unknown model. A Claude model name (Claude Code's default when
            ANTHROPIC_MODEL is unset) is told to set ANTHROPIC_MODEL to a
            Runcrate model id.
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - ApiKeyAuth: []
        - AnthropicApiKey: []
components:
  schemas:
    MessagesRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          description: >-
            A Runcrate model id (e.g. `deepseek-ai/DeepSeek-V4.1-Flash`). Claude
            model names such as `claude-sonnet-4-5` are not Runcrate ids and
            answer 404.
        messages:
          type: array
          description: >-
            Turns with `role` (`user` or `assistant`) and `content`: a string,
            or blocks of type `text`, `image` (base64 or url source), `document`
            (text source), `tool_use` and `tool_result` (with `is_error`).
            `thinking` blocks sent back are accepted and not passed to the
            model.
          items:
            type: object
        system:
          oneOf:
            - type: string
            - type: array
              items:
                type: object
          description: A string or text blocks; `cache_control` is kept.
        max_tokens:
          type: integer
          minimum: 1
        temperature:
          type: number
        top_p:
          type: number
        top_k:
          type: integer
        stop_sequences:
          type: array
          items:
            type: string
        stream:
          type: boolean
          default: false
        tools:
          type: array
          description: Custom tools with `name`, `description` and `input_schema`.
          items:
            type: object
        tool_choice:
          type: object
          description: >-
            `{type: auto | any | tool | none}`; `tool` takes `name`;
            `disable_parallel_tool_use` is honored.
        thinking:
          type: object
          description: >-
            `{type: enabled, budget_tokens}` sets the reasoning effort: under
            4,096 low, under 16,384 medium, else high. `output_config.effort`
            takes precedence.
        metadata:
          type: object
          description: Accepted and never sent to the model.
    MessagesResponse:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - message
        role:
          type: string
          enum:
            - assistant
        model:
          type: string
        content:
          type: array
          description: >-
            `thinking`, then `text`, then `tool_use` blocks (with parsed
            `input`).
          items:
            type: object
        stop_reason:
          type: string
          enum:
            - end_turn
            - max_tokens
            - stop_sequence
            - tool_use
            - refusal
        stop_sequence:
          type: string
          nullable: true
        usage:
          type: object
          properties:
            input_tokens:
              type: integer
            output_tokens:
              type: integer
            cache_read_input_tokens:
              type: integer
            cache_creation_input_tokens:
              type: integer
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: >-
                Machine-readable error code (e.g. `validation_error`,
                `unauthorized`, `not_found`, `insufficient_credits`,
                `rate_limited`, `internal_error`).
            message:
              type: string
              description: Human-readable error message.
            details:
              type: object
              additionalProperties: true
              description: Optional structured error context.
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    PaymentRequired:
      description: >-
        Insufficient credits, the environment has reached its monthly budget
        (error code `BUDGET_REACHED`), or launches are paused while a payment on
        the workspace is disputed (`PAYMENT_HOLD`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Rate limited. Retry with exponential backoff.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: >-
        Use a Runcrate API key with the `rc_live_*` prefix as the bearer token.
        Create one at https://www.runcrate.ai/dashboard/api-keys.
    AnthropicApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        The Messages API also takes the Runcrate key in `x-api-key`, as the
        Anthropic SDKs send it.

````

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