Skip to main content

Base URL

The OpenFang API runs on your local machine by default:
The base URL can be configured via the 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:

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 Requests when 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
With an API key configured, CORS allows the configured origins plus localhost.

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