Back to guides

MCP Server Integration

Use LLM Gateway's built-in MCP server to give Claude Code, Codex, Cursor, or any MCP client access to 200+ models — chat, image generation, and model discovery as tools.

LLM Gateway ships a hosted Model Context Protocol (MCP) server at https://api.llmgateway.io/mcp. Connect it to Claude Code, Codex, Cursor, or any MCP-compatible client and your AI assistant gets tools to call any model in our catalog — get a second opinion from another model, generate images mid-session, or inspect your usage and costs without leaving your editor.

Using DevPass? This integration also works with a DevPass plan key. Use canonical model IDs without a provider prefix (model-id instead of provider/model-id) — provider-pinned routing is not available on coding plans; the gateway picks the provider for you.

What you get

The MCP server exposes eight tools:

  • get-account — inspect your connected account, project, access scope, and key spending limits
  • get-usage — get request/token totals, costs, trends, and your most-used provider, model, and coding app
  • get-usage-breakdown — rank providers, models, apps, or API keys by requests, cost, or tokens
  • chat — send messages to any supported LLM (model, messages, optional temperature / max_tokens)
  • generate-image — text-to-image with models like Qwen Image (prompt, optional model, size, n)
  • generate-nano-banana — image generation with Gemini 3 Pro Image Preview, with optional save-to-disk
  • list-models / list-image-models — browse available models with capabilities and pricing

Analytics cover the connected project: owners/admins see project totals, while developers see their own keys in that project. These tools are read-only and have no model charges. They use hourly statistics, so recent usage may lag; results flag incomplete historical app data. Costs distinguish gateway credits from BYOK provider costs and are not invoice totals.

Setup

You'll need an API key from the LLM Gateway dashboard (API Keys section).

Claude Code

1claude mcp add --transport http --scope user llmgateway https://api.llmgateway.io/mcp \2  --header "Authorization: Bearer your-api-key-here"

Or add it manually to ~/.claude.json (user scope) or .mcp.json in your project root:

1{2  "mcpServers": {3    "llmgateway": {4      "url": "https://api.llmgateway.io/mcp",5      "headers": {6        "Authorization": "Bearer your-api-key-here"7      }8    }9  }10}

Codex CLI

1export LLM_GATEWAY_API_KEY="your-api-key-here"2codex mcp add llmgateway --url https://api.llmgateway.io/mcp \3  --bearer-token-env-var LLM_GATEWAY_API_KEY

Or in ~/.codex/config.toml:

1[mcp_servers.llmgateway]2url = "https://api.llmgateway.io/mcp"3bearer_token_env_var = "LLM_GATEWAY_API_KEY"

Cursor

Add to ~/.cursor/mcp.json:

1{2  "mcpServers": {3    "llmgateway": {4      "url": "https://api.llmgateway.io/mcp",5      "headers": {6        "Authorization": "Bearer your-api-key-here"7      }8    }9  }10}

Any other MCP client works the same way: streamable HTTP transport, https://api.llmgateway.io/mcp, bearer auth.

Try it

Once connected, ask your assistant things like:

  • "What did I spend this month, and which model do I use most?"
  • "Generate an image of a futuristic city with the generate-image tool"
  • "Rank my coding apps by cost over the last 30 days"

Generation calls use the same billing and analytics as your API traffic and appear in your dashboard. Account, usage, and model-discovery tools do not generate billable model requests.

Why use it

  • Cross-model workflows — your coding agent can consult a different model without you switching tools
  • Image generation anywhere — any MCP client becomes an image studio
  • One key, one bill — MCP traffic and API traffic share credits, caching, and analytics

For the full tool parameter reference, see the MCP docs.

Get started for free — no credit card required.