Comet Ollama API

Ollama provider configuration endpoints with OpenAI-compatible API support.

OpenAPI Specification

comet-ollama-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Opik REST Ollama API
  description: "The Opik REST API is currently in beta and subject to change. If you have any questions or feedback about the APIs, please reach out on GitHub: https://github.com/comet-ml/opik.\n\nAll of the methods listed in this documentation are used by either the SDK or the UI to interact with the Opik server. As a result,\nthe methods have been optimized for these use-cases in mind. If you are looking for a method that is not listed above, please create\nand issue on GitHub or raise a PR!\n\nOpik includes two main deployment options that results in slightly different API usage:\n\n- **Self-hosted Opik instance:** You will simply need to specify the URL as `http://localhost:5173/api/<endpoint_path>` or similar. This is the default option for the docs.\n- **Opik Cloud:** You will need to specify the Opik API Key and Opik Workspace in the header. The format of the header should be:\n\n  ```\n  {\n    \"Comet-Workspace\": \"your-workspace-name\",\n    \"authorization\": \"your-api-key\"\n  }\n  ```\n\n  The full payload would therefore look like:\n  \n  ```\n  curl -X GET 'https://www.comet.com/opik/api/v1/private/projects' \\\n  -H 'Accept: application/json' \\\n  -H 'Comet-Workspace: <your-workspace-name>' \\\n  -H 'authorization: <your-api-key>'\n  ```\n\n  Do take note here that the authorization header value does not include the `Bearer ` prefix. To switch to using the Opik Cloud in the documentation, you can\n  click on the edit button displayed when hovering over the `Base URL` displayed on the right hand side of the docs.\n"
  contact:
    name: Github Repository
    url: https://github.com/comet-ml/opik
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.0
servers:
- url: http://localhost:5173/api
  description: Local server
- url: https://www.comet.com/opik/api
  description: Opik Cloud
tags:
- name: Ollama
  description: Ollama provider configuration endpoints with OpenAI-compatible API support.
paths:
  /v1/private/ollama/models:
    post:
      tags:
      - Ollama
      summary: List available Ollama models
      description: Fetches the list of models available from the Ollama instance. URL may be provided with or without /v1 suffix (e.g., http://localhost:11434 or http://localhost:11434/v1). The /v1 suffix will be automatically removed for model discovery. For actual LLM inference, use the URL with /v1 suffix for OpenAI-compatible endpoints.
      operationId: listModels
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OllamaInstanceBaseUrlRequest'
        required: true
      responses:
        '200':
          description: Models retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/OllamaModel'
        '422':
          description: Unprocessable Content - Invalid URL format
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '500':
          description: Failed to fetch models
        '503':
          description: Ollama provider is disabled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /v1/private/ollama/test-connection:
    post:
      tags:
      - Ollama
      summary: Test connection to Ollama instance
      description: Validates that the provided Ollama URL is reachable. URL may be provided with or without /v1 suffix (e.g., http://localhost:11434 or http://localhost:11434/v1). The /v1 suffix will be automatically removed for connection testing. For inference, use the URL with /v1 suffix.
      operationId: testConnection
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OllamaInstanceBaseUrlRequest'
        required: true
      responses:
        '200':
          description: Connection test successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OllamaConnectionTestResponse'
        '422':
          description: Unprocessable Content - Invalid URL format
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '502':
          description: Connection test failed - Ollama instance unreachable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OllamaConnectionTestResponse'
        '503':
          description: Ollama provider is disabled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
components:
  schemas:
    OllamaInstanceBaseUrlRequest:
      required:
      - base_url
      type: object
      properties:
        base_url:
          minLength: 1
          type: string
          description: Base URL of the Ollama instance. May include /v1 suffix which will be automatically removed for connection testing. For inference, use the URL with /v1 suffix for OpenAI-compatible endpoints.
          example: http://localhost:11434/v1
        api_key:
          type: string
          description: Optional API key for authenticated Ollama instances. If provided, will be sent as Bearer token in Authorization header.
      description: Request with Ollama instance base URL for connection testing or model discovery.
    ErrorMessage:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: string
    OllamaConnectionTestResponse:
      type: object
      properties:
        connected:
          type: boolean
          description: Whether the connection was successful
        version:
          type: string
          description: Server version (returned even if connection failed or version is incompatible)
        error_message:
          type: string
          description: Error message if connection failed
      description: Response from Ollama connection test.
    OllamaModel:
      required:
      - name
      type: object
      properties:
        name:
          minLength: 1
          type: string
          description: Model name
          example: llama2
        size:
          type: integer
          description: Model size in bytes
          format: int64
        digest:
          type: string
          description: Model digest/hash
        modified_at:
          type: string
          description: Model modification date
          format: date-time
      description: Ollama model information