Who it is forA developer whose AI coding tool stopped working after a gateway, key, or model change and needs the previous config back quickly.
The problemA wrong base URL or model in a config file blocks the tool, and manual recovery means finding the right file and hand-editing it.
The outcomeThe previous config is restored, a backup of the broken state is kept, and the tool can run again.
What you need first
- Node.js 18 or newer installed
- A gateway base URL that exposes /v1 and an API key for it
- A model id the gateway serves, or access to GET /v1/models so the picker can list them
- For Codex: a gateway that serves the Responses API (/v1/responses)
Steps
- Run
node setup-gateway.mjs statusto see which base URL and model are active. - Run
node setup-gateway.mjs restore codexto restore Codex, or replace codex with claude or opencode for the other tools. - In a terminal, pick the backup from the menu, or add --yes to take the newest one.
- Run
node setup-gateway.mjs statusagain to confirm the restored values.
Prompt for your agent
In the repo Sinholms/setup-gateway, run `node setup-gateway.mjs restore <TOOL>` where <TOOL> is claude, opencode, or codex, adding --yes for the newest backup. Expect a message that the config was restored and that a backup of the previous state was made first. Verify by running `node setup-gateway.mjs status` and confirming the values match the backup.
Caveat. Restore does not touch ~/.claude.json, so any approval suffix added there by an earlier setup stays in place.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for Sinholms/setup-gateway and "Restore the last working config after a bad gateway change"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer