How to Set Up the Agent Bridge for Claude Code, Cursor, and Cline Integration in OmniRoute

The Agent Bridge intercepts IDE agent traffic by launching CLI sidecars with injected environment variables, applying Claude Code-specific fingerprints via claudeCodeFingerprint.ts, and optionally redirecting DNS to route requests through OmniRoute's local proxy.

Setting up the Agent Bridge in the OmniRoute repository allows Claude Code, Cursor, and Cline to communicate through OmniRoute's unified routing layer instead of connecting directly to provider APIs. This integration requires enabling specific feature flags, configuring OAuth-compatible providers, and launching dedicated CLI sidecars that mimic native client behavior according to the OmniRoute source code.

Understanding the Agent Bridge Architecture

The bridge consists of three integrated components that work together to transparently proxy agent traffic.

CLI Launcher Service

Located in src/app/(dashboard)/dashboard/cli-tools/launch.ts, the launcher spawns native CLI binaries with modified environment variables. It injects OMNIROUTE_URL, OMNIROUTE_API_KEY, and NODE_EXTRA_CA_CERTS to redirect socket connections from the agents to the local OmniRoute endpoint.

Fingerprint and Obfuscation Services

The [open-sse/services/claudeCodeFingerprint.ts](https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.50/open-sse/services/claudeCodeFingerprint.ts) file implements header injection and tool-name remapping. It adds headers such as anthropic-version, anthropic-client-id, and x-omniroute-fingerprint: claude-code to satisfy provider validation. For payload transformations, [open-sse/services/claudeCodeObfuscation.ts](https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.50/open-sse/services/claudeCodeObfuscation.ts) handles any required request body modifications.

DNS Bridge Toggle

The DNS bridge is controlled via the /api/agent-bridge/dns endpoint defined in [src/app/api/agent-bridge/dns/route.ts](https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.50/src/app/api/agent-bridge/dns/route.ts). When enabled, this resolves provider hostnames like api.anthropic.com to 127.0.0.1, ensuring all agent traffic routes through OmniRoute's proxy before reaching external APIs.

Step-by-Step Setup Guide

Enable the Agent Bridge Feature Flag

Before configuring providers, you must activate the compatibility layer. Navigate to Settings → Feature Flags in the dashboard and enable ENABLE_CC_COMPATIBLE_PROVIDER. This flag unlocks the Claude Code-compatible provider UI and activates the DNS toggle functionality, as defined in [src/shared/utils/featureFlags.ts](https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.50/src/shared/utils/featureFlags.ts).

You can also enable this via the API:

curl -X POST https://localhost:3000/api/feature-flags \
  -H "Authorization: Bearer $OMNIROUTE_API_KEY" \
  -d '{"flag":"ENABLE_CC_COMPATIBLE_PROVIDER","value":true}'

Configure the Claude Code Compatible Provider

Register the provider in OmniRoute's registry. Go to Providers → Add Provider and select "Add Claude Code Compatible" (visible only after enabling the feature flag). Enter the OAuth client ID (CLAUDE_OAUTH_CLIENT_ID) and redirect URI (CLAUDE_CODE_REDIRECT_URI). OmniRoute stores this configuration in the providers table via [src/shared/constants/providers.ts](https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.50/src/shared/constants/providers.ts).

CLI alternative:

omniroute provider add \
  --id claude \
  --type oauth \
  --client-id $CLAUDE_OAUTH_CLIENT_ID \
  --redirect-uri $CLAUDE_CODE_REDIRECT_URI

Activate the DNS Bridge

In Settings → Agent Bridge, enable the DNS Bridge toggle. This sends a POST request to /api/agent-bridge/dns that activates the local DNS resolver, ensuring hostnames like api.anthropic.com resolve to your local OmniRoute instance.

curl -X POST https://localhost:3000/api/agent-bridge/dns \
  -H "Authorization: Bearer $OMNIROUTE_API_KEY" \
  -d '{"enabled":true}'

Launch the CLI Sidecar

Open a terminal and execute the launcher corresponding to your IDE agent:


# Claude Code

omniroute launch

# Cursor

omniroute launch-cursor

# Cline

omniroute launch-cline

These commands spawn the native CLI with injected environment variables. The launcher configures:

  • OMNIROUTE_URL pointing to your local OmniRoute port
  • OMNIROUTE_API_KEY for request authorization
  • NODE_EXTRA_CA_CERTS set to $HOME/.omniroute/ca-bundle.crt for TLS validation

Implementation Code Examples

Toggle DNS Bridge via API

curl -X POST https://localhost:3000/api/agent-bridge/dns \
  -H "Authorization: Bearer $OMNIROUTE_API_KEY" \
  -d '{"enabled":true}'

Apply Claude Code Fingerprint

The following TypeScript demonstrates how OmniRoute modifies outgoing requests to mimic Claude Code's native client:

import { Request } from 'open-sse/types';

export function applyClaudeFingerprint(req: Request) {
  // Add Claude Code-specific headers
  req.headers.set('anthropic-version', '2023-06-01');
  req.headers.set('x-omniroute-fingerprint', 'claude-code');
  
  // Remap tool names for compatibility
  req.body = remapToolNames(req.body);
  return req;
}

Key Source Files

Summary

Frequently Asked Questions

What is the Agent Bridge in OmniRoute?

The Agent Bridge is a transparent proxy layer that allows IDE coding agents like Claude Code, Cursor, and Cline to communicate through OmniRoute while believing they are connected directly to their native APIs. It intercepts traffic via DNS redirection and header fingerprinting to enable unified routing and quota management across multiple AI providers.

How does the DNS Bridge toggle work?

When you enable the DNS Bridge in the dashboard or via the /api/agent-bridge/dns endpoint, OmniRoute starts a local DNS resolver that maps provider hostnames (such as api.anthropic.com) to 127.0.0.1. This forces the CLI agents to send requests to the OmniRoute proxy rather than directly to external servers, as implemented in [src/app/api/agent-bridge/dns/route.ts](https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.50/src/app/api/agent-bridge/dns/route.ts).

Which environment variables are required for the CLI sidecar?

The launcher in src/app/(dashboard)/dashboard/cli-tools/launch.ts injects three critical variables: OMNIROUTE_URL (the local proxy endpoint), OMNIROUTE_API_KEY (your OmniRoute authentication key), and NODE_EXTRA_CA_CERTS (path to the custom CA certificate bundle for TLS validation with Claude Code).

How do I verify the fingerprint is working correctly?

Check the request headers in your CLI agent's debug logs for x-omniroute-fingerprint: claude-code. This header is injected by [open-sse/services/claudeCodeFingerprint.ts](https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.50/open-sse/services/claudeCodeFingerprint.ts) and indicates that OmniRoute is successfully masquerading as the native Claude Code client to the upstream provider.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →