Urgent.News

What's breaking now, across thousands of outlets.

AI

Run Claude Code on open-weight models, hosted in the US

Disclosure: I'm a co-founder of ScaledThought, the API used below. Drafted with AI assistance. Claude Code talks to its model through the Anthropic Messages API, and it lets you change where those requests go with ANTHROPIC_BASE_URL . Point it at an API that speaks the same protocol and Claude Code keeps its tools, permissions and workflow while a different model does the thinking. This…

Claude Code allows you to run code using open-weight models hosted in the US. This is achieved by changing the location of requests in the Anthropic Messages API with the ANTHROPIC_BASE_URL. By pointing it at ScaledThought, an API compatible with OpenAI and Anthropic, Claude Code maintains its tools, permissions, and workflow while using a different model to perform the actual thinking.

To start, you need to obtain a key. This can be done by an agent or by running the CLI command "npx -y scaledthought@0.3 init --region us --source org-devto --email you@example.com". This command writes the ST_API_KEY and ST_BASE_URL to the .env file, which is not displayed and added to .gitignore. The usage is prepaid, with a top-up link to approve and no subscription required. Users can choose a daily budget to prevent runaway sessions from incurring costs.

To set up Claude Code, the environment variables ST_API_KEY, ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_MODEL, and ANTHROPIC_DEFAULT_HAIKU_MODEL need to be exported. These variables allow Claude Code to communicate with the API and specify the model to use.

When using Claude Code, keep in mind that the model being used may not be Claude. The system prompt tells the model it is Claude, so an open model might introduce itself in that manner. The response model field will indicate which model actually answered the request.

Claude Code's request are sent under a Claude model name, and while Anthropic's server-side tools like web search are not available, Claude Code still functions. It assumes a 200k-token context window for auto-compaction and billing is charged per token reported by the model server. For current models and prices, visit scaledthought.com/pricing or run "npx -y scaledthought@0.3 models --live".

The full guide, including the MCP server for keys, budgets, and billing within Claude Code, can be found at scaledthought.com/guides/claude-code. Claude and Claude Code are trademarks of Anthropic, and model names are trademarks of their respective owners.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

This story

This is one outlet's version. Read the fullest account.

Read the original at dev.to →

More in AI

More from Tuesday 13 October →