Unified API for multiple AI providers | OpenAI β’ Claude β’ Discord Integration
OpenOKAPI is an open-source project designed to create a unified platform for interacting with multiple AI systems through a single, consistent API.
The goal of the project is to integrate various AI providers and chat platforms into one ecosystem, allowing users to communicate with different AI models without dealing with separate APIs and tools.
OpenOKAPI acts as a bridge between users and multiple AI platforms.
The workflow is simple:
- The user sends a request to the OpenOKAPI server
- The server selects the appropriate AI integration
- Data is forwarded using the corresponding API key
- The response is returned in a standardized format
This approach makes it easy to switch between AI providers and manage everything from one place.
Planned and currently developed features include:
- π Integration with multiple AI platforms
- π§© Modular architecture for easy extension
- π» CLI interface for management and interaction
- π Request history and usage stats
- π§© Saved prompt profiles with reusable templates and variables
- β‘ Response cache with history replay
- π° Cost and token analytics across providers
- π¬ Multi-turn chat threads with context memory
- π Per-model input/output pricing rules
- π§ Automatic chat context compression with summaries
- π§± 35 capability toggles for enterprise-grade control
- π Integrations hub (webhook, Slack, Telegram, Git providers, Jira, Notion, Teams, PagerDuty)
- π§ Smart router control plane (cost/speed/reliability/balanced)
- π‘οΈ Guardrails with blocklist and regex redaction
- π§ͺ Built-in response evaluation harness
- π³ Budget governance (daily/monthly/per-request)
- π Scheduler with
cron,every, andatjob types - β€οΈ Heartbeat engine for periodic autonomous runs
- πͺ Event hooks for lifecycle and platform events
- π Standing orders for persistent behavior constraints
- π Task Flow orchestration for multi-step durable runs
- π§Ύ Background task ledger with audit, cancellation, notify policy, and maintenance sweep
- π©Ί Deep runtime status module (
status --deep) with aggregated health snapshot - π¨ Alerts module for active operational findings (
alerts) - π Incidents registry with acknowledge/resolve workflow (
incidents) - π οΈ Maintenance windows with alert/incident silencing controls (
maintenance-windows) - π¦ Escalation rules with cooldown and auto-incident policy (
escalations) - π Web dashboard for configuration
- π€ Integrations with communication platforms:
- Discord
- π€ AI Platforms:
- OpenAI
- Claude
- Ollama
- π Secure API key management
- π‘ Self-hosted OpenOKAPI server
OpenOKAPI includes a built-in HTTP/WebSocket API server that provides remote access to all AI integrations.
- π Secure Authentication - API key validation and User-Agent verification
- π RESTful API - Mirror of all CLI commands as HTTP endpoints
- π WebSocket Support - Real-time bidirectional communication
- π Request History - Local audit trail with recent activity and summary stats
- βοΈ Configurable - Custom port via environment variable (default: 16273)
# Generate API key
openokapi generate api-key
# Start Gateway server
openokapi gateway
# Or specify custom port
openokapi gateway --port 8080
# Show local request history
openokapi history --stats --limit 10
# Optional: set fallback provider for failover
openokapi config --set-fallback claude
# Run batch requests from JSON file
openokapi batch --file ./requests.json --concurrency 4Open the built-in panel at http://localhost:16273/panel after starting gateway.
Automation reference: see docs/AUTOMATION.md.
Claude:
GET /api/claude/status- Get configuration statusPOST /api/claude/ask- Send prompt (body:{prompt, model?})POST /api/claude/stream- Stream response as SSE (body:{prompt, model?})
OpenAI:
GET /api/openai/status- Get configuration statusPOST /api/openai/ask- Send prompt (body:{prompt, model?})POST /api/openai/stream- Stream response as SSE (body:{prompt, model?})
Ollama:
GET /api/ollama/status- Get configuration statusGET /api/ollama/list- List all modelsGET /api/ollama/search?query=...- Search modelsGET /api/ollama/info?model=...- Get model infoPOST /api/ollama/ask- Send prompt (body:{prompt, model?})POST /api/ollama/stream- Stream response as SSE (body:{prompt, model?})POST /api/ollama/pull- Pull model (body:{model})DELETE /api/ollama/delete- Delete model (body:{model})
Batch + Panel:
POST /api/batch- Process many requests with concurrency control (body:{requests, concurrency?})GET /api/profiles- List saved prompt profilesPOST /api/profiles- Create or update a profilePOST /api/profiles/:name/run- Execute a saved profileDELETE /api/profiles/:name- Remove a profileGET /panel- Browser panel with API key login, chat, stream mode, batch runner, and history view
History:
GET /api/history/summary- Get aggregated request statsGET /api/history/recent?limit=...- Get recent requests, optionally filtered byprovider,source, oractionPOST /api/history/replay/:id- Replay a cached response from a history entryDELETE /api/history- Clear local request history
Cache + Costs + Chat:
GET /api/cache/stats- Show response cache usagePOST /api/cache/config- Update cache settings (global and per-provider, including model exclusions)DELETE /api/cache- Clear response cacheGET /api/costs/summary?days=...- Cost and token summaryGET /api/pricing- List pricing rules (optionally filtered by provider)POST /api/pricing/rule- Upsert pricing rule with separate input/output ratesDELETE /api/pricing/rule?provider=...&match=...- Delete pricing ruleGET /api/chat- List chat conversationsPOST /api/chat/start- Start a new conversation (provider, optionalmodel,title,system)GET /api/chat/:id- Get one conversationPOST /api/chat/:id/message- Send message with context memoryPOST /api/chat/:id/summarize- Force context compression summaryDELETE /api/chat/:id- Delete conversation
Advanced Control Plane:
GET /api/capabilities- Show 35 capability flagsPOST /api/capabilities/:key- Enable/disable specific capabilityGET /api/integrations- List integrationsPOST /api/integrations- Upsert integration configurationDELETE /api/integrations/:id- Remove integrationPOST /api/integrations/dispatch- Dispatch event to enabled integrationsGET /api/integrations/dlq- List integration dead-letter queue entriesPOST /api/integrations/dlq/:id/retry- Retry one DLQ integration deliveryDELETE /api/integrations/dlq/:id- Delete one DLQ entryDELETE /api/integrations/dlq- Clear all DLQ entriesGET /api/router/policy- Read smart routing policyPOST /api/router/policy- Update routing policyGET /api/router/pick- Show current provider pickGET /api/router/explain- Show routing scores and filtering reasonsPOST /api/router/execute- Execute prompt through smart routerGET /api/guardrails/config- Read guardrails configPOST /api/guardrails/config- Update guardrails configPOST /api/guardrails/scan- Check/redact text with guardrailsPOST /api/evals/score- Evaluate prompt/response pairGET /api/budget/config- Read budget configPOST /api/budget/config- Update budget configGET /api/budget/status- Current budget usage and block statusPOST /api/budget/preflight- Check whether estimated request cost is allowed
Automation and Tasks:
GET /api/automations- List automation rulesPOST /api/automations- Create/update automation rulePOST /api/automations/simulate- Simulate automation event executionDELETE /api/automations/:id- Delete automation ruleGET /api/scheduler- List scheduler jobs and runtime statusPOST /api/scheduler- Create/update scheduler jobPOST /api/scheduler/:id/run- Run scheduler job immediatelyDELETE /api/scheduler/:id- Delete scheduler jobGET /api/heartbeat- Heartbeat config and runtime statusPOST /api/heartbeat- Update heartbeat config and reload enginePOST /api/heartbeat/run- Execute heartbeat immediatelyGET /api/hooks- List hooksPOST /api/hooks- Create/update hookPOST /api/hooks/simulate- Simulate hook eventDELETE /api/hooks/:id- Delete hookGET /api/standing-orders- List standing ordersPOST /api/standing-orders- Create/update standing orderDELETE /api/standing-orders/:id- Delete standing orderGET /api/task-flow- List task flowsGET /api/task-flow/:lookup- Get flow by id or name lookupPOST /api/task-flow/:lookup/run- Run flow by lookupPOST /api/task-flow/:lookup/cancel- Cancel flow by lookupGET /api/task-flow/audit- Audit task flow registry healthPOST /api/task-flow/maintenance- Run flow maintenance (dry-run or apply)GET /api/task-flow/maintenance/status- Task flow maintenance sweeper statusGET /api/tasks- List background tasks (supports filters:status,kind,notifyPolicy,limit)GET /api/tasks/:lookup- Get task by id/run/session/flow lookupPOST /api/tasks/:lookup/cancel- Cancel background taskPOST /api/tasks/:lookup/notify- Update notify policy (done_only|state_changes|silent)GET /api/tasks/audit- Audit task ledger healthPOST /api/tasks/maintenance- Run maintenance (dry-run or apply)GET /api/tasks/maintenance/status- Maintenance sweeper statusGET /api/tasks/flow- Alias list endpoint for task flowsGET /api/tasks/flow/:lookup- Alias get endpoint for task flow lookupPOST /api/tasks/flow/:lookup/run- Alias run endpoint for task flow lookupPOST /api/tasks/flow/:lookup/cancel- Alias cancel endpoint for task flow lookupGET /api/tasks/flow/audit- Alias flow audit endpointPOST /api/tasks/flow/maintenance- Alias flow maintenance endpointGET /api/tasks/flow/maintenance/status- Alias flow maintenance status endpointGET /api/doctor- Aggregated automation health and findingsPOST /api/doctor/repair- Run doctor with maintenance repair actionsGET /api/backup- List available config snapshotsPOST /api/backup/create- Create snapshot of local OpenOKAPI stateGET /api/backup/:id/verify- Verify snapshot integrity (checksum + size)GET /api/reset/plan?scope=...- Preview reset impact (config|config+history|full)POST /api/reset/run- Execute reset (or dry-run) for selected scopeGET /api/security/audit- Run local security audit (use?fix=trueto auto-fix permissions)POST /api/security/audit- Run security audit with JSON body ({fix:true})GET /api/system/self-test- Run full self-test reportGET /api/status- Runtime status summary (?deep=trueadds doctor, security, and full self-test)GET /api/alerts- Active alert summary (?limit=...,?deep=true)GET /api/incidents- List incidents (?status=open|acknowledged|resolved,?limit=...)POST /api/incidents- Create incident from current alerts/status snapshot ({forceWhenMuted:true}bypasses maintenance mute)GET /api/incidents/:id- Get incident detailsPOST /api/incidents/:id/ack- Acknowledge incidentPOST /api/incidents/:id/resolve- Resolve incidentGET /api/maintenance-windows- List maintenance windows and active mute statusPOST /api/maintenance-windows- Create/update maintenance window (name,startAt,endAt, optional mute flags)DELETE /api/maintenance-windows/:id- Delete maintenance windowGET /api/maintenance-windows/status- Show active maintenance mute stateGET /api/escalations- List escalation rulesPOST /api/escalations- Create/update escalation ruleDELETE /api/escalations/:id- Delete escalation rulePOST /api/escalations/run- Evaluate escalation rules and dispatch configured integration events
# Tasks
openokapi tasks list --status running
openokapi tasks show <lookup>
openokapi tasks audit
openokapi tasks maintenance --status
# Task Flow
openokapi tasks flow list --status running
openokapi tasks flow show <lookup>
openokapi tasks flow audit
openokapi tasks flow maintenance --status
openokapi tasks flow maintenance --apply --retention-days 14
# Scheduler / Heartbeat
openokapi automations --set --name "Auto escalate" --event request.error --actions '[{"type":"dispatchIntegration","event":"automation.error"}]'
openokapi automations --simulate --event request.error --payload '{"provider":"openai","success":false}'
openokapi scheduler --set --name "Morning report" --cron "0 9 * * *" --task-type prompt --provider openai --prompt "Generate report"
openokapi heartbeat --set --enabled true --interval-minutes 30 --provider openai --prompt "Check pending work"
# Doctor
openokapi doctor
openokapi doctor --repair --retention-days 14
# Backup
openokapi backup list
openokapi backup create
openokapi backup verify <backup-id>
# Reset
openokapi reset --scope config --dry-run
openokapi reset --scope config+history --yes
# Security
openokapi security --json
openokapi security --fix
openokapi self-test
# Status
openokapi status
openokapi status --deep --json
# Alerts
openokapi alerts
openokapi alerts --limit 20 --ignore-mute --json
# Incidents
openokapi incidents create --deep --force
openokapi incidents list --status open
openokapi incidents resolve <incident-id> --note "mitigated"
openokapi maintenance-windows --set --name "Deploy" --start-at 2026-01-01T10:00:00Z --end-at 2026-01-01T12:00:00Z --mute-alerts true --mute-incidents true
openokapi maintenance-windows --status --json
openokapi escalations --set --name "Critical errors" --trigger alerts.error --min-severity error --min-count 2 --integration-event escalation.critical --auto-incident true --cooldown-minutes 15
openokapi escalations --run --reason "manual check"curl -X POST http://localhost:16273/api/openai/ask \
-H "Content-Type: application/json" \
-H "User-Agent: OPENOKAPI/1.0" \
-H "X-API-Key: your-api-key" \
-d '{"prompt": "Hello, world!"}'OpenOKAPI is a community-driven project and we are looking for contributors!
We welcome anyone who:
- knows TypeScript
- wants to contribute to open-source
- has ideas for new features
- wants to help build the CLI, web panel, or integrations
Experience level doesnβt matter β what counts is motivation and willingness to help π
If youβd like to contribute:
- Fork the repository
- Explore the documentation
- Pick an issue to work on
- Submit a pull request
Every contribution is appreciated β code, tests, documentation, ideas!
Join our Discord community and help build OpenOKAPI together:
π¬ Discord: https://discord.gg/RF8CgZbx2P
Feel free to reach out, ask questions, or propose new ideas!
Thanks to everyone who helps make this project better!