Skip to main content

Connect a custom client

Use this guide when your coding tool is not one of the six supported clients, but it lets you set its API base URL. The supported clients with dedicated integrations and automated routing via cmx harness enable <name> are: The custom tool must speak a protocol CMX can proxy, and its model provider must already be configured. Custom tools are not automatically detected or restored by cmx harness commands.

Choose a base URL

Start the gateway:
Set the base URL in your tool’s settings. Use the route for the upstream provider you intend to reach: Replace openai, anthropic, gemini, or ollama with another configured upstream ID where that provider supports the same protocol. Different clients append paths differently: for example, an OpenAI SDK may append /chat/completions to a /v1 base URL. Check your client’s base-URL documentation before changing it. Do not send provider keys in documentation, logs, or support messages; let the client supply them in its normal authentication fields. CMX also supports path routing through /route/<provider>/... and /provider/<provider>/..., the cmx_provider query parameter, the X-CMX-Provider header, and the X-CMX-Base-URL header for a dynamic direct endpoint. These are advanced options for clients that expose request-level routing. Use a valid HTTPS upstream URL, or an exact loopback HTTP endpoint for local models.

Native Gemini support

CMX includes a native Google Gemini adapter. If your tool speaks the Gemini REST format directly (/v1beta/models/{model}:generateContent and :streamGenerateContent), point it at http://127.0.0.1:17322/route/gemini. CMX forwards requests including SSE streams with alt=sse, extracts usage from usageMetadata, and preserves functionCall, functionResponse, and thought parts intact. If your tool speaks Gemini’s OpenAI-compatible endpoint instead, use http://127.0.0.1:17322/route/gemini/v1.

Endpoint path normalization

If your tool sends a bare path like /chat/completions or /responses without a /v1 prefix, CMX automatically prepends /v1 before forwarding to the upstream. For example, http://127.0.0.1:17322/route/openai/chat/completions and http://127.0.0.1:17322/route/openai/v1/chat/completions both reach https://api.openai.com/v1/chat/completions.

Verify and undo

Restart the client, send a request, then compare cmx stats before and after. cmx harness verify cannot check a custom client that it does not manage. To undo this setup, restore the tool’s original API base URL in that tool and restart it. Then run cmx stop if no other clients need the gateway. CMX cannot restore configuration it did not change. For a first-class integration request, suggest a client.
Last modified on October 7, 2026