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

# Create a message (Anthropic-native)



## OpenAPI

````yaml /api/openapi.json post /v1/messages
openapi: 3.1.0
info:
  title: Prism API
  version: 1.0.0
  description: >-
    OpenAI-compatible chat, embeddings, image, and asynchronous video APIs with
    Prism billing and policy controls.
servers:
  - url: https://api.prismgateway.io
    description: Production
security: []
paths:
  /v1/messages:
    post:
      tags:
        - Anthropic
      summary: Create a message (Anthropic-native)
      parameters:
        - name: x-prism-timeout-ms
          in: header
          required: false
          description: >-
            Per-attempt upstream timeout in milliseconds, clamped to the
            server's bounds. Invalid values use the default.
          schema:
            type: integer
            minimum: 1000
      responses:
        '200':
          description: >-
            Anthropic-compatible message, or an Anthropic-shaped server-sent
            event stream when `stream` is true.
          headers:
            x-prism-trace-id:
              description: Prism request ID for support and usage lookup.
              schema:
                type: string
            x-prism-provider:
              description: Catalog hub code of the provider that served the request.
              schema:
                type: string
            x-prism-upstream-model:
              description: Upstream model id the provider was asked for.
              schema:
                type: string
            x-prism-retry-count:
              description: Retries of the same provider before this response.
              schema:
                type: integer
                minimum: 0
            x-prism-attempted-fallbacks:
              description: >-
                Comma-separated hub codes that failed before the serving
                provider; absent when none.
              schema:
                type: string
            x-prism-guardrails:
              description: >-
                Guardrail checks that ran, as comma-separated `plugin:outcome`
                pairs (pass, denied, masked, logged, error, skipped). Absent
                when the organization has no rules.
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
        '400':
          description: >-
            Invalid request, a guardrail denied it (`guardrail_denied`,
            `guardrail_requires_non_streaming`), or, on the text routes, the
            prompt exceeds the model's context window
            (`context_length_exceeded`, only on deployments that enable the
            pre-check).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrismErrorResponse'
          headers:
            x-prism-trace-id:
              description: >-
                Prism request ID, present when a guardrail or the credit gate
                refused the request.
              schema:
                type: string
            x-prism-guardrails:
              description: >-
                Guardrail checks that ran, as comma-separated `plugin:outcome`
                pairs (pass, denied, masked, logged, error, skipped). Absent
                when the organization has no rules.
              schema:
                type: string
        '401':
          description: Missing, malformed, unknown, or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrismErrorResponse'
        '402':
          description: Credits, reservation, or organization budget prevents admission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrismErrorResponse'
        '403':
          description: Trial, key, model, or organization policy denied the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrismErrorResponse'
        '413':
          description: Request body exceeds the configured size limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrismErrorResponse'
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrismErrorResponse'
        '500':
          description: Prism or an upstream provider could not complete the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrismErrorResponse'
        '502':
          description: An upstream provider returned an invalid or failed response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrismErrorResponse'
        '503':
          description: The selected model or runtime is temporarily unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrismErrorResponse'
        default:
          description: The request could not be completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrismErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    PrismErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
          properties:
            type:
              type: string
            code:
              type: string
            message:
              type: string
            action:
              type: string
              enum:
                - top_up
                - contact_org_admin
            help_url:
              type: string
              format: uri
            allowed_models:
              type: array
              items:
                type: string
          additionalProperties: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Prism API key
      description: Prism API key beginning with sk-prism-

````