> ## 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 an OpenAI-compatible chat completion



## OpenAPI

````yaml https://api.abliteration.ai/openapi.json post /v1/chat/completions
openapi: 3.1.0
info:
  title: Abliteration Platform API
  summary: Greenfield Abliteration backend and API gateway.
  version: 0.1.0
servers: []
security: []
paths:
  /v1/chat/completions:
    post:
      tags:
        - Chat Completions
      summary: Create an OpenAI-compatible chat completion
      operationId: createChatCompletion
      parameters:
        - name: Authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Bearer API key.
            title: Authorization
          description: Bearer API key.
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              API key alternative for Anthropic-compatible clients.
              Authorization takes precedence when both headers are present.
            title: X-Api-Key
          description: >-
            API key alternative for Anthropic-compatible clients. Authorization
            takes precedence when both headers are present.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
              description: OpenAI-compatible chat completion request.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '402':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Payment Required
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Conflict
        '415':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unsupported Media Type
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Entity
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Too Many Requests
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '501':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Implemented
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Gateway
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Service Unavailable
components:
  schemas:
    ChatCompletionRequest:
      properties:
        model:
          type: string
          minLength: 1
          title: Model
          description: Public model ID.
        messages:
          items:
            $ref: '#/components/schemas/ChatCompletionMessage'
          type: array
          minItems: 1
          title: Messages
          description: OpenAI-compatible chat messages.
        flagged_categories:
          items:
            enum:
              - harassment
              - harassment/threatening
              - hate
              - hate/threatening
              - illicit
              - illicit/violent
              - self-harm
              - self-harm/intent
              - self-harm/instructions
              - sexual
              - sexual/minors
              - violence
              - violence/graphic
          type: array
          title: Flagged Categories
          description: >-
            Abliteration safety categories to block for the latest user turn.
            Parent categories include their narrower child categories.
        stream:
          type: boolean
          title: Stream
          description: Whether to stream the response.
          default: false
        max_tokens:
          anyOf:
            - type: integer
              maximum: 999990
              minimum: 1
            - type: 'null'
          title: Max Tokens
        max_completion_tokens:
          anyOf:
            - type: integer
              maximum: 999990
              minimum: 1
            - type: 'null'
          title: Max Completion Tokens
        temperature:
          anyOf:
            - type: number
              maximum: 2
              minimum: 0
            - type: 'null'
          title: Temperature
        top_p:
          anyOf:
            - type: number
              maximum: 1
              minimum: 0
            - type: 'null'
          title: Top P
        frequency_penalty:
          anyOf:
            - type: number
              maximum: 2
              minimum: -2
            - type: 'null'
          title: Frequency Penalty
        presence_penalty:
          anyOf:
            - type: number
              maximum: 2
              minimum: -2
            - type: 'null'
          title: Presence Penalty
        logit_bias:
          anyOf:
            - additionalProperties:
                type: number
                maximum: 100
                minimum: -100
              type: object
            - type: 'null'
          title: Logit Bias
        'n':
          anyOf:
            - type: integer
              maximum: 128
              minimum: 1
            - type: 'null'
          title: 'N'
        seed:
          anyOf:
            - type: integer
            - type: 'null'
          title: Seed
        stop:
          anyOf:
            - type: string
            - items:
                type: string
              type: array
            - type: 'null'
          title: Stop
        stream_options:
          anyOf:
            - $ref: '#/components/schemas/ChatCompletionStreamOptions'
            - type: 'null'
        thinking:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Thinking
          description: >-
            Legacy compatibility toggle. The gateway translates this into
            backend-owned model-profile reasoning controls.
        reasoning:
          anyOf:
            - $ref: '#/components/schemas/ChatCompletionReasoningOptions'
            - type: 'null'
          description: >-
            OpenRouter-style reasoning controls translated by the selected model
            profile.
        reasoning_effort:
          anyOf:
            - type: string
              enum:
                - none
                - minimal
                - low
                - medium
                - high
                - xhigh
                - max
                - ultracode
            - type: 'null'
          title: Reasoning Effort
          description: OpenAI/vLLM-compatible reasoning effort control.
        include_reasoning:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Include Reasoning
          description: >-
            Whether reasoning fields may be returned when the runtime emits
            them.
        safety_identifier:
          anyOf:
            - type: string
              maxLength: 64
            - type: 'null'
          title: Safety Identifier
          description: >-
            Accepted for OpenAI compatibility, but not used for V1 abuse
            correlation and not forwarded to model runtimes.
        user:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: User
          description: >-
            Accepted for OpenAI compatibility but not forwarded to model
            runtimes.
        structuredOutputs:
          type: boolean
          title: Structuredoutputs
          description: >-
            Client structured-output capability declaration accepted for
            compatibility. It is ignored and never forwarded; use
            response_format to request an output format.
        tools:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Tools
        tool_choice:
          anyOf:
            - type: string
              enum:
                - none
                - auto
                - required
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Tool Choice
        parallel_tool_calls:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Parallel Tool Calls
        functions:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Functions
        function_call:
          anyOf:
            - type: string
              enum:
                - none
                - auto
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Function Call
        response_format:
          anyOf:
            - oneOf:
                - $ref: '#/components/schemas/ChatCompletionResponseFormatText'
                - $ref: '#/components/schemas/ChatCompletionResponseFormatJsonObject'
                - $ref: '#/components/schemas/ChatCompletionResponseFormatJsonSchema'
              discriminator:
                propertyName: type
                mapping:
                  json_object:
                    $ref: >-
                      #/components/schemas/ChatCompletionResponseFormatJsonObject
                  json_schema:
                    $ref: >-
                      #/components/schemas/ChatCompletionResponseFormatJsonSchema
                  text:
                    $ref: '#/components/schemas/ChatCompletionResponseFormatText'
            - type: 'null'
          title: Response Format
        modalities:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Modalities
        verbosity:
          anyOf:
            - type: string
              enum:
                - low
                - medium
                - high
            - type: 'null'
          title: Verbosity
        audio:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Audio
        prediction:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Prediction
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
        store:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Store
        service_tier:
          anyOf:
            - type: string
            - type: 'null'
          title: Service Tier
        prompt_cache_key:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Prompt Cache Key
        prompt_cache_retention:
          anyOf:
            - type: string
              enum:
                - in_memory
                - 24h
            - type: 'null'
          title: Prompt Cache Retention
        logprobs:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Logprobs
        top_logprobs:
          anyOf:
            - type: integer
            - type: 'null'
          title: Top Logprobs
        prompt_logprobs:
          anyOf:
            - type: integer
            - type: 'null'
          title: Prompt Logprobs
        web_search_options:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Web Search Options
        cache_salt:
          anyOf:
            - type: string
            - type: 'null'
          title: Cache Salt
      additionalProperties: false
      type: object
      required:
        - model
        - messages
      title: ChatCompletionRequest
    ChatCompletionResponse:
      properties:
        id:
          type: string
          title: Id
        object:
          type: string
          const: chat.completion
          title: Object
          default: chat.completion
        created:
          type: integer
          title: Created
        model:
          type: string
          title: Model
        choices:
          items:
            $ref: '#/components/schemas/ChatCompletionChoice'
          type: array
          title: Choices
        usage:
          anyOf:
            - $ref: '#/components/schemas/ChatCompletionUsage'
            - type: 'null'
        system_fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          title: System Fingerprint
        service_tier:
          anyOf:
            - type: string
            - type: 'null'
          title: Service Tier
      type: object
      required:
        - id
        - created
        - model
        - choices
      title: ChatCompletionResponse
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      type: object
      required:
        - error
      title: ErrorResponse
    ChatCompletionMessage:
      properties:
        role:
          type: string
          enum:
            - system
            - developer
            - user
            - assistant
            - tool
            - function
          title: Role
        content:
          anyOf:
            - type: string
            - items:
                $ref: '#/components/schemas/ChatCompletionContentPart'
              type: array
            - type: 'null'
          title: Content
        reasoning:
          anyOf:
            - type: string
            - type: 'null'
          title: Reasoning
          description: >-
            Assistant reasoning replay accepted for OpenAI-compatible
            interleaved reasoning and tool-call conversations.
        reasoning_content:
          anyOf:
            - type: string
            - type: 'null'
          title: Reasoning Content
          description: >-
            Deprecated assistant reasoning replay alias retained for SDK
            compatibility.
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        tool_call_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Call Id
        tool_calls:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Tool Calls
        function_call:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Function Call
        model_id:
          type: string
          maxLength: 256
          minLength: 1
          title: Model Id
          description: >-
            Historical assistant-model metadata accepted for Grok client
            compatibility and never forwarded to the model runtime.
      additionalProperties: false
      type: object
      required:
        - role
      title: ChatCompletionMessage
    ChatCompletionStreamOptions:
      properties:
        include_usage:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Include Usage
      additionalProperties: false
      type: object
      title: ChatCompletionStreamOptions
    ChatCompletionReasoningOptions:
      properties:
        enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Enabled
        effort:
          anyOf:
            - type: string
              enum:
                - none
                - minimal
                - low
                - medium
                - high
                - xhigh
                - max
                - ultracode
            - type: 'null'
          title: Effort
        max_tokens:
          anyOf:
            - type: integer
              maximum: 999990
              minimum: 1
            - type: 'null'
          title: Max Tokens
        exclude:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Exclude
      additionalProperties: false
      type: object
      title: ChatCompletionReasoningOptions
    ChatCompletionResponseFormatText:
      properties:
        type:
          type: string
          const: text
          title: Type
      additionalProperties: false
      type: object
      required:
        - type
      title: ChatCompletionResponseFormatText
    ChatCompletionResponseFormatJsonObject:
      properties:
        type:
          type: string
          const: json_object
          title: Type
      additionalProperties: false
      type: object
      required:
        - type
      title: ChatCompletionResponseFormatJsonObject
    ChatCompletionResponseFormatJsonSchema:
      properties:
        type:
          type: string
          const: json_schema
          title: Type
        json_schema:
          $ref: '#/components/schemas/ChatCompletionResponseFormatJsonSchemaSpec'
      additionalProperties: false
      type: object
      required:
        - type
        - json_schema
      title: ChatCompletionResponseFormatJsonSchema
    ChatCompletionChoice:
      properties:
        index:
          type: integer
          title: Index
        message:
          $ref: '#/components/schemas/ChatCompletionResponseMessage'
        logprobs:
          anyOf:
            - {}
            - type: 'null'
          title: Logprobs
        finish_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Finish Reason
      type: object
      required:
        - index
        - message
      title: ChatCompletionChoice
    ChatCompletionUsage:
      properties:
        prompt_tokens:
          type: integer
          title: Prompt Tokens
        completion_tokens:
          type: integer
          title: Completion Tokens
        total_tokens:
          type: integer
          title: Total Tokens
        prompt_tokens_details:
          anyOf:
            - additionalProperties:
                anyOf:
                  - type: integer
                  - additionalProperties:
                      type: integer
                    type: object
                  - type: 'null'
              type: object
            - type: 'null'
          title: Prompt Tokens Details
        completion_tokens_details:
          anyOf:
            - additionalProperties:
                anyOf:
                  - type: integer
                  - type: 'null'
              type: object
            - type: 'null'
          title: Completion Tokens Details
      type: object
      required:
        - prompt_tokens
        - completion_tokens
        - total_tokens
      title: ChatCompletionUsage
    ErrorDetail:
      properties:
        code:
          type: string
          title: Code
          description: Stable machine-readable error code.
        message:
          type: string
          title: Message
          description: Bounded human-readable error message.
        type:
          $ref: '#/components/schemas/ErrorType'
          description: Broad stable error category.
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
          description: Request field related to the error.
        request_id:
          type: string
          title: Request Id
          description: Server-owned canonical request ID.
        doc_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Doc Url
          description: Documentation URL for the error.
      type: object
      required:
        - code
        - message
        - type
        - request_id
      title: ErrorDetail
    ChatCompletionContentPart:
      properties:
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
          description: Structured content part type accepted by Chat Completions.
        text:
          anyOf:
            - type: string
            - type: 'null'
          title: Text
          description: Text content when `type` is `text`.
        image_url:
          anyOf:
            - {}
            - type: 'null'
          title: Image Url
          description: OpenAI-compatible image content when `type` is `image_url`.
      additionalProperties: true
      type: object
      title: ChatCompletionContentPart
      description: Parsed structured content part; Media Gateway owns strict validation.
    ChatCompletionResponseFormatJsonSchemaSpec:
      properties:
        name:
          type: string
          maxLength: 128
          minLength: 1
          title: Name
        description:
          anyOf:
            - type: string
              maxLength: 2048
            - type: 'null'
          title: Description
        schema:
          additionalProperties: true
          type: object
          title: Schema
        strict:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Strict
      additionalProperties: false
      type: object
      required:
        - name
        - schema
      title: ChatCompletionResponseFormatJsonSchemaSpec
    ChatCompletionResponseMessage:
      properties:
        role:
          type: string
          enum:
            - system
            - developer
            - user
            - assistant
            - tool
          title: Role
        content:
          anyOf:
            - type: string
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Content
        refusal:
          anyOf:
            - type: string
            - type: 'null'
          title: Refusal
        reasoning:
          anyOf:
            - type: string
            - type: 'null'
          title: Reasoning
        reasoning_content:
          anyOf:
            - type: string
            - type: 'null'
          title: Reasoning Content
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        tool_call_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Call Id
        tool_calls:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Tool Calls
        function_call:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Function Call
        annotations:
          anyOf:
            - items:
                $ref: '#/components/schemas/ChatCompletionMessageAnnotation'
              type: array
            - type: 'null'
          title: Annotations
      type: object
      required:
        - role
      title: ChatCompletionResponseMessage
    ErrorType:
      type: string
      enum:
        - auth_error
        - permission_error
        - validation_error
        - rate_limit_error
        - billing_error
        - moderation_error
        - media_error
        - not_found_error
        - conflict_error
        - provider_error
        - internal_error
      title: ErrorType
    ChatCompletionMessageAnnotation:
      properties:
        type:
          type: string
          const: url_citation
          title: Type
          default: url_citation
        url_citation:
          $ref: '#/components/schemas/ChatCompletionUrlCitation'
      type: object
      required:
        - url_citation
      title: ChatCompletionMessageAnnotation
    ChatCompletionUrlCitation:
      properties:
        url:
          type: string
          title: Url
        title:
          type: string
          title: Title
        start_index:
          type: integer
          minimum: 0
          title: Start Index
        end_index:
          type: integer
          minimum: 0
          title: End Index
      type: object
      required:
        - url
        - title
        - start_index
        - end_index
      title: ChatCompletionUrlCitation

````