AISBFAI Service Broker Framework — AI Should Be Free
Full practical API reference for AISBF: OpenAI-compatible endpoints, provider routes, rotations, autoselect, user-scoped APIs, dashboard surfaces, and MCP automation.
AISBF exposes OpenAI-compatible global routes, direct provider routes, rotation routes, autoselect routes, user-scoped routes, dashboard management routes, and MCP automation routes. API clients normally send a bearer token.
Authorization: Bearer $AISBF_API_TOKEN
Content-Type: application/json/api/v1/* and aliases. Good for default model inventory.
/api/{provider_id}/*. Use when you intentionally want one upstream.
/api/rotations/*. Use for weighted reliability and failover.
/api/autoselect/*. Use for policy-driven model choice.
/api/user/* and /api/u/{username}/*. Preferred for hosted/multi-user apps.
/mcp and tool calls for remote agent automation.
| Method | Path | Purpose |
|---|---|---|
| GET | /health | Health check for load balancers. |
| GET | /api/models | List global models. |
| GET | /api/v1/models, /v1/models, /models | OpenAI-style model listing aliases. |
| GET | /api/v1/models/{model_id} | Fetch one model's metadata where available. |
| POST | /api/v1/chat/completions | OpenAI-compatible chat completion. |
| POST | /api/v1/completions | Legacy text completion. |
| POST | /api/v1/audio/transcriptions | Audio transcription proxy. |
| POST | /api/v1/audio/speech | Text-to-speech proxy. |
| POST | /api/v1/images/generations | Image generation proxy. |
| POST | /api/v1/embeddings | Embedding proxy. |
curl -fsS https://aisbf.example.com/api/v1/chat/completions \
-H "Authorization: Bearer $AISBF_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4.1-mini","messages":[{"role":"user","content":"Say pong"}],"max_tokens":20}'| Method | Path | Purpose |
|---|---|---|
| GET | /api/{provider_id}/models | List models for one configured provider. |
| POST | /api/{provider_id}/chat/completions | Chat through a specific provider. |
| POST | /api/{provider_id} | Catch-all provider POST for provider-specific surfaces. |
| POST | /api/audio/transcriptions, /api/audio/speech, /api/images/generations, /api/embeddings | Provider/model selected from the request body. |
| GET | /api/proxy/{content_id} | Fetch proxied content generated by upstream handlers. |
{
"id": "openai-prod",
"name": "OpenAI production",
"endpoint": "https://api.openai.com/v1",
"type": "openai",
"api_key_required": true,
"api_key": "sk-...",
"default_rate_limit": 0.5,
"default_max_request_tokens": 24000,
"default_context_size": 128000,
"default_error_cooldown": 300,
"enable_native_caching": false,
"enable_response_cache": null,
"models": [{"name":"gpt-4.1-mini","context_size":128000,"max_request_tokens":24000}]
}| Method | Path | Purpose |
|---|---|---|
| GET | /api/rotations | List global rotations. |
| GET | /api/rotations/models | List rotation model IDs. |
| POST | /api/rotations/chat/completions | Chat through a rotation by using the rotation's model_name. |
Rotation provider entries are weighted. The higher the weight, the more often that provider/model should be selected when available. AISBF tracks failures and can disable failing routes during cooldowns.
{"model":"coding-production","messages":[{"role":"user","content":"Refactor this function"}],"stream":true}| Method | Path | Purpose |
|---|---|---|
| GET | /api/autoselect | List global autoselect configs. |
| GET | /api/autoselect/models | List autoselect model IDs. |
| POST | /api/autoselect/chat/completions | Send a request to a policy model that chooses the best candidate. |
Autoselect config has model_name, description, selection_model, fallback, available_models, optional capabilities, and privacy/NSFW/semantic classification flags.
| Method | Path | Purpose |
|---|---|---|
| GET | /api/user/models | List models for the authenticated token's user. |
| GET | /api/user/providers, /api/user/rotations, /api/user/autoselects | List user-owned route inventory. |
| POST | /api/user/chat/completions | Chat using the authenticated user's route namespace. |
| GET | /api/user/{config_type}/models | List user provider/rotation/autoselect models for one config type. |
| GET | /api/u/{username}/models | List models for an explicit username namespace. |
| GET | /api/u/{username}/providers, /api/u/{username}/rotations, /api/u/{username}/autoselects | List explicit user's configured routes where token permits. |
| POST | /api/u/{username}/chat/completions | Chat in an explicit user namespace. |
| GET | /api/u/{username}/{config_type}/models | List explicit user's models by config type. |
Use model IDs such as user-provider/openai-prod/gpt-4.1-mini, user-rotation/coding-production, and user autoselect IDs consistently in app configs.
These routes are primarily browser/dashboard surfaces, not public app APIs.
/dashboard/login, /dashboard/signup, /dashboard/verify-email, /dashboard/profile, /dashboard/change-password, OAuth callbacks./dashboard/providers, /dashboard/rotations, /dashboard/autoselect, /dashboard/prompts, /dashboard/condensation, /dashboard/settings, /dashboard/users./dashboard/user/providers, /dashboard/user/rotations, /dashboard/user/autoselects, /dashboard/user/tokens./dashboard/analytics, /dashboard/rate-limits, /dashboard/response-cache/stats, /dashboard/response-cache/clear, /dashboard/tor/status./dashboard/pricing, /dashboard/subscription, /dashboard/billing, /dashboard/admin/tiers, plus /api/admin/tiers CRUD and payment settings APIs./dashboard/claude/auth/*, /dashboard/kilo/auth/*, /dashboard/codex/auth/*, /dashboard/qwen/auth/*.| Method | Path | Purpose |
|---|---|---|
| GET | /mcp | SSE-style MCP endpoint. |
| POST | /mcp | HTTP JSON-RPC MCP endpoint. |
| GET | /mcp/tools | List tools available to the token. |
| POST | /mcp/tools/call | Call an MCP tool directly. |
The source config separates MCP tokens into autoselect_tokens and fullconfig_tokens. Keep full-config tokens out of normal app runtimes.
stream:true; provider handlers normalize streaming where supported.max_request_tokens can force large requests to split into chunks; streaming falls back to non-streaming for chunked processing.AISBF is open source and also available as a hosted service. During the current testing period, hosted Pro is temporarily available as unlimited access for €2/month.