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

# Create chat completion

> OpenRouter/OpenAI API-compatible completions endpoint enables developers to build their own applications on sovereign agents. The completions request object is augmented with appropriate details from the agent's memory. Following the standard API format ensures compatibility with all SDKs that support OpenRouter or OpenAI API.



## OpenAPI

````yaml post /v1/chat/completions
openapi: 3.0.0
info:
  title: Agent API
  version: 1.0.0
  description: >-
    OpenRouter/OpenAI API-compatible completions endpoint enables developers to
    build their own applications on sovereign agents. The completions request
    object is augmented with appropriate details from the agent's memory.
    Following the standard API format ensures compatibility with all SDKs that
    support OpenRouter or OpenAI API
servers: []
security: []
paths:
  /v1/chat/completions:
    post:
      summary: Create chat completion
      description: >-
        OpenRouter/OpenAI API-compatible completions endpoint enables developers
        to build their own applications on sovereign agents. The completions
        request object is augmented with appropriate details from the agent's
        memory. Following the standard API format ensures compatibility with all
        SDKs that support OpenRouter or OpenAI API.
      parameters:
        - in: header
          name: organization_id
          schema:
            type: string
          description: Unique tenancy ID to select applicable memories
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - messages
              properties:
                model:
                  type: string
                  description: ID of the model to use
                  example: gpt-4o-mini
                messages:
                  type: array
                  items:
                    type: object
                    required:
                      - role
                      - content
                    properties:
                      role:
                        type: string
                        enum:
                          - user
                          - assistant
                          - system
                      content:
                        type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object

````