DEDUPED Hot AI repos, turned into use cases Get 5 a day

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.

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.

Share: X LinkedIn Hacker News Email Copy link

Disclaimer

Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked "Seen in the wild", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email [email protected] and we will look at it promptly. Full disclaimer page