# Sference Switch

> A macOS app that routes every Claude Code and Codex session on your Mac to sference models with one switch, and back to native providers with the same switch.

Source: https://sference.com/docs/switch

**Sference Switch** is a macOS menu bar app with a local gateway. It routes the coding agents you already use, Claude Code and Codex, between their native providers and open models served by sference. It is controlled by a single on/off switch.

[`sference launch`](https://sference.com/docs/cli#launch-a-coding-agent) configures one session at a time. Switch works at the machine level instead: once it is on, every Claude Code session on the Mac is routed, including ones that are already running. You don't need a wrapper command, environment variables, or edits to Claude Code's configuration.

![The Sference Switch app: the Switch toggle, the signed-in account, and the live request path for Claude Code and Codex](https://sference.com/docs/sference-switch-overview.png)

> **Beta**
>
> Sference Switch is under active development, and its interfaces and configuration may change between releases. It requires macOS 13 or newer (Apple Silicon or Intel). The build is not yet notarized by Apple, so on first launch you may need to allow it under **System Settings → Privacy & Security → Open Anyway**.

## Install

```bash
curl -fsSL https://get.sference.com | sh
```

The installer downloads the latest release, verifies its checksum, installs the `sference-switch` CLI to `~/.local/bin` and the app to `~/Applications`. Homebrew is not needed.

## Get started

Open the app, then:

1. **Sign in.** Go to **Account → Sign In**. The app shows a verification code and opens the approval page in your browser.
2. **Turn on the Switch.** The first time, macOS asks for your password once. This installs a local system service and adds an entry to `/etc/hosts`.
3. **Pick a model.** In Claude Code, run `/model`. Sference models are listed with a `[Sference]` prefix next to the Claude models. To use a 1M-context model's full window, choose its `… (1M context)` entry.

Claude models keep working as before. Anything you don't route to sference goes to Anthropic with your normal login.

## What the app shows

- **Switch**: global routing on/off. Your model mappings are kept while it is off.
- **Account**: the signed-in sference account and session state.
- **Live request path**: for each client, the gateway's health, the model that is actually serving requests, and the fallback.
- **Traffic** and **Requests**: recent requests, latency, and spend.
- **Clients**: per-client model mapping for Claude Code and Codex.

## Claude Code

Claude Code needs no configuration and no restart. When the Switch is on, inference requests (`/v1/messages`) and model discovery go to sference. Sign-in, feature flags, and everything else go to Anthropic unchanged, so Claude Code behaves exactly as it does natively.

You can also map whole Claude model families to a sference model, for example so that sub-agents requesting `sonnet` run on GLM:

```bash
sference-switch claude route sonnet zai-org/GLM-5.2
sference-switch claude route sonnet native     # send this family back to Anthropic
sference-switch claude subagents zai-org/GLM-5.2
```

A family can also be mapped to `sference/auto` ([auto model routing](https://sference.com/docs/models#auto-model-routing), beta, org opt-in), which picks a model per session instead of pinning one:

```bash
sference-switch claude route sonnet sference/auto
```

## Codex

Codex support is opt-in. Switch writes a separate profile (`~/.codex/sference.config.toml`) and does not modify `~/.codex/config.toml`:

```bash
sference-switch codex on
sference-switch codex route zai-org/GLM-5.2
codex --profile sference
```

Start Codex without `--profile sference` to use OpenAI as usual. `sference-switch codex off` removes the profile.

## Turning it off

Flip the Switch off in the app, or run `sference-switch off`. Requests go back to native providers immediately. To remove the system service and the `/etc/hosts` entry as well:

```bash
sudo sference-switch intercept off
sudo sference-switch tls service uninstall
```

`sference-switch uninstall --dry-run` shows everything a full uninstall would remove.

## How it works

Turning the Switch on points `api.anthropic.com` at a local service via `/etc/hosts`. That service presents a certificate from a local Sference Switch certificate authority, which is trusted in your System keychain. It forwards inference and model-list requests to the sference gateway and passes all other traffic through to Anthropic untouched. Turning the Switch off removes the redirect.

- **Everything stays on loopback.** The gateway and its admin API bind only to `127.0.0.1`.
- **Credentials go only to their own provider.** Your sference credential is sent only to sference, and your Anthropic or OpenAI credentials only to Anthropic or OpenAI.
- **Telemetry is local, metadata only.** Records contain no prompts, responses, headers, or credentials, and you can turn them off in `~/.sference/switch/gateway.yaml`.

## Troubleshooting

```bash
sference-switch status
sference-switch doctor --probe
```

`doctor` checks the whole request path and prints the first failure with a concrete fix. Logs are in `~/.sference/switch/logs/`. If your session expires, sign in again from the app or with `sference-switch auth login`.

Source, the full command reference, and releases: **[github.com/s-ference/sference-switch](https://github.com/s-ference/sference-switch)** (MIT).

- [sference launch](https://sference.com/docs/cli#launch-a-coding-agent): Run Claude Code, Codex, opencode, or Pi on sference for one session.
- [Claude Code](https://sference.com/docs/sference-code/claude-code): Model recommendations, known limits, and manual configuration.
