Skip to content

Connect a coding CLI ​

Most coding tools let you override the API base URL and API key. Point them at Merido Gateway and they "just work" — Merido Gateway accepts the major wire formats and routes each request to a real provider.

The two things every tool needs:

  • Base URL: http://127.0.0.1:8788/v1
  • API key: a Merido Gateway client (gateway) key — merido keys create.

Wire formats ​

Merido Gateway speaks several formats on the same data plane, so a tool can talk in whatever dialect it already uses:

  • OpenAI — POST /v1/chat/completions (and /v1/responses, /v1/embeddings, /v1/images/generations, /v1/audio/*).
  • Anthropic — POST /v1/messages (and /v1/messages/count_tokens).
  • Gemini — Google's generate-content format is accepted and translated.

Every format is translated through one canonical representation, so you can, e.g., send Anthropic requests and have them served by an OpenAI-family model (or a virtual model).

Examples ​

Claude Code ​

Claude Code speaks the Anthropic format. Point its base URL at Merido Gateway and use your Merido Gateway key:

bash
export ANTHROPIC_BASE_URL="http://127.0.0.1:8788"
export ANTHROPIC_API_KEY="<your-merido-key>"

Requests land on /v1/messages and are routed by Merido Gateway.

Codex / OpenAI-style tools ​

Set the OpenAI base URL and key:

bash
export OPENAI_BASE_URL="http://127.0.0.1:8788/v1"
export OPENAI_API_KEY="<your-merido-key>"

OpenClaw ​

OpenClaw is an autonomous agent rather than a coding CLI, so Merido Gateway writes it a fuller config than the base-URL swap above. Connect it from the dashboard's CLI Tools page (or POST /api/cli-tools/openclaw) and Merido Gateway patches ~/.openclaw/openclaw.json, preserving every unrelated key:

  • models.providers.merido — every virtual model your key can call, each with its contextWindow, maxTokens, reasoning, accepted input modalities, and per-1M cost (input, output, cacheRead, cacheWrite). OpenClaw budgets and decides when to compact from these numbers; without them it falls back to its own generic defaults and treats every model as free.
  • agents.defaults.model.primary — the model you selected.
  • agents.defaults.utilityModel — the cheapest advertised model. OpenClaw uses the utility route for generated titles and progress narration. Left unset these run on the primary model, which is where most of a chatty agent's spend leaks: very short answers over a very large prompt.
  • agents.defaults.imageModel / pdfModel — a model that accepts image input, when one is available.

Anything Merido Gateway does not know is left out rather than guessed, so OpenClaw falls back to its own default instead of to an invented number.

On a multi-tenant (cloud) deployment, POST /api/cli-tools/* never writes to the server's filesystem — every tool, including normally-writable ones like OpenClaw, gets the same config rendered back as a paste-able snippet instead, since the caller's machine is not the gateway's. It also requires the same ManageKeys capability as minting a key directly. Local/self-hosted behavior (writing the file in place) is unchanged.

Cursor and other clients ​

Anywhere a tool exposes an "OpenAI-compatible base URL" / "custom endpoint" setting, use http://127.0.0.1:8788/v1 and your Merido Gateway key. The model you select can be a provider/model string or a virtual-model name you've defined.

Tools that hardcode their host (MITM) ​

Some clients ignore base-URL settings and dial a provider host directly. For those, Merido Gateway has an optional MITM interception mode: it runs a local TLS proxy that intercepts known coding-CLI hosts and rewrites their traffic to this gateway's /v1 API.

Enable it with MERIDO_MITM_ENABLED=true (it binds MERIDO_MITM_PORT, default 8443). Because it terminates TLS for intercepted hosts, the client must trust Merido Gateway's generated root CA; MERIDO_MITM_INSTALL_CA=true installs it into the OS trust store, and MERIDO_MITM_MANAGE_HOSTS=true maps the intercepted hosts to Merido Gateway in your hosts file. Reach for this only when overriding the base URL isn't possible.

Migrating from Helicone ​

If you already configured a tool for Helicone, Merido Gateway accepts Helicone-* request headers on /v1/* and rewrites them to its native equivalents, so a Helicone-configured client works pointed at Merido Gateway. You can also bulk-import provider connections from a Helicone export:

bash
merido import helicone --file ./helicone-export.json

Part of Merido.