Setup prompts
Copy-paste prompts that make your coding agent do the RouterPlex setup for you.
On this page
Copy a prompt below and paste it into the coding agent you already use (Claude Code, Codex, Cursor, OpenCode, or another agent). Paste your key into any prompt's key field and it fills every prompt on this page. The agent sets everything up, then keeps testing until a real request goes through RouterPlex, fixing environment problems along the way.
Wire Claude Code to RouterPlex #
Paste this into any agent, including another Claude Code session. Claude Code reads its settings when it starts, so the agent tests it in a new process.
Optional. It stays in this browser tab and is never saved or sent. No key yet? Create one in guided setup.
Set up Claude Code on this machine to use RouterPlex, an OpenAI- and Anthropic-compatible AI gateway. Keep working until a real request from Claude Code succeeds through RouterPlex.My RouterPlex API key: YOUR_ROUTERPLEX_API_KEYKey handling:- If the key line above is a placeholder rather than a real key (real keys start with sk-), use my ROUTERPLEX_API_KEY environment variable. If that is empty too, ask me for the key once, then continue.- Store the key only in user-level config or my user environment. Never put it in a project file, never commit it, and do not repeat the full key in your replies.Full guide: https://docs.routerplex.com/claude-codeStep 1. Prove the key and the RouterPlex gateway work before changing anything else. Run:curl -sS https://api.routerplex.com/v1/chat/completions -H "Authorization: Bearer YOUR_ROUTERPLEX_API_KEY" -H "Content-Type: application/json" -d '{"model":"claude-sonnet-4-6","max_tokens":32,"messages":[{"role":"user","content":"Reply with exactly: RouterPlex connected."}]}'On Windows PowerShell, use curl.exe with the body in a file, or Invoke-RestMethod.- A reply containing "RouterPlex connected.": go on.- 401: the key is wrong or revoked. Stop and ask me for a correct key.- 402: my balance or trial credit is used up. 403: this key reached its own spending limit. Stop and tell me; retrying cannot fix these.- Network, DNS, TLS, or proxy errors: find and fix the cause (proxy variables, VPN, firewall, system clock, outdated CA certificates), then run it again.Step 2. Configure Claude Code:- Run claude --version. If Claude Code is missing, install it with the official installer (curl -fsSL https://claude.ai/install.sh | bash; Windows PowerShell: irm https://claude.ai/install.ps1 | iex).- In my user-level Claude Code settings, ~/.claude/settings.json (Windows: %USERPROFILE%\.claude\settings.json), set these keys in the "env" object. Merge with what is there and keep my other settings:ANTHROPIC_BASE_URL = https://api.routerplex.com (no /v1; Claude Code adds /v1/messages)ANTHROPIC_AUTH_TOKEN = the keyANTHROPIC_API_KEY = "" (empty, so a direct Anthropic key does not compete)ANTHROPIC_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_OPUS_MODEL = claude-sonnet-4-6- Keeping the key in settings.json means Claude Code does not depend on shell variables.Step 3. Test Claude Code itself from a new terminal or a restarted app, so you test the saved setup rather than the shell you changed:From an empty temporary folder: claude --model 'claude-sonnet-4-6' -p 'Reply with exactly: RouterPlex connected. Do not read files or run tools.'If the reply is wrong, run claude and check /status: it must show https://api.routerplex.com as the base URL.Expected reply: "RouterPlex connected."Step 4. If step 1 works but step 3 fails, the problem is Claude Code's configuration or environment, not RouterPlex. Check these, fix what is wrong, and repeat step 3:- The key or base URL is set in one place but not where Claude Code starts: zsh vs bash startup files, login vs non-login shells, a desktop launcher, a background service, Windows vs WSL, or a remote SSH or container environment.- Another setting wins: OPENAI_API_KEY, OPENAI_BASE_URL, OPENAI_API_BASE, ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL, or a project-level config that overrides the user-level one.- Claude Code is outdated, or still needs a full restart to read the new settings.- If an environment variable cannot be made to reach Claude Code reliably and Claude Code accepts a key in its user-level config, put the key there instead.Keep repeating steps 3 and 4 until the test reply comes back. Stop early only for a 401, 402, or 403, or for a step only I can do, such as a click in a settings window or a login. Then tell me exactly what to do, wait for me, and continue testing afterwards.When it works, tell me which files you changed, where the key is stored, and the final test output.
Wire Codex CLI to RouterPlex #
Optional. It stays in this browser tab and is never saved or sent. No key yet? Create one in guided setup.
Set up Codex CLI on this machine to use RouterPlex, an OpenAI- and Anthropic-compatible AI gateway. Keep working until a real request from Codex CLI succeeds through RouterPlex.My RouterPlex API key: YOUR_ROUTERPLEX_API_KEYKey handling:- If the key line above is a placeholder rather than a real key (real keys start with sk-), use my ROUTERPLEX_API_KEY environment variable. If that is empty too, ask me for the key once, then continue.- Store the key only in user-level config or my user environment. Never put it in a project file, never commit it, and do not repeat the full key in your replies.Full guide: https://docs.routerplex.com/codex-cliStep 1. Prove the key and the RouterPlex gateway work before changing anything else. Run:curl -sS https://api.routerplex.com/v1/chat/completions -H "Authorization: Bearer YOUR_ROUTERPLEX_API_KEY" -H "Content-Type: application/json" -d '{"model":"claude-sonnet-4-6","max_tokens":32,"messages":[{"role":"user","content":"Reply with exactly: RouterPlex connected."}]}'On Windows PowerShell, use curl.exe with the body in a file, or Invoke-RestMethod.- A reply containing "RouterPlex connected.": go on.- 401: the key is wrong or revoked. Stop and ask me for a correct key.- 402: my balance or trial credit is used up. 403: this key reached its own spending limit. Stop and tell me; retrying cannot fix these.- Network, DNS, TLS, or proxy errors: find and fix the cause (proxy variables, VPN, firewall, system clock, outdated CA certificates), then run it again.Step 2. Configure Codex CLI:- Run codex --version. If Codex is missing, install it with the official installer (curl -fsSL https://chatgpt.com/codex/install.sh | sh).- Merge this into my user-level ~/.codex/config.toml (Windows: %USERPROFILE%\.codex\config.toml; use $CODEX_HOME/config.toml if CODEX_HOME is set). Keep my other settings, put model and model_provider above any [table] header, and update an existing [model_providers.routerplex] block instead of adding a second one:model_provider = "routerplex"model = "gpt-5.6-terra"model_reasoning_effort = "low"[model_providers.routerplex]name = "RouterPlex"base_url = "https://api.routerplex.com/v1"wire_api = "responses"env_key = "ROUTERPLEX_API_KEY"- wire_api = "responses" is required. env_key makes Codex read the key from ROUTERPLEX_API_KEY.- Make ROUTERPLEX_API_KEY permanent for my user so new terminals get it:- macOS/Linux: add export ROUTERPLEX_API_KEY='<key>' to the startup file of the shell I use (check $SHELL: zsh uses ~/.zshrc; bash uses ~/.bashrc, plus ~/.bash_profile or ~/.profile if they do not source ~/.bashrc). Update an existing line instead of adding a second one.- Windows: run [Environment]::SetEnvironmentVariable('ROUTERPLEX_API_KEY', '<key>', 'User'). Only terminals and apps started after this see it.- WSL, SSH, or a dev container: set it inside that environment, where the tool actually runs.Step 3. Test Codex CLI itself from a new terminal or a restarted app, so you test the saved setup rather than the shell you changed:From an empty temporary folder: codex exec --skip-git-repo-check --model 'gpt-5.6-terra' 'Reply with exactly: RouterPlex connected. Do not read files or run tools.'Expected reply: "RouterPlex connected."Step 4. If step 1 works but step 3 fails, the problem is Codex CLI's configuration or environment, not RouterPlex. Check these, fix what is wrong, and repeat step 3:- The key or base URL is set in one place but not where Codex CLI starts: zsh vs bash startup files, login vs non-login shells, a desktop launcher, a background service, Windows vs WSL, or a remote SSH or container environment.- Another setting wins: OPENAI_API_KEY, OPENAI_BASE_URL, OPENAI_API_BASE, ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL, or a project-level config that overrides the user-level one.- Codex CLI is outdated, or still needs a full restart to read the new settings.- If an environment variable cannot be made to reach Codex CLI reliably and Codex CLI accepts a key in its user-level config, put the key there instead.Keep repeating steps 3 and 4 until the test reply comes back. Stop early only for a 401, 402, or 403, or for a step only I can do, such as a click in a settings window or a login. Then tell me exactly what to do, wait for me, and continue testing afterwards.When it works, tell me which files you changed, where the key is stored, and the final test output.
Wire OpenCode to RouterPlex #
Optional. It stays in this browser tab and is never saved or sent. No key yet? Create one in guided setup.
Set up OpenCode on this machine to use RouterPlex, an OpenAI- and Anthropic-compatible AI gateway. Keep working until a real request from OpenCode succeeds through RouterPlex.My RouterPlex API key: YOUR_ROUTERPLEX_API_KEYKey handling:- If the key line above is a placeholder rather than a real key (real keys start with sk-), use my ROUTERPLEX_API_KEY environment variable. If that is empty too, ask me for the key once, then continue.- Store the key only in user-level config or my user environment. Never put it in a project file, never commit it, and do not repeat the full key in your replies.Full guide: https://docs.routerplex.com/opencodeStep 1. Prove the key and the RouterPlex gateway work before changing anything else. Run:curl -sS https://api.routerplex.com/v1/chat/completions -H "Authorization: Bearer YOUR_ROUTERPLEX_API_KEY" -H "Content-Type: application/json" -d '{"model":"claude-sonnet-4-6","max_tokens":32,"messages":[{"role":"user","content":"Reply with exactly: RouterPlex connected."}]}'On Windows PowerShell, use curl.exe with the body in a file, or Invoke-RestMethod.- A reply containing "RouterPlex connected.": go on.- 401: the key is wrong or revoked. Stop and ask me for a correct key.- 402: my balance or trial credit is used up. 403: this key reached its own spending limit. Stop and tell me; retrying cannot fix these.- Network, DNS, TLS, or proxy errors: find and fix the cause (proxy variables, VPN, firewall, system clock, outdated CA certificates), then run it again.Step 2. Configure OpenCode:- Run opencode --version (opencode.cmd for Windows npm installs). If OpenCode is missing, install it (curl -fsSL https://opencode.ai/install | bash; Windows: npm.cmd install -g opencode-ai).- Merge this into my user-level ~/.config/opencode/opencode.json (Windows: %USERPROFILE%\.config\opencode\opencode.json; use $XDG_CONFIG_HOME/opencode if XDG_CONFIG_HOME is set). Keep my other providers:{"$schema": "https://opencode.ai/config.json","model": "routerplex/claude-sonnet-4-6","small_model": "routerplex/claude-sonnet-4-6","provider": {"routerplex": {"npm": "@ai-sdk/openai-compatible","name": "RouterPlex","options": {"baseURL": "https://api.routerplex.com/v1","apiKey": "{env:ROUTERPLEX_API_KEY}"},"models": {"claude-sonnet-4-6": {"name": "claude-sonnet-4-6"}}}}}- Make ROUTERPLEX_API_KEY permanent for my user so new terminals get it:- macOS/Linux: add export ROUTERPLEX_API_KEY='<key>' to the startup file of the shell I use (check $SHELL: zsh uses ~/.zshrc; bash uses ~/.bashrc, plus ~/.bash_profile or ~/.profile if they do not source ~/.bashrc). Update an existing line instead of adding a second one.- Windows: run [Environment]::SetEnvironmentVariable('ROUTERPLEX_API_KEY', '<key>', 'User'). Only terminals and apps started after this see it.- WSL, SSH, or a dev container: set it inside that environment, where the tool actually runs.- If the variable still does not reach OpenCode, replace {env:ROUTERPLEX_API_KEY} with the key itself in that user-level file.Step 3. Test OpenCode itself from a new terminal or a restarted app, so you test the saved setup rather than the shell you changed:From an empty temporary folder: opencode run --model 'routerplex/claude-sonnet-4-6' 'Reply with exactly: RouterPlex connected. Do not read files or run tools.'The first run may download the provider adapter.Expected reply: "RouterPlex connected."Step 4. If step 1 works but step 3 fails, the problem is OpenCode's configuration or environment, not RouterPlex. Check these, fix what is wrong, and repeat step 3:- The key or base URL is set in one place but not where OpenCode starts: zsh vs bash startup files, login vs non-login shells, a desktop launcher, a background service, Windows vs WSL, or a remote SSH or container environment.- Another setting wins: OPENAI_API_KEY, OPENAI_BASE_URL, OPENAI_API_BASE, ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL, or a project-level config that overrides the user-level one.- OpenCode is outdated, or still needs a full restart to read the new settings.- If an environment variable cannot be made to reach OpenCode reliably and OpenCode accepts a key in its user-level config, put the key there instead.Keep repeating steps 3 and 4 until the test reply comes back. Stop early only for a 401, 402, or 403, or for a step only I can do, such as a click in a settings window or a login. Then tell me exactly what to do, wait for me, and continue testing afterwards.When it works, tell me which files you changed, where the key is stored, and the final test output.
Wire any other tool #
Every integration guide starts with its own prompt. For a tool without a guide, replace <TOOL> with its name:
Optional. It stays in this browser tab and is never saved or sent. No key yet? Create one in guided setup.
Set up <TOOL> on this machine to use RouterPlex, an OpenAI- and Anthropic-compatible AI gateway. Keep working until a real request from <TOOL> succeeds through RouterPlex.My RouterPlex API key: YOUR_ROUTERPLEX_API_KEYKey handling:- If the key line above is a placeholder rather than a real key (real keys start with sk-), use my ROUTERPLEX_API_KEY environment variable. If that is empty too, ask me for the key once, then continue.- Store the key only in user-level config or my user environment. Never put it in a project file, never commit it, and do not repeat the full key in your replies.Full guide: https://docs.routerplex.com/integrationsStep 1. Prove the key and the RouterPlex gateway work before changing anything else. Run:curl -sS https://api.routerplex.com/v1/chat/completions -H "Authorization: Bearer YOUR_ROUTERPLEX_API_KEY" -H "Content-Type: application/json" -d '{"model":"claude-sonnet-4-6","max_tokens":32,"messages":[{"role":"user","content":"Reply with exactly: RouterPlex connected."}]}'On Windows PowerShell, use curl.exe with the body in a file, or Invoke-RestMethod.- A reply containing "RouterPlex connected.": go on.- 401: the key is wrong or revoked. Stop and ask me for a correct key.- 402: my balance or trial credit is used up. 403: this key reached its own spending limit. Stop and tell me; retrying cannot fix these.- Network, DNS, TLS, or proxy errors: find and fix the cause (proxy variables, VPN, firewall, system clock, outdated CA certificates), then run it again.Step 2. Configure <TOOL>:- Read https://docs.routerplex.com/llms-full.txt and follow the setup guide for <TOOL>. If there is none, use the generic settings: OpenAI-compatible base URL https://api.routerplex.com/v1, or https://api.routerplex.com with no /v1 for Anthropic-compatible tools, and the key as the API key.- Use exact model IDs from https://docs.routerplex.com/catalog.json. Add a provider prefix only when the guide says so.- Prefer <TOOL>'s user-level config. If it reads the key from an environment variable: Make ROUTERPLEX_API_KEY permanent for my user so new terminals get it:- macOS/Linux: add export ROUTERPLEX_API_KEY='<key>' to the startup file of the shell I use (check $SHELL: zsh uses ~/.zshrc; bash uses ~/.bashrc, plus ~/.bash_profile or ~/.profile if they do not source ~/.bashrc). Update an existing line instead of adding a second one.- Windows: run [Environment]::SetEnvironmentVariable('ROUTERPLEX_API_KEY', '<key>', 'User'). Only terminals and apps started after this see it.- WSL, SSH, or a dev container: set it inside that environment, where the tool actually runs.Step 3. Test <TOOL> itself from a new terminal or a restarted app, so you test the saved setup rather than the shell you changed:Send the short test the guide describes, or a one-message chat asking: Reply with exactly: RouterPlex connected.Expected reply: "RouterPlex connected."Step 4. If step 1 works but step 3 fails, the problem is <TOOL>'s configuration or environment, not RouterPlex. Check these, fix what is wrong, and repeat step 3:- The key or base URL is set in one place but not where <TOOL> starts: zsh vs bash startup files, login vs non-login shells, a desktop launcher, a background service, Windows vs WSL, or a remote SSH or container environment.- Another setting wins: OPENAI_API_KEY, OPENAI_BASE_URL, OPENAI_API_BASE, ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL, or a project-level config that overrides the user-level one.- <TOOL> is outdated, or still needs a full restart to read the new settings.- If an environment variable cannot be made to reach <TOOL> reliably and <TOOL> accepts a key in its user-level config, put the key there instead.Keep repeating steps 3 and 4 until the test reply comes back. Stop early only for a 401, 402, or 403, or for a step only I can do, such as a click in a settings window or a login. Then tell me exactly what to do, wait for me, and continue testing afterwards.When it works, tell me which files you changed, where the key is stored, and the final test output.
Add RouterPlex to an existing project #
Use this one inside the repository whose application code should call RouterPlex:
Optional. It stays in this browser tab and is never saved or sent. No key yet? Create one in guided setup.
Add RouterPlex as the LLM provider for this project. Keep working until the project's own client gets a reply through RouterPlex.My RouterPlex API key: YOUR_ROUTERPLEX_API_KEYKey handling:- If the key line above is a placeholder rather than a real key (real keys start with sk-), use my ROUTERPLEX_API_KEY environment variable. If that is empty too, ask me for the key once, then continue.- Store the key only in user-level config or my user environment. Never put it in a project file, never commit it, and do not repeat the full key in your replies.References: https://docs.routerplex.com/openai-sdk and https://docs.routerplex.com/anthropic-messagesStep 1. Prove the key and the RouterPlex gateway work before changing anything else. Run:curl -sS https://api.routerplex.com/v1/chat/completions -H "Authorization: Bearer YOUR_ROUTERPLEX_API_KEY" -H "Content-Type: application/json" -d '{"model":"claude-sonnet-4-6","max_tokens":32,"messages":[{"role":"user","content":"Reply with exactly: RouterPlex connected."}]}'On Windows PowerShell, use curl.exe with the body in a file, or Invoke-RestMethod.- A reply containing "RouterPlex connected.": go on.- 401: the key is wrong or revoked. Stop and ask me for a correct key.- 402: my balance or trial credit is used up. 403: this key reached its own spending limit. Stop and tell me; retrying cannot fix these.- Network, DNS, TLS, or proxy errors: find and fix the cause (proxy variables, VPN, firewall, system clock, outdated CA certificates), then run it again.Step 2. Find every place this codebase creates an LLM client or calls an LLM API (OpenAI SDK, Anthropic SDK, LangChain, LlamaIndex, Vercel AI SDK, or raw HTTP). List them for me before changing anything.Step 3. Keep the SDK the project already uses. RouterPlex speaks both wire formats:- OpenAI-compatible clients: base URL https://api.routerplex.com/v1- Anthropic SDKs: base URL https://api.routerplex.com (the SDK appends /v1/messages)Read the key from a ROUTERPLEX_API_KEY environment variable and the base URL from config, so the provider stays switchable. Add both names with placeholder values only to .env.example or the project's equivalent. Put the real key only in an untracked local env file that .gitignore covers.Step 4. Use exact model IDs from https://docs.routerplex.com/catalog.json. If a model the code uses has no RouterPlex equivalent, tell me instead of picking one. Do not change prompts, retries, or business logic beyond what the switch requires.Step 5. Run the existing tests, then make one short real request through the project's own client. If it fails while step 1 works, the cause is in the project: how it loads environment variables, a base URL or key still pointing elsewhere, or an SDK option that overrides them. Fix it and try again until the reply comes back.When it works, tell me which files you changed and show the final reply.
Switch from OpenRouter #
Optional. It stays in this browser tab and is never saved or sent. No key yet? Create one in guided setup.
Migrate this project from OpenRouter to RouterPlex. Keep working until the project gets a reply through RouterPlex.My RouterPlex API key: YOUR_ROUTERPLEX_API_KEYKey handling:- If the key line above is a placeholder rather than a real key (real keys start with sk-), use my ROUTERPLEX_API_KEY environment variable. If that is empty too, ask me for the key once, then continue.- Store the key only in user-level config or my user environment. Never put it in a project file, never commit it, and do not repeat the full key in your replies.Reference: https://docs.routerplex.com/llms-full.txtStep 1. Prove the key and the RouterPlex gateway work before changing anything else. Run:curl -sS https://api.routerplex.com/v1/chat/completions -H "Authorization: Bearer YOUR_ROUTERPLEX_API_KEY" -H "Content-Type: application/json" -d '{"model":"claude-sonnet-4-6","max_tokens":32,"messages":[{"role":"user","content":"Reply with exactly: RouterPlex connected."}]}'On Windows PowerShell, use curl.exe with the body in a file, or Invoke-RestMethod.- A reply containing "RouterPlex connected.": go on.- 401: the key is wrong or revoked. Stop and ask me for a correct key.- 402: my balance or trial credit is used up. 403: this key reached its own spending limit. Stop and tell me; retrying cannot fix these.- Network, DNS, TLS, or proxy errors: find and fix the cause (proxy variables, VPN, firewall, system clock, outdated CA certificates), then run it again.Step 2. Find every OpenRouter reference: the base URL https://openrouter.ai/api/v1, OPENROUTER_API_KEY, HTTP-Referer and X-Title headers, and OpenRouter-only request fields such as provider, models, route, and transforms. List them for me before changing anything.Step 3. Change the base URL to https://api.routerplex.com/v1 and the key to a ROUTERPLEX_API_KEY environment variable. For Anthropic SDK clients, use https://api.routerplex.com with no /v1. Remove the OpenRouter-only headers and request fields; RouterPlex does not use them.Step 4. Map every model ID. OpenRouter uses vendor/model IDs (for example anthropic/claude-sonnet-4.6); RouterPlex uses the bare IDs in https://docs.routerplex.com/catalog.json (for example claude-sonnet-4-6). Show me the mapping table before applying it. If a model has no RouterPlex equivalent, flag it; do not substitute a different model on your own.Step 5. Run the existing tests, then make one short real request through the project's own client. If it fails while step 1 works, find what still points at OpenRouter or how the project loads its environment, fix it, and try again until the reply comes back.When it works, tell me which files you changed and show the final reply.
Set your key first #
Paste your key into a prompt's key field, or set it in the terminal where your agent runs. Create a dedicated key in guided setup and give it a budget you are comfortable with. On macOS or Linux:
export ROUTERPLEX_API_KEY="YOUR_ROUTERPLEX_API_KEY"
On Windows PowerShell:
$env:ROUTERPLEX_API_KEY = "YOUR_ROUTERPLEX_API_KEY"
A prompt with your key in it is a secret: paste it only into an agent you trust, and do not share it. Review the agent's changes before you accept them, and confirm the test request under your key in Usage.
If the agent gets stuck #
- 401: the key is wrong or revoked. Create a new key and paste it again.
- 402 or 403: a balance or key limit stopped the test request. See Errors & limits; retrying does not help.
- Model not found: the model ID does not match the catalog exactly, or the key's allowlist excludes it.
Each prompt links to its full guide. If a step fails, follow the guide by hand: Claude Code, Codex CLI, OpenCode, or all integrations.