Skip to main content
Source Code: src/gaia/api/
The GAIA API Server implements a subset of OpenAI’s Chat Completions API with GAIA agents exposed as “models”.
Base URL: http://localhost:8080 (default) Architecture:

Endpoints

Health Check

GET /health

Check API, Lemonade LLM, and RAG component status
Response:
The endpoint returns HTTP 200 while the GAIA API process is serving requests. The top-level status is ok only when Lemonade has an LLM loaded, and degraded when the LLM component is unavailable or error. RAG reports not_configured until the document API is enabled. GAIA reads loaded-model state from Lemonade’s /api/v1/health endpoint with a 350 ms timeout. The /api/v1/models catalog is not used for readiness because downloaded models are not necessarily loaded. Example:

List Models

GET /v1/models

List available GAIA agent models
Response Schema:
Example:

Chat Completions

POST /v1/chat/completions

Create chat completion using a GAIA agent
Supports both streaming (SSE) and non-streaming responses.

Request Parameters

Message Object


Non-Streaming Response


Streaming Response


Available Models

AGENT_MODELS in src/gaia/api/agent_registry.py holds one entry, gaia, mapping to the flagship GaiaAgent. GET /v1/models returns it. To expose another agent, add an entry — see Adding New Agents below.

Error Responses

All errors follow OpenAI’s error format.

400 - Bad Request

404 - Model Not Found

500 - Internal Server Error


OpenAI API Compatibility

Supported Features

✅ Supported

  • /v1/chat/completions (streaming & non-streaming)
  • /v1/models
  • messages array with roles
  • temperature, max_tokens, top_p
  • Server-Sent Events (SSE) streaming

❌ Not Supported

  • frequency_penalty, presence_penalty
  • functions and tools parameters
  • response_format parameter
  • logprobs, n, stop parameters
  • /v1/embeddings, /v1/audio/*, /v1/images/*

Adding New Agents

1

Create Agent Class

2

Register in Agent Registry

3

Restart Server


Security

Designed for local development only. Not production-ready.
Current Implementation:
  • ⚠️ Optional API key: set GAIA_API_KEY and every chat completion must send Authorization: Bearer <key> (401 otherwise). Unset, loopback callers are allowed with a startup warning, and binding beyond loopback is refused. See Authentication.
  • ✅ CORS limited to loopback origins; add others with GAIA_API_CORS_ORIGINS. Browser requests from any other origin are refused with 403.
  • ❌ No rate limiting
For Production Deployment:
  • Set GAIA_API_KEY
  • Add rate limiting middleware
  • Use HTTPS with valid certificates

See Also

API Server Guide

Usage examples and integration guides

VSCode Integration

VSCode extension setup