Source Code:
src/gaia/api/The GAIA API Server implements a subset of OpenAI’s Chat Completions API with GAIA agents exposed as “models”.
http://localhost:8080 (default)
Architecture:
Endpoints
Health Check
GET /health
Check server health status
List Models
GET /v1/models
List available GAIA agent models
Chat Completions
POST /v1/chat/completions
Create chat completion using a GAIA agent
Request Parameters
| Parameter | Type | Required | Default | Range | Description |
|---|---|---|---|---|---|
model | string | ✅ Yes | - | - | Model ID (e.g., “gaia-code”) |
messages | array | ✅ Yes | - | - | Array of message objects |
stream | boolean | No | false | - | Enable Server-Sent Events streaming |
temperature | number | No | 0.7 | 0.0 - 2.0 | Sampling temperature |
max_tokens | integer | No | - | > 0 | Maximum tokens to generate |
top_p | number | No | 1.0 | 0.0 - 1.0 | Nucleus sampling parameter |
Message Object
| Field | Type | Required | Values | Description |
|---|---|---|---|---|
role | string | ✅ Yes | "system", "user", "assistant", "tool" | Message role |
content | string | ✅ Yes | - | Message content |
tool_calls | array | No | - | Tool calls (assistant role only) |
tool_call_id | string | No | - | Tool call ID (tool role only) |
Non-Streaming Response
- Request
- Response
Streaming Response
- Request
- Response (SSE)
Available Models
gaia-code
Autonomous Code Development
Python/TypeScript development agent with intelligent routing
| Property | Value |
|---|---|
| ID | gaia-code |
| Max Input Tokens | 32768 |
| Max Output Tokens | 8192 |
| Description | Autonomous Python/TypeScript coding agent with planning, generation, and testing |
- Lemonade Server with
--ctx-size 32768 - Model:
Qwen3-Coder-30B-A3B-Instruct-GGUF
- Code generation (functions, classes, projects)
- Test generation
- Linting & formatting (pylint, Black)
- Error detection and correction
- Project scaffolding
- Architectural planning
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/modelsmessagesarray with rolestemperature,max_tokens,top_p- Server-Sent Events (SSE) streaming
❌ Not Supported
frequency_penalty,presence_penaltyfunctionsandtoolsparametersresponse_formatparameterlogprobs,n,stopparameters/v1/embeddings,/v1/audio/*,/v1/images/*
Adding New Agents
1
Create Agent Class
2
Register in Agent Registry
3
Restart Server
Security
Current Implementation:- ❌ No authentication
- ❌ No rate limiting
- ✅ CORS enabled (all origins)
- Implement API key authentication
- Add rate limiting middleware
- Configure CORS restrictions
- Use HTTPS with valid certificates
See Also
API Server Guide
Usage examples and integration guides
Code Agent
Code agent capabilities
Routing Guide
Intelligent language detection
VSCode Integration
VSCode extension setup