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

How to run Claude Code on other model providers with My Free Code

Route Claude Code requests through a local gateway to the provider models you configure.

Short answer: Run python -m venv .venv, then activate it with source .venv/bin/activate on macOS or Linux; then run python -m pip install -r requirements.txt; run cp .env.example .env, then set MODEL, MODEL_SONNET, MODEL_HAIKU, and MODEL_OPUS plus the matching provider API keys in .env. All steps.

Credentials. Provider API keys are stored in the .env file, so keep .env out of commits and never share it.

Who it is forA developer who uses Claude Code daily and wants to try or pay for models from other providers when a session starts.

The problemClaude Code expects its own model backend, so switching providers normally means changing the agent or giving up its workflow.

The outcomeClaude Code runs against a local gateway address, and each Claude tier (Sonnet, Haiku, Opus) maps to the provider model you set in .env.

What you need first

  • Python 3.11 or newer
  • A clone of the my-free-code repository
  • At least one provider API key for the MODEL values you choose, or a local model server such as Ollama, LM Studio, or llama.cpp
  • Claude Code or another supported client installed and on PATH

Steps

  1. Run python -m venv .venv, then activate it with source .venv/bin/activate on macOS or Linux.
  2. Run python -m pip install -r requirements.txt.
  3. Run cp .env.example .env, then set MODEL, MODEL_SONNET, MODEL_HAIKU, and MODEL_OPUS plus the matching provider API keys in .env.
  4. Run python -m my_free_code in one terminal and keep it running at http://127.0.0.1:8082.
  5. Run python -m my_free_code.cli.mfc claude in a second terminal to start Claude Code through the gateway.

Prompt for your agent

Work in the my-free-code repository. Set MODEL_SONNET in .env to <provider/model-id>, start the gateway with python -m my_free_code, then launch Claude Code with python -m my_free_code.cli.mfc claude. Expected output: Claude Code opens and answers a short test prompt. Verify that the gateway log shows a request routed to <provider/model-id>.

Caveat. The project states it is an independent implementation and is not affiliated with Anthropic.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for hkqr/my-free-code and "Run Claude Code on other model providers"

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