Base URL
The OpenFang API runs on your local machine by default:api_listen setting in ~/.openfang/config.toml.
API Architecture
OpenFang exposes a RESTful HTTP API for managing agents, workflows, memory, and system configuration. The API is built with:- Axum web framework
- JSON request/response format
- Server-Sent Events (SSE) for streaming responses
- WebSocket for real-time agent communication
Core Resources
Agents
Spawn, manage, and communicate with AI agents
Memory
Semantic memory, knowledge graphs, and key-value storage
Workflows
Multi-agent pipelines and orchestration
Models
Model catalog, providers, and cost tracking
Channels
Connect to Telegram, Discord, Slack, and 40+ platforms
HTTP Status Codes
The API uses standard HTTP status codes:| Code | Description |
|---|---|
200 | Success |
201 | Created (resource spawned) |
400 | Bad Request (invalid input) |
401 | Unauthorized (invalid API key) |
403 | Forbidden (signature verification failed) |
404 | Not Found (agent/resource doesn’t exist) |
413 | Payload Too Large (message/manifest exceeds limit) |
429 | Too Many Requests (rate limit exceeded or quota reached) |
500 | Internal Server Error |
Rate Limiting
The API implements GCRA (Generic Cell Rate Algorithm) rate limiting:- Default limit: 30 requests per second per IP
- Response headers:
X-RateLimit-Remaining,X-RateLimit-Reset - Status: Returns
429 Too Many Requestswhen exceeded
CORS
When no API key is configured, CORS is restricted to localhost origins:http://127.0.0.1:<port>http://localhost:<port>- Common dev ports: 3000, 8080
Health Check
Version Info
System Status
Get comprehensive kernel status including agents, uptime, and configuration:Next Steps
Authentication
Secure your API with Bearer tokens
Agents
Start spawning and managing agents