DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to restore the last working config after a bad gateway change with Setup Gateway

Bring back the most recent backup of Claude Code, OpenCode, or Codex config with one command.

Short answer: Run node setup-gateway.mjs status to see which base URL and model are active; then run node setup-gateway.mjs restore codex to 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. All steps.

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

  1. Run node setup-gateway.mjs status to see which base URL and model are active.
  2. Run node setup-gateway.mjs restore codex to restore Codex, or replace codex with claude or opencode for the other tools.
  3. In a terminal, pick the backup from the menu, or add --yes to take the newest one.
  4. Run node setup-gateway.mjs status again 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

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer