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

# Create a message

> Creates a message using the Anthropic Messages API format. Set stream: true for server-sent events.



## OpenAPI

````yaml https://api.abliteration.ai/openapi.json post /v1/messages
openapi: 3.0.3
info:
  title: abliteration.ai API
  version: '2026-04-14'
  description: >-
    OpenAI-compatible chat completions and responses APIs for abliteration.ai,
    plus Anthropic-compatible messages and Policy Gateway endpoints for
    enforcement, config, simulations, and audits.
  termsOfService: https://abliteration.ai/terms-of-service
  contact:
    email: help@abliteration.ai
servers:
  - url: https://api.abliteration.ai
    description: Production
  - url: http://localhost:8080
    description: Local development
security: []
tags:
  - name: Chat Completions
    description: OpenAI-compatible chat completions.
  - name: Responses
    description: OpenAI-compatible Responses API.
  - name: Policy Gateway
    description: Policy-enforced chat completions.
  - name: Anthropic Messages
    description: Anthropic-compatible Messages API.
  - name: Models
    description: OpenAI-compatible model listing.
paths:
  /v1/messages:
    post:
      tags:
        - Anthropic Messages
      summary: Create a message
      description: >-
        Creates a message using the Anthropic Messages API format. Set stream:
        true for server-sent events.
      operationId: createAnthropicMessage
      parameters:
        - name: X-Free-Tier
          in: header
          description: Set to true to use the single anonymous free request.
          required: false
          schema:
            type: string
            enum:
              - 'true'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnthropicMessagesRequest'
            examples:
              basic:
                summary: Basic request
                value:
                  model: abliterated-model
                  messages:
                    - role: user
                      content: Write one sentence about Stonehenge.
                  max_tokens: 256
              streaming:
                summary: Streaming request
                value:
                  model: abliterated-model
                  messages:
                    - role: user
                      content: Stream a short greeting.
                  max_tokens: 128
                  stream: true
              multiTurn:
                summary: Multi-turn conversation
                value:
                  model: abliterated-model
                  messages:
                    - role: user
                      content: What is abliteration?
                    - role: assistant
                      content: >-
                        Abliteration removes refusal vectors from language
                        models.
                    - role: user
                      content: How does it work?
                  max_tokens: 1024
              withSystem:
                summary: With system prompt
                value:
                  model: abliterated-model
                  system: You are a helpful coding assistant.
                  messages:
                    - role: user
                      content: Write a Python function that reverses a string.
                  max_tokens: 512
                  temperature: 0.3
      responses:
        '200':
          description: Message response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicMessagesResponse'
              examples:
                success:
                  summary: 200 OK
                  value:
                    id: msg_01XFDUDYJgAACzvnptvVoYEL
                    type: message
                    role: assistant
                    model: abliterated-model
                    content:
                      - type: text
                        text: >-
                          Stonehenge is a prehistoric monument in Wiltshire,
                          England, consisting of a ring of standing stones
                          dating back to around 3000 BCE.
                    stop_reason: end_turn
                    stop_sequence: null
                    usage:
                      input_tokens: 14
                      output_tokens: 32
                    remaining_credits: 487
                    estimated_credits_used: 1
                    estimated_cost_usd: 0.00023
            text/event-stream:
              schema:
                type: string
                description: >-
                  Streaming response as server-sent events following the
                  Anthropic streaming protocol.
              examples:
                stream:
                  summary: SSE stream
                  value: >
                    event: message_start

                    data:
                    {"type":"message_start","message":{"id":"msg_01XFDUDYJgAACzvnptvVoYEL","type":"message","role":"assistant","model":"abliterated-model","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":14,"output_tokens":0}}}


                    event: content_block_start

                    data:
                    {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}


                    event: content_block_delta

                    data:
                    {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello!"}}


                    event: content_block_stop

                    data: {"type":"content_block_stop","index":0}


                    event: message_delta

                    data:
                    {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"output_tokens":2}}


                    event: message_stop

                    data: {"type":"message_stop"}
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicErrorResponse'
              examples:
                invalidRequest:
                  summary: Invalid request body
                  value:
                    type: error
                    error:
                      type: invalid_request_error
                      message: Invalid request body.
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicErrorResponse'
              examples:
                unauthorized:
                  summary: Missing or invalid credentials
                  value:
                    type: error
                    error:
                      type: authentication_error
                      message: Sign up to continue after your free request.
        '402':
          description: Insufficient credits
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicErrorResponse'
              examples:
                noCredits:
                  summary: Credit balance exhausted
                  value:
                    type: error
                    error:
                      type: permission_error
                      message: Insufficient credits. Top up to keep chatting.
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: Upstream unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicErrorResponse'
        '504':
          description: Gateway timeout
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicErrorResponse'
      security:
        - BearerAuth: []
        - AnthropicApiKeyAuth: []
