OpenAPI docs

Integration reference

Third-party applications can authenticate with a bearer API key and send OpenAI-style chat requests to the local gateway.

Quick start

POST /api/v1/chat/completions
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

The current MVP supports non-streaming chat completions and usage accounting. Once Ollama is installed locally, sync models in the admin dashboard and start making requests.

OpenAPI overview

The routes below are rendered directly from the application's generated OpenAPI definition.

get/api/v1/models

List admin-enabled local models

Public route

Responses

200Available models
GET /api/v1/models
Host: http://localhost:3000
post/api/v1/chat/completions

Run a chat completion against an admin-enabled Ollama model

Bearer auth required

Responses

200OpenAI-style chat completion response
401Missing or invalid API key
429Monthly quota exceeded
503Ollama is unavailable at http://127.0.0.1:11434
POST /api/v1/chat/completions
Host: http://localhost:3000
Authorization: Bearer YOUR_API_KEY

Raw OpenAPI snapshot

{
  "openapi": "3.1.0",
  "info": {
    "title": "TSLHostedAI API",
    "version": "0.1.0",
    "description": "OpenAI-style local gateway for admin-provisioned self-hosted models routed through Ollama."
  },
  "servers": [],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key"
      }
    },
    "schemas": {
      "ChatCompletionRequest": {
        "type": "object",
        "required": [
          "messages"
        ],
        "properties": {
          "model": {
            "type": "string",
            "example": "deepseek-r1:1.5b"
          },
          "stream": {
            "type": "boolean",
            "default": false
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "role",
                "content"
              ],
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "system",
                    "user",
                    "assistant"
                  ]
                },
                "content": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "paths": {
    "/api/v1/models": {
      "get": {
        "summary": "List admin-enabled local models",
        "responses": {
          "200": {
            "description": "Available models"
          }
        }
      }
    },
    "/api/v1/chat/completions": {
      "post": {
        "summary": "Run a chat completion against an admin-enabled Ollama model",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OpenAI-style chat completion response"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "429": {
            "description": "Monthly quota exceeded"
          },
          "503": {
            "description": "Ollama is unavailable at http://127.0.0.1:11434"
          }
        }
      }
    }
  }
}