Inkeep Chat API

OpenAI-compatible RAG chat completions over your content.

OpenAPI Specification

inkeep-chat-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Inkeep AI & Analytics Chat API
  description: Specification of Inkeep's developer platform REST surface. The AI API is an OpenAI-compatible chat completions endpoint that performs retrieval-augmented generation (RAG) over your own content. The RAG mode (`inkeep-qa`, `inkeep-context`, `inkeep-rag`, `inkeep-base`) is selected via the OpenAI `model` field. The Analytics API logs OpenAI-compatible conversations, captures end-user feedback, and records custom interaction events for reporting in the Inkeep Portal. All endpoints authenticate with a Bearer API key issued from the Inkeep dashboard.
  termsOfService: https://inkeep.com/terms
  contact:
    name: Inkeep Support
    email: support@inkeep.com
    url: https://inkeep.com
  version: '1.0'
servers:
- url: https://api.inkeep.com/v1
  description: Inkeep developer platform base (OpenAI-compatible).
security:
- bearerAuth: []
tags:
- name: Chat
  description: OpenAI-compatible RAG chat completions over your content.
paths:
  /chat/completions:
    post:
      operationId: createChatCompletion
      tags:
      - Chat
      summary: Create a RAG chat completion (OpenAI-compatible).
      description: 'OpenAI-compatible chat completions endpoint. The `model` field selects the Inkeep RAG mode - `inkeep-qa` (customer-facing support answers), `inkeep-context` (flexible RAG with tool calling), `inkeep-rag` (raw retrieved content chunks), or `inkeep-base` (fast mode). Set `stream: true` to receive the response as Server-Sent Events.'
      parameters:
      - name: inkeep-filters
        in: header
        required: false
        description: Optional JSON object restricting retrieval to specific source IDs.
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateChatCompletionRequest'
      responses:
        '200':
          description: A chat completion (or an SSE stream when `stream` is true).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletion'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/ChatCompletionChunk'
        '401':
          description: Missing or invalid API key.
        '429':
          description: Rate limit exceeded.
components:
  schemas:
    CreateChatCompletionRequest:
      type: object
      required:
      - model
      - messages
      properties:
        model:
          type: string
          description: Selects the Inkeep RAG mode. Base modes can take an `-expert` suffix for auto model selection or be pinned to a specific LLM.
          enum:
          - inkeep-qa
          - inkeep-qa-expert
          - inkeep-context
          - inkeep-context-expert
          - inkeep-rag
          - inkeep-base
          example: inkeep-qa-expert
        messages:
          type: array
          description: A list of messages in the OpenAI chat format.
          items:
            $ref: '#/components/schemas/ChatMessage'
        stream:
          type: boolean
          default: false
          description: 'If true, the response is delivered as Server-Sent Events, each data line carrying one `chat.completion.chunk` object, terminated by `data: [DONE]`.'
        response_format:
          type: object
          description: 'For `inkeep-rag`, set `{ "type": "json_object" }` to receive the retrieved document chunks as a stringified JSON object.'
          properties:
            type:
              type: string
              enum:
              - text
              - json_object
        temperature:
          type: number
          nullable: true
          description: Sampling temperature passed through to the underlying model.
    ChatCompletionChunk:
      type: object
      description: A single streamed chunk of an SSE chat completion response.
      required:
      - id
      - object
      - created
      - model
      - choices
      properties:
        id:
          type: string
        object:
          type: string
          enum:
          - chat.completion.chunk
        created:
          type: integer
        model:
          type: string
        choices:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
              delta:
                type: object
                properties:
                  role:
                    type: string
                  content:
                    type: string
                    nullable: true
              finish_reason:
                type: string
                nullable: true
    Usage:
      type: object
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
    Citation:
      type: object
      properties:
        record:
          type: object
          description: The cited source record.
          properties:
            type:
              type: string
            url:
              type: string
              nullable: true
            title:
              type: string
              nullable: true
    ChatMessage:
      type: object
      required:
      - role
      - content
      properties:
        role:
          type: string
          enum:
          - system
          - user
          - assistant
          - tool
          description: The role of the message author.
        content:
          type: string
          description: The message content.
    ChatCompletion:
      type: object
      description: An OpenAI-compatible chat completion response.
      required:
      - id
      - object
      - created
      - model
      - choices
      properties:
        id:
          type: string
          description: Unique identifier for the chat completion.
        object:
          type: string
          enum:
          - chat.completion
          description: Object type, always `chat.completion`.
        created:
          type: integer
          description: Unix timestamp (seconds) of creation.
        model:
          type: string
          description: The Inkeep model/mode used.
        choices:
          type: array
          items:
            $ref: '#/components/schemas/ChatCompletionChoice'
        usage:
          $ref: '#/components/schemas/Usage'
    AssistantMessage:
      type: object
      required:
      - role
      - content
      properties:
        role:
          type: string
          enum:
          - assistant
        content:
          type: string
          description: The generated answer. For `inkeep-rag` this is a stringified JSON object containing the retrieved document array.
        records_cited:
          type: object
          nullable: true
          description: Citations - source records referenced in the answer, surfaced for QA and context modes.
          properties:
            citations:
              type: array
              items:
                $ref: '#/components/schemas/Citation'
    ChatCompletionChoice:
      type: object
      required:
      - index
      - message
      - finish_reason
      properties:
        index:
          type: integer
        message:
          $ref: '#/components/schemas/AssistantMessage'
        finish_reason:
          type: string
          nullable: true
          enum:
          - stop
          - length
          - tool_calls
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Inkeep API key
      description: 'Bearer token using an API key created in the Inkeep dashboard under Projects > Assistants > Create assistant > API. Set the header `Authorization: Bearer <INKEEP_API_KEY>`.'