# Cut model costs with hosted open models

> Run Claude Code against a hosted open model without your Anthropic key ever going near it.

**Goal:** keep working in Claude Code, but send the requests to a lower-cost hosted open model that speaks the Anthropic API.

## What you need

- An account and API key from a service that hosts open models behind an anthropic-compatible endpoint. z.ai is one example, with hosted GLM models and a Claude Code setup path. We don't rank hosts or quote prices because both change faster than this page does.
- Nothing else. Storing keys and configuring endpoints is **free on every plan**.

## Steps

1. **Get the base URL and key** from your provider's docs.
2. **Add an open-model connection** in **Settings → agents → providers & keys**:

   | Field | Value |
   |-------|-------|
   | Label | `z-ai` |
   | Kind | anthropic-compatible |
   | Base URL | `https://api.z.ai/api/anthropic` |
   | Key | the key from that provider |

   The key goes to your macOS Keychain and shows masked in the field.

3. **Check it's alive** with `crystl status`. A `401` or `403` counts as reachable on purpose: something is listening and it says your credentials are the problem, which is a different fix from a dead address.
4. **Open a new shard.** Existing shards keep the environment they started with, so this only takes effect on a fresh one.

## What you'll see when it works

`crystl status` shows the slot as `reachable`, and in the new shard `echo $ANTHROPIC_BASE_URL` returns the provider's URL. Claude Code runs as usual, against their models.

**Your Anthropic key stays home.** A real hosted Anthropic key is never sent to a configured endpoint. crystl sends the slot's own key, or a documented dummy value when the endpoint doesn't need one.

Two things to weigh. These are third-party services with their own terms, their own retention policy, and their own view of your code, so read the terms the way you would for any vendor. And quality varies by task: one of them can be great at mechanical work and weak on a reasoning-heavy change, and that ordering isn't stable between providers or over time. Try it on your own work rather than trusting a benchmark.

A hosted open model doesn't have the one-machine limit a local GPU does, so you can [fan out](/docs/scenario-fan-out-cheap-workers/) on it the way you would on any hosted agent.

## Go deeper

- [Use z.ai open models with crystl](/docs/open-models-zai/) for the complete account, plan, key, and first-shard tutorial.
- [open models](/docs/open-models/#a-hosted-open-model) for the slot fields and the safety rule about keys.
- [API key storage](/docs/api-keys/) for hosted provider keys and custom environment variables.
- [Claude Code still hits the frontier API](/docs/open-models/#troubleshooting) if the change doesn't seem to take.

---
Source: https://crystl.dev/docs/scenario-cut-model-costs/