components:
  schemas:
    AnthropicMessagesRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          description: Model id (e.g. abliterated-model).
        messages:
          type: array
          description: >-
            Non-empty array of message objects. Each has role (user or
            assistant) and content (string or content-block array).
          items:
            $ref: '#/components/schemas/AnthropicMessage'
          minItems: 1
        max_tokens:
          type: integer
          minimum: 1
          description: Maximum number of tokens to generate.
        temperature:
          type: number
          minimum: 0
          maximum: 2
          description: Sampling temperature.
        stream:
          type: boolean
          default: false
          description: Enable Server-Sent Events streaming.
        system:
          description: System prompt. Can be a string or an array of content blocks.
          oneOf:
            - type: string
            - type: array
              items:
                type: object
        flagged_categories:
          type: array
          description: >-
            Optional moderation categories to block. Supported: harassment,
            hate, illicit, sexual. Self-harm and sexual/minors are always
            blocked.
          items:
            type: string
    AnthropicMessagesResponse:
      type: object
      required:
        - id
        - type
        - role
        - model
        - content
      properties:
        id:
          type: string
          description: Unique message id (e.g. msg_01XFDUDYJgAACzvnptvVoYEL).
        type:
          type: string
          enum:
            - message
        role:
          type: string
          enum:
            - assistant
        model:
          type: string
        content:
          type: array
          items:
            $ref: '#/components/schemas/AnthropicContentBlock'
        stop_reason:
          type: string
          nullable: true
          description: Reason the model stopped generating (e.g. end_turn, max_tokens).
        stop_sequence:
          type: string
          nullable: true
        usage:
          $ref: '#/components/schemas/AnthropicUsage'
        remaining_credits:
          type: integer
          nullable: true
          description: User's remaining credit balance after this call.
        estimated_credits_used:
          type: integer
          description: Credits consumed by this call.
        estimated_cost_usd:
          type: number
          description: Estimated cost in USD.
    AnthropicErrorResponse:
      type: object
      required:
        - type
        - error
      properties:
        type:
          type: string
          enum:
            - error
        error:
          type: object
          required:
            - type
            - message
          properties:
            type:
              type: string
              description: >-
                Error type (e.g. invalid_request_error, authentication_error,
                permission_error, api_error).
            message:
              type: string
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        code:
          type: string
    AnthropicMessage:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
            - assistant
        content:
          description: Text string or array of content blocks (text, image).
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/AnthropicContentBlock'
    AnthropicContentBlock:
      oneOf:
        - type: object
          required:
            - type
            - text
          properties:
            type:
              type: string
              enum:
                - text
            text:
              type: string
        - type: object
          required:
            - type
            - source
          properties:
            type:
              type: string
              enum:
                - image
            source:
              type: object
              required:
                - type
                - media_type
                - data
              properties:
                type:
                  type: string
                  enum:
                    - base64
                media_type:
                  type: string
                data:
                  type: string
    AnthropicUsage:
      type: object
      properties:
        input_tokens:
          type: integer
          description: Number of input tokens.
        output_tokens:
          type: integer
          description: Number of output tokens.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Use a JWT or abliteration.ai API key as a Bearer token.
    AnthropicApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Anthropic SDK compatibility. Use an abliteration.ai API key starting
        with ak_.

````