LLM Gateway
Guides

OpenClaw Integration

Use GPT-5.4, Claude Opus, Gemini, or any model with OpenClaw across Discord, WhatsApp, Telegram, and more

OpenClaw is a self-hosted gateway that connects your favorite chat apps—WhatsApp, Telegram, Discord, iMessage, and more—to AI coding agents. With LLM Gateway as a custom provider, you can route all your OpenClaw traffic through a single API, use any of 180+ models, and keep full visibility into usage and costs.

Setup

Sign Up for LLM Gateway

Sign up free — no credit card required. Copy your API key from the dashboard.

Set Your API Key

export LLMGATEWAY_API_KEY=llmgtwy_your_api_key_here

Configure OpenClaw

Add LLM Gateway as a custom provider in your ~/.openclaw/openclaw.json:

{
	"models": {
		"mode": "merge",
		"providers": {
			"llmgateway": {
				"baseUrl": "https://api.llmgateway.io/v1",
				"apiKey": "${LLMGATEWAY_API_KEY}",
				"api": "openai-completions",
				"models": [
					{
						"id": "gpt-5.4",
						"name": "GPT-5.4",
						"contextWindow": 128000,
						"maxTokens": 32000
					},
					{
						"id": "claude-opus-4-6",
						"name": "Claude Opus 4.6",
						"contextWindow": 200000,
						"maxTokens": 8192
					},
					{
						"id": "gemini-3-1-pro-preview",
						"name": "Gemini 3.1 Pro",
						"contextWindow": 1000000,
						"maxTokens": 8192
					}
				]
			}
		}
	},
	"agents": {
		"defaults": {
			"model": {
				"primary": "llmgateway/gpt-5.4"
			}
		}
	}
}

Start Chatting

Launch OpenClaw and start chatting across your connected channels. All requests will be routed through LLM Gateway.

Why Use LLM Gateway with OpenClaw

  • Model flexibility — Switch between GPT-5.4, Claude Opus, Gemini, or any of 180+ models
  • Cost tracking — Monitor exactly how much your chat agents cost to run
  • Single bill — No need to manage multiple API provider accounts
  • Response caching — Repeated queries hit cache, reducing costs
  • Rate limit handling — Automatic fallback between providers

Switching Models

Change the primary model in your config to switch between any model:

{
	"agents": {
		"defaults": {
			"model": { "primary": "llmgateway/claude-opus-4-6" }
		}
	}
}

Model Fallback Chain

OpenClaw supports fallback models. If the primary model is unavailable, it automatically falls back:

{
	"agents": {
		"defaults": {
			"model": {
				"primary": "llmgateway/gpt-5.4",
				"fallbacks": ["llmgateway/claude-opus-4-6"]
			}
		}
	}
}

Available Models

LLM Gateway uses root model IDs with smart routing—automatically selecting the best provider based on uptime, throughput, price, and latency. You can use any model from the models page. Flagship models include:

ModelBest For
gpt-5.4Latest OpenAI flagship, highest quality
claude-opus-4-6Anthropic's most capable model
claude-sonnet-4-6Fast reasoning with extended thinking
gemini-3-1-pro-previewGoogle's latest flagship, 1M context window
o3Advanced reasoning tasks
gpt-5.4-proPremium tier with extended reasoning
gemini-2.5-flashFast responses, good for high-volume
claude-haiku-4-5Cost-effective, quick responses
grok-3xAI flagship
deepseek-v3.1Open-source with vision and tools

For more details on routing behavior, see routing.

View all available models on the models page.

Tips for Chat Agents

Optimize Costs

  1. Use smaller models for simple tasks — Claude Haiku or Gemini Flash handle basic Q&A well
  2. Enable caching — LLM Gateway caches identical requests automatically
  3. Set token limits — Configure max tokens to prevent runaway costs

Improve Response Quality

  1. Choose the right model — Claude Opus excels at nuanced conversation, GPT-5.4 at general tasks
  2. Use system prompts — Configure your agent's personality and capabilities
  3. Test multiple models — LLM Gateway makes it easy to A/B test different providers

Need help? Join our Discord community for support and troubleshooting assistance.

How is this guide?

Last updated on