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, Hermes Agent, Pi, or another agent). Paste your key into any prompt's key field and it fills every prompt on this page. The agent backs up and shows you each config change, sets everything up, then keeps testing until a real request goes through RouterPlex, followed by one real tool call, fixing environment problems along the way. It ends with a list of what it changed so you can undo it.
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 (show at most its first 8 characters).Config handling:- Before changing an existing config file or shell startup file, copy it to a .bak file next to it and show me the diff. Merge into what is there; never replace my other settings, providers, or MCP servers.- If a step needs something only I can do, such as a click in a settings window, print the exact steps instead of guessing.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, and it also reaches Claude Code when an app such as Conductor or a desktop launcher starts it. For the Claude Code VS Code extension, also set the same variables in VS Code's user settings under "claudeCode.environmentVariables" (a list of {"name", "value"} objects).- Use ANTHROPIC_AUTH_TOKEN for the key, not ANTHROPIC_API_KEY: it outranks a saved claude.ai login and needs no approval prompt.- If I want a non-Claude model (any chat model from https://routerplex.com/api/models), also set CLAUDE_CODE_MAX_CONTEXT_TOKENS to that model's context_tokens minus max_output_tokens. Claude Code otherwise assumes 200,000 tokens for IDs that do not start with claude- and compacts too early.- You cannot switch your own running session to RouterPlex. Test in a new process, and tell me to start a new session afterwards. If a session ever says "Not logged in", I must not run /login (that signs in to Anthropic instead); restarting with claude --resume picks up the settings.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.Step 5. The test above sends no tools, but real sessions send every tool, MCP server, and plugin schema with each request, and that is where models differ. From a folder with a README.md (create a temporary one containing "# RouterPlex tool check" if needed), run:claude --model claude-sonnet-4-6 -p "List your available tools, then read ./README.md and reply with its first heading."It passes when the reply lists the tools and quotes the heading. If it fails while step 3 passes, the tool schemas are the problem, not the connection. Tell me the exact error; the chosen model may not handle Claude Code's tools, so suggest another tool-capable model from https://routerplex.com/models.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 exactly which files you changed and which values you set (key shown by its first 8 characters only) so I can undo it, where the key is stored, and the final test output. Remind me that every request shows up in https://routerplex.com/dashboard/usage.
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 (show at most its first 8 characters).Config handling:- Before changing an existing config file or shell startup file, copy it to a .bak file next to it and show me the diff. Merge into what is there; never replace my other settings, providers, or MCP servers.- If a step needs something only I can do, such as a click in a settings window, print the exact steps instead of guessing.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. Leave requires_openai_auth unset; setting it makes Codex demand a ChatGPT login.- If I pick a non-OpenAI model, also set model_context_window to its context_tokens minus max_output_tokens from https://routerplex.com/api/models, and drop model_reasoning_effort for models without reasoning.- Make ROUTERPLEX_API_KEY permanent for my user so new terminals get it:- macOS/Linux: add export ROUTERPLEX_API_KEY='<key>' (keep the word export: a plain ROUTERPLEX_API_KEY=... line is invisible to programs started from the shell) 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.Step 5. The test above sends no tools, but real sessions send every tool, MCP server, and plugin schema with each request, and that is where models differ. From a folder with a README.md (create a temporary one containing "# RouterPlex tool check" if needed), run:codex exec --model gpt-5.6-terra "List your available tools, then read ./README.md and reply with its first heading."To test without touching my real Codex setup, copy ${CODEX_HOME:-~/.codex} to a temporary folder, run the command with CODEX_HOME set to that folder, then delete the folder (it contains my Codex credentials).It passes when the reply lists the tools and quotes the heading. If it fails while step 3 passes, the tool schemas are the problem, not the connection. Tell me the exact error; the chosen model may not handle Codex CLI's tools, so suggest another tool-capable model from https://routerplex.com/models.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 exactly which files you changed and which values you set (key shown by its first 8 characters only) so I can undo it, where the key is stored, and the final test output. Remind me that every request shows up in https://routerplex.com/dashboard/usage.
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 (show at most its first 8 characters).Config handling:- Before changing an existing config file or shell startup file, copy it to a .bak file next to it and show me the diff. Merge into what is there; never replace my other settings, providers, or MCP servers.- If a step needs something only I can do, such as a click in a settings window, print the exact steps instead of guessing.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","limit": {"context": 1000000,"output": 64000},"cost": {"input": 3,"output": 15,"cache_read": 0.25}}}}}}- Make ROUTERPLEX_API_KEY permanent for my user so new terminals get it:- macOS/Linux: add export ROUTERPLEX_API_KEY='<key>' (keep the word export: a plain ROUTERPLEX_API_KEY=... line is invisible to programs started from the shell) 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.- For every model I add, fill limit (context = context_tokens, output = max_output_tokens) and cost (input_per_1m, output_per_1m, cache_read_per_1m, in USD per million tokens) from https://routerplex.com/api/models. OpenCode cannot look these up for a custom provider; without them it never compacts in time and shows $0 spend.- 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.Step 5. The test above sends no tools, but real sessions send every tool, MCP server, and plugin schema with each request, and that is where models differ. From a folder with a README.md (create a temporary one containing "# RouterPlex tool check" if needed), run:opencode run --model routerplex/claude-sonnet-4-6 "List your available tools, then read ./README.md and reply with its first heading."It passes when the reply lists the tools and quotes the heading. If it fails while step 3 passes, the tool schemas are the problem, not the connection. Tell me the exact error; the chosen model may not handle OpenCode's tools, so suggest another tool-capable model from https://routerplex.com/models.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 exactly which files you changed and which values you set (key shown by its first 8 characters only) so I can undo it, where the key is stored, and the final test output. Remind me that every request shows up in https://routerplex.com/dashboard/usage.
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 (show at most its first 8 characters).Config handling:- Before changing an existing config file or shell startup file, copy it to a .bak file next to it and show me the diff. Merge into what is there; never replace my other settings, providers, or MCP servers.- If a step needs something only I can do, such as a click in a settings window, print the exact steps instead of guessing.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>' (keep the word export: a plain ROUTERPLEX_API_KEY=... line is invisible to programs started from the shell) 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.Step 5. The test above sends no tools, but real sessions send every tool, MCP server, and plugin schema with each request, and that is where models differ. Ask me to send this in a new <TOOL> chat and report the reply: List your available tools, then read ./README.md and reply with its first heading.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 exactly which files you changed and which values you set (key shown by its first 8 characters only) so I can undo it, where the key is stored, and the final test output. Remind me that every request shows up in https://routerplex.com/dashboard/usage.
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 (show at most its first 8 characters).Config handling:- Before changing an existing config file or shell startup file, copy it to a .bak file next to it and show me the diff. Merge into what is there; never replace my other settings, providers, or MCP servers.- If a step needs something only I can do, such as a click in a settings window, print the exact steps instead of guessing.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 (show at most its first 8 characters).Config handling:- Before changing an existing config file or shell startup file, copy it to a .bak file next to it and show me the diff. Merge into what is there; never replace my other settings, providers, or MCP servers.- If a step needs something only I can do, such as a click in a settings window, print the exact steps instead of guessing.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, Hermes Agent, Pi, or all integrations.