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

# Create message

> Anthropic-compatible messages. Point an Anthropic SDK at your Kubox base URL and it works unchanged, including streaming. Authenticate with `x-api-key` (what the SDKs send) or a bearer token — the same Kubox key either way. Usage is billed per token against your credit balance, stitched from the `message_start` and `message_delta` events of the stream. Errors use Anthropic’s envelope, not OpenAI’s.



## OpenAPI

````yaml POST /v1/messages
openapi: 3.1.0
info:
  title: Kubox API
  description: >-
    OpenAI-compatible AI endpoints on sovereign Australian infrastructure.
    Authenticate with your `kbx_live_…` API key as a Bearer token. This
    reference is generated from the gateway source code.
  version: 1.0.0
servers:
  - url: https://api.kubox.cloud
    description: Kubox cloud
security:
  - bearerAuth: []
paths:
  /v1/messages:
    post:
      summary: Create message
      description: >-
        Anthropic-compatible messages. Point an Anthropic SDK at your Kubox base
        URL and it works unchanged, including streaming. Authenticate with
        `x-api-key` (what the SDKs send) or a bearer token — the same Kubox key
        either way. Usage is billed per token against your credit balance,
        stitched from the `message_start` and `message_delta` events of the
        stream. Errors use Anthropic’s envelope, not OpenAI’s.
      operationId: createMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - messages
              additionalProperties: true
              properties:
                model:
                  type: string
                  description: A model id from `GET /v1/models`.
                  example: coder
                messages:
                  type: array
                  minItems: 1
                  items:
                    type: object
                    additionalProperties: true
                  description: Anthropic message objects, passed through as sent.
                stream:
                  type: boolean
                  description: When true, the response streams as server-sent events.
                  default: false
      responses:
        '200':
          description: >-
            The message. JSON when `stream` is false; `text/event-stream` of
            Anthropic events (`message_start`, `content_block_delta`,
            `message_delta`, `message_stop`) when true.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
            text/event-stream:
              schema:
                type: string
                description: SSE stream of Anthropic message events.
        '400':
          description: Invalid request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicError'
              example:
                type: error
                error:
                  type: invalid_request_error
                  message: Invalid request body.
        '401':
          description: Incorrect API key provided.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicError'
              example:
                type: error
                error:
                  type: authentication_error
                  message: Incorrect API key provided.
        '402':
          description: Insufficient credits. Top up to continue.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicError'
              example:
                type: error
                error:
                  type: insufficient_quota
                  message: Insufficient credits. Top up to continue.
        '404':
          description: The model `<id>` does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicError'
              example:
                type: error
                error:
                  type: not_found_error
                  message: The model `<id>` does not exist.
        '502':
          description: The provider rejected the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicError'
              example:
                type: error
                error:
                  type: api_error
                  message: The provider rejected the request.
      security:
        - apiKeyAuth: []
        - bearerAuth: []
components:
  schemas:
    AnthropicError:
      type: object
      properties:
        type:
          type: string
          example: error
        error:
          type: object
          properties:
            type:
              type: string
              example: invalid_request_error
            message:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Your Kubox API key (`kbx_live_…`) from the console.
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Your Kubox API key (`kbx_live_…`), as sent by Anthropic SDKs.

````

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