Opti
Routes configured task types to Google Gemini models, with provider model discovery and fallback handling.
Routes tasks to NVIDIA NIM models via the Chat API; model availability and capabilities depend on the NVIDIA account and model.
Routes tasks to local Ollama models, supporting local HTTP endpoints on loopback and model discovery.
Routes tasks to OpenAI models, including Responses API for text, Images API for image generation, and background deep research with web search; supports model discovery and fallback ordering.
Routes tasks to Perplexity models, including search-capable models such as sonar-deep-research for Chat-based deep research.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Optiuse my coding model to debug this Python function"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Opti
Your providers. Your preferred models. One MCP connection.
Opti delegates tasks from Codex, Claude, or another MCP client to the provider and model you choose. For example, keep your host agent for orchestration, send a coding question to your coding model, generate images through an Images API, and send research to a search-capable specialist.
The local control panel replaces manual JSON editing for everyday setup. Routing itself runs locally without an extra LLM classification call. There is no universal “best” model or promised cost saving: you control the choices, and provider API usage is billed separately from host-agent subscriptions.
Start
Requires Node.js 20 or later.
npm install
npm run build
npm run uiOpen the local control panel.
Click Provider in the header, choose a service from the dropdown, and enter your API key. For a custom service, also enter its name and base URL.
Opti automatically fetches the models available through that provider's API. Lists refresh when you open the page or save the provider again, including pagination where supported.
In each task row, choose a provider and model. The choice saves immediately. With one connected provider, its model list is already selected for all unconfigured rows.
The UI is a single wide page. There is no sidebar, dashboard, playground, or separate setup page. Existing fallbacks are preserved when the primary model changes; advanced routing settings remain editable in JSON. If a provider cannot list models, the row explains the error and lets you enter an exact model ID manually. API modes are inferred for new routes; existing explicit modes are preserved. OpenAI text routes use Responses, image routes use Images, and OpenAI deep research uses background research. Other research routes use Chat and require a search-capable model. Configure apiMode in JSON for custom Responses or research endpoints.
MCP connection examples are below.
The UI listens on 127.0.0.1:4310. Set OPTIM_UI_PORT to change the port. It is a local administration app, not a public hosted service. MCP clients do not need the UI process to stay running.
Related MCP server: Multi-Model Orchestrator
Providers and API modes
Presets: OpenAI, NVIDIA NIM, Anthropic, Google Gemini, OpenRouter, DeepSeek, Groq, Perplexity, Mistral, MiniMax, xAI, and Ollama.
Custom connections can use OpenAI-compatible or Anthropic-compatible APIs. For a service called Nimbus, for example, enter its documented base URL, authentication, and exact model ID; Opti does not assume which service or endpoint that name refers to. Other protocols need a new adapter. Model availability and supported capabilities depend on your provider account.
Mode | Wire API | Intended use |
Chat |
| Text, code, reasoning, planning, agentic analysis |
Responses |
| Text models that use the Responses API |
Images |
| A compatible image model, including GPT Images |
Background research |
| A compatible deep research model |
Deep research can also use Chat with a provider model that performs its own search, such as Perplexity's sonar-deep-research. Selecting the research task does not give an ordinary chat model browsing tools. NVIDIA models use the Chat API; the preset does not imply that every NVIDIA model supports images or native research.
Model discovery retrieves the provider's /models list; some services do not expose it. Enter an exact model ID manually in that case. The list is not a capability test. It includes the IDs returned by the API rather than a static list of model names. Use the full API ID your provider exposes for Astra, Sol, Nemotron, or any other model, rather than assuming the display name is an API ID.
Routing behavior
Six task types:
coding,reasoning,planning,agentic,image_generation, anddeep_research.An explicit
taskTypetakes precedence. Otherwise, local keyword rules detect the task; use a hint for ambiguous or mixed requests.Routes use saved preference order by default. Disabled providers and providers without credentials or base URLs are skipped.
Optional
providerandmodelinputs restrict selection to matching entries in that task route.Fallbacks stay within the chosen task and your configured order. No provider receives a hard-coded preference bonus.
Explicit authentication, unavailable endpoint/model, and rate-limit rejections can advance to a fallback. Timeouts, network errors, HTTP 5xx, and ambiguous responses stop rather than potentially duplicating paid work. Check provider status before resubmitting.
Prompts and credentials are not included in activity records. Available token usage is shown; actual prices and savings are not estimated.
Graphify integration is preserved for coding and repository requests. Deep research includes it only when a repository/graph path is supplied; images never include it.
strategy: "balanced" remains available in JSON for users who maintain legacy capability/cost/speed scores. Those are manually configured heuristic scores, not measured prices or live benchmarks. The UI changes the primary model while preserving existing fallbacks; keep strategy: "ordered" for predictable primary/fallback selection.
MCP clients
npm start starts the stdio MCP server, not the browser UI. A terminal waiting for input is expected. MCP output goes to stdout; diagnostic logs go to stderr.
For Codex, add this configuration with the absolute paths for your installation:
[mcp_servers.opti]
command = "node"
args = ["C:/path/to/optim/dist/index.js"]
tool_timeout_sec = 660
[mcp_servers.opti.env]
OPTIM_CONFIG_PATH = "C:/Users/you/.optim/config.json"For Claude Desktop or Claude Code, merge this entry into your existing MCP configuration:
{
"mcpServers": {
"opti": {
"command": "node",
"args": ["/absolute/path/to/optim/dist/index.js"],
"env": { "OPTIM_CONFIG_PATH": "/absolute/path/to/.optim/config.json" }
}
}
}Restart/reconnect the client after adding MCP. Route edits are read on the next request without restarting.
Tool | Purpose |
| Execute a task using its configured route |
| Backward-compatible alias of |
| Inspect selection and fallback order without calling a provider |
| Retrieve an existing background research job |
Example input:
{ "prompt": "Research battery recycling with primary sources.", "taskType": "deep_research" }You can say “Use Opti to do deep research on …” or “Use Opti to generate an image of …” in your host agent. Opti also exposes an MCP prompt named opti. A client may show it as a slash command, but /opti, /opti:opti, or another spelling is client-specific; registering an MCP server does not guarantee a universal slash command.
The host agent retains file access, terminal commands, and tool execution. The agentic route delegates model analysis; it does not start an autonomous tool-using agent or replace the host's model.
Images and research
Image generation returns MCP image content when the provider returns base64, or an image URL when the provider returns a URL. The host MCP client displays the result when it supports image content. Timeout: 180 seconds.
Native background research returns a jobId. Call opti_result with that ID, at least 10 seconds apart, until completed. Jobs are recorded next to the settings file and can be retrieved from another MCP process through opti_result. Do not resubmit the prompt to check progress. Changing a provider's endpoint prevents retrieval until the original endpoint is restored. Retrieval remains subject to the provider's retention policy. Chat-based research is synchronous with a ten-minute timeout.
Local configuration and credentials
Default settings: ~/.optim/config.json. Override with OPTIM_CONFIG_PATH; use the same absolute path in the UI and MCP processes. Activity metadata is stored in an activity/ directory beside that file.
Keys entered in the UI are stored as plaintext in this local file. Opti requests owner-only file permissions on POSIX; on Windows the file inherits your account's directory ACLs. They are omitted from browser responses and MCP results. To keep keys out of the file, use environment variables instead. An explicitly configured environment variable takes precedence over a saved key. Blank key fields preserve a saved key. To remove a key, clear it in the local JSON configuration; this does not unset an environment variable.
The server rejects cross-origin requests and unexpected Host headers, requires a session token for API actions, and checks configuration revisions before writing. Provider redirects are not followed with credentials. Only HTTPS provider endpoints are accepted, except HTTP on loopback for local models.
Existing project .env credentials and src/config/models.json are still supported. A saved UI route overrides the legacy JSON list for that task, including an explicitly empty list. Keys and base URLs in saved provider entries take precedence except for an explicit apiKeyEnv; provider presets also recognize their documented environment variables.
An editable example with no keys is provided in opti.config.example.json. Copy it to your chosen settings location and replace model IDs with the IDs available to your account. The UI can configure everything without this file.
Development and verification
npm run typecheck
npm test
npm run test:uiIntegration tests use local mock APIs and a real MCP stdio client. Browser tests cover automatic model discovery, immediate saving, fallback preservation, and the compact layout. They use headless Microsoft Edge by default; set OPTIM_BROWSER_CHANNEL=chromium after npx playwright install chromium on machines without Edge. Screenshots are written to the ignored artifacts/ directory. No test requires an API key or incurs provider charges.
Implementation references: Codex MCP, OpenAI deep research, OpenAI images, NVIDIA NIM, Gemini compatibility, and Perplexity Sonar.
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect MCP clients to 2,000+ AI models without managing provider API keys.
AI model routing on your own vendor keys: pick the best model per prompt, or route and run it.
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
One MCP endpoint for Claude, GPT & Gemini: 100+ tools + no-code connectors + agent workers.
Related MCP Servers
- AlicenseBqualityFmaintenanceEnables AI assistants to intelligently select and switch between different AI models (OpenAI, Anthropic, etc.) within the same conversation based on task requirements. Provides a unified interface for accessing multiple AI providers through a single MCP tool.122 npmMIT
- FlicenseNot gradedqualityDmaintenanceAutomatically routes queries to the most suitable AI model based on task type, cost constraints, and performance needs, supporting multiple providers and customizable priorities.-
- AlicenseNot gradedqualityBmaintenanceMCP server that enables agents to dynamically switch between multiple AI models (OpenAI, Anthropic, Google, etc.) with unified protocol-driven configuration and capability discovery.Apache 2.0
- FlicenseAqualityBmaintenanceUnified MCP server for querying multiple LLM providers (Gemini, OpenAI, Anthropic, etc.) with advanced routing, cost optimization, and fallback resilience.26 npm-