How to Integrate OmniRoute with 33+ Coding Agents: Claude Code, Cursor, and Cline
Integrate OmniRoute with coding agents by registering each agent in the OAuth provider registry, auto-detecting local CLI installations, and invoking MCP skills that route LLM requests through a single unified endpoint.
OmniRoute, from the diegosouzapw/OmniRoute repository, is an open-source routing layer built to integrate with over 33 coding agents without client-side reconfiguration. Whether you are orchestrating Claude Code, Cursor, or Cline, OmniRoute handles provider discovery, header injection, and model translation automatically.
Register OAuth Providers to Integrate OmniRoute with Coding Agents
Every supported agent starts as a provider entry. The central registry lives in src/shared/constants/providers.ts, while OAuth-based definitions for Claude Code, Cursor, and Cline are stored in src/shared/constants/providers/oauth.ts.
Each entry supplies the base URL, authentication header logic, and model aliases. For example, the Claude Code provider is configured as follows:
// src/shared/constants/providers/oauth.ts
export const OAUTH_PROVIDERS = {
// … other providers …
"claude": {
name: "Claude Code",
description: "Anthropic Claude Code CLI — ANTHROPIC_BASE_URL points to OmniRoute",
authHeaders: (token) => ({
"Authorization": `Bearer ${token}`,
"Anthropic-Version": "2023-06-01",
"User-Agent": getClaudeCodeUserAgent("cli"),
}),
compatiblePrefix: CLAUDE_CODE_COMPATIBLE_PREFIX,
},
// Cline, Cursor, … follow the same shape
};
Model Aliases and Compatibility Prefixes
The compatiblePrefix field—such as anthropic-compatible-cc- for Claude Code—tells OmniRoute to treat any model ID beginning with that string as a Claude-Code-compatible model. This enables seamless gateway discovery without manual mapping. The feature flag governing this behavior is defined in src/shared/constants/featureFlagDefinitions.ts.
Auto-Detect Installed Agents with the CLI Tool Scanner
When OmniRoute starts, src/lib/cli-helper/tool-detector.ts runs filesystem checks—using which, stat, and version parsing—to discover which CLI tools are present. The result is a list of tool descriptors:
// src/lib/cli-helper/tool-detector.ts (excerpt)
export const DETECTED_TOOLS = [
{ id: "claude", name: "Claude Code", configPath: "~/.claude/profiles" },
{ id: "cursor", name: "Cursor", configPath: "~/.cursor/config.json" },
{ id: "cline", name: "Cline", configPath: "~/.cline/data/globalState.json" },
// … up to 33+ agents …
];
Each descriptor feeds the MCP tool registry in src/lib/acp/registry.ts. This registration powers dashboard cards such as CliToolCard.tsx and tells the backend how to construct upstream headers. For Cline-specific header generation, see src/shared/utils/clineAuth.ts.
Expose MCP Skills for Agent Orchestration
OmniRoute wraps each detected agent with an MCP or A2A skill that can be invoked via JSON-RPC. The skill catalog is declared in src/shared/constants/agentSkills.ts:
// src/shared/constants/agentSkills.ts (excerpt)
{
name: "installCodingAgents",
description:
"Detect installed CLI coding tools (Claude Code, Codex, Cursor, Copilot, Cline and more), " +
"search GitHub for matching agent skills, and install them to the detected tools via OmniRoute's built‑in APIs.",
handler: async (args) => { /* scans DETECTED_TOOLS → installs skill packs */ },
}
These skills enable workflows such as installing the latest Claude Code profile, running a Cline sub-agent, or executing a Cursor-based code completion directly from the OmniRoute dashboard or any MCP client.
End-to-End Request Routing Flow
When you integrate OmniRoute with coding agents, client requests move through a predictable pipeline:
- Client sends a request to
POST /v1/chat/completionswith a model ID such asclaude-sonnet-4-6. - The router in
open-sse/services/combo.tsresolves the model to the Claude Code provider viaisClaudeCodeCompatibleProvider()(seesrc/shared/constants/providers.ts). - The executor in
open-sse/executors/default.tsbuilds the Claude-Code-specific headers using the OAuth token stored in the user profile. - The translator converts the OpenAI-style payload into the Anthropic-compatible format expected by Claude Code.
- The response is translated back and streamed through SSE, preserving Claude-specific markers such as
message_stopautomatically.
No additional client-side configuration is required beyond having the agent installed and its credentials saved.
Code Examples for OmniRoute Coding Agent Integrations
The following snippets assume OmniRoute is running locally on port 3000.
List Detected Agents via the MCP Tools API
This TypeScript script queries the MCP tools endpoint populated by src/lib/acp/registry.ts and filters for Claude Code, Cursor, and Cline:
import { fetch } from "node-fetch";
async function listAgents() {
const res = await fetch("http://localhost:3000/api/mcp/tools", {
method: "GET",
headers: { "Accept": "application/json" },
});
const { tools } = await res.json();
console.log("Detected coding agents:");
tools
.filter((t) => ["claude", "cursor", "cline"].includes(t.id))
.forEach((t) => console.log(`- ${t.name} (id=${t.id})`));
}
listAgents();
Sync Claude Code Profiles Automatically
Enable the feature flag from src/shared/constants/featureFlagDefinitions.ts and trigger the installCodingAgents skill to sync profiles:
import { fetch } from "node-fetch";
async function syncClaudeProfiles() {
// Feature flag that auto-creates ~/.claude/profiles from the OmniRoute catalog
await fetch("http://localhost:3000/api/settings/feature-flags/claude-code-profiles", {
method: "POST",
body: JSON.stringify({ enabled: true }),
headers: { "Content-Type": "application/json" },
});
// Trigger the skill that syncs the profiles
await fetch("http://localhost:3000/api/mcp/execute", {
method: "POST",
body: JSON.stringify({ tool: "installCodingAgents", args: {} }),
headers: { "Content-Type": "application/json" },
});
console.log("Claude Code profiles synced from the live catalog.");
}
syncClaudeProfiles();
Route a Chat Completion Through Cursor
Send a prompt through Cursor by targeting a model alias defined in providers/oauth.ts. The router uses isClaudeCodeCompatibleProvider-style logic and the DefaultExecutor injects the required Authorization header via src/shared/utils/cursorAuth.ts:
import { fetch } from "node-fetch";
async function cursorChat(prompt: string) {
const res = await fetch("http://localhost:3000/v1/chat/completions", {
method: "POST",
body: JSON.stringify({
model: "cursor-codex-1",
messages: [{ role: "user", content: prompt }],
}),
headers: { "Content-Type": "application/json" },
});
const data = await res.json();
console.log("Cursor response:", data.choices[0].message.content);
}
cursorChat("Explain the Observer pattern in TypeScript.");
Summary
- Provider registry:
src/shared/constants/providers/oauth.tsdefines OAuth entries for Claude Code, Cursor, Cline, and others. - Auto-detection:
src/lib/cli-helper/tool-detector.tsscans the host machine and publishes tool descriptors tosrc/lib/acp/registry.ts. - Orchestration:
src/shared/constants/agentSkills.tsexposes theinstallCodingAgentsskill for automated profile and skill-pack management. - Routing:
open-sse/services/combo.tsandopen-sse/executors/default.tsresolve model aliases, inject headers, and translate payloads transparently. - Integration endpoint: A single
POST /v1/chat/completionsrequest is enough to reach any detected coding agent.
Frequently Asked Questions
Which file defines the Claude Code OAuth provider in OmniRoute?
The provider definition lives in src/shared/constants/providers/oauth.ts. It supplies the authHeaders callback, the compatiblePrefix constant, and descriptive metadata that the router consumes to identify and sign Claude Code requests.
How does OmniRoute detect whether Cline or Cursor is installed?
On startup, src/lib/cli-helper/tool-detector.ts performs filesystem checks to locate CLI binaries and config directories. It emits tool descriptors that are consumed by src/lib/acp/registry.ts, so the backend and UI both know which agents are available.
What endpoint routes chat-completion requests to a specific coding agent?
Clients send standard requests to POST /v1/chat/completions. OmniRoute’s combo router in open-sse/services/combo.ts examines the model ID and routes the request to the correct executor, which attaches provider-specific headers before calling upstream.
Can I add a new coding agent without modifying OmniRoute’s core routing engine?
Yes. According to the OmniRoute source code, adding an agent requires four steps: register the provider in providers/oauth.ts, implement custom header logic if needed, add a detection entry in tool-detector.ts, and optionally expose an MCP skill in agentSkills.ts. The router and UI automatically pick up the new agent.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →