Skip to main content
Source Code: src/gaia/api/
The GAIA API Server exposes GAIA agents as “models” through an OpenAI-compatible REST API, enabling integration with VSCode extensions and other OpenAI-compatible clients.
Technical Specifications: API Server Specification

Quick Start

1

Start Lemonade Server

Start with extended context for Code agent:
lemonade-server serve --ctx-size 32768
2

Start GAIA API Server

gaia api start
3

Test the Server

curl http://localhost:8080/health

Prerequisites

GAIA Installation

Install GAIA with API support:
uv pip install -e ".[api]"
Installs FastAPI and Uvicorn required for the API server.

Lemonade Server

Must be running with sufficient context:
lemonade-server serve --ctx-size 32768
Required Models: Download Qwen3-Coder-30B-A3B-Instruct-GGUF via Lemonade’s model manager

Server Management

Start Server

Start in foreground:
gaia api start

Check Status

gaia api status

Stop Server

gaia api stop

Usage Examples

Python (OpenAI Client)

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8080/v1",
    api_key="not-needed"
)

response = client.chat.completions.create(
    model="gaia-code",
    messages=[{"role": "user", "content": "Create a REST API with Express and SQLite"}]
)

print(response.choices[0].message.content)

JavaScript/Node.js

const axios = require('axios');

async function chat(message) {
    const response = await axios.post(
        'http://localhost:8080/v1/chat/completions',
        {
            model: 'gaia-code',
            messages: [{ role: 'user', content: message }]
        }
    );
    return response.data.choices[0].message.content;
}

chat('Build me a todo app using nextjs').then(console.log);

chat('Write a Python function to calculate factorial').then(console.log);

cURL

curl -X POST http://localhost:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gaia-code",
    "messages": [{"role": "user", "content": "Write a function"}]
  }'

Available Models

gaia-code

Autonomous Python/TypeScript development agent with intelligent routing
PropertyValue
Model IDgaia-code
Context32K input / 8K output
RequirementsLemonade with --ctx-size 32768
DescriptionAutonomous development agent with planning, generation, and testing
Intelligent Routing: The gaia-code model uses GAIA’s Routing Agent to automatically detect your target programming language (Python or TypeScript) and project type based on framework mentions.→ Learn about Routing
Full specifications: API Server Specification

Troubleshooting

Check if port is in use:
lsof -i :8080
Try different port:
gaia api start --port 8888
Verify server is running:
gaia api status
Check health endpoint:
curl http://localhost:8080/health
Check Lemonade is running:
curl http://localhost:8000/health
Verify context size:
lemonade-server serve --ctx-size 32768
Enable debug mode:
gaia api start --debug

Common Issues

IssueSolution
”Model not found”Use correct model ID: gaia-code
”Agent processing failed”Ensure Lemonade is running with --ctx-size 32768
”Port already in use”Stop existing server or use --port flag
Streaming not workingEnsure "stream": true in request
More help: FAQ

VSCode Integration

VSCode Extension

Use GAIA Code directly in Visual Studio Code with the Language Model Provider extension
Quick Setup:
1

Start Servers

Start Lemonade server with extended context:
lemonade-server serve --ctx-size 32768
Start GAIA API server:
gaia api start
2

Install Extension

Build and install the GAIA VSCode extension→ VSCode Integration Guide
3

Select Model

Select GAIA models from VSCode’s model picker

Technical Documentation