# SferenceCode

> Route your coding agents through sference: one command per harness, open models behind the same agent loop, and per-engineer spend you can see.

Source: https://sference.com/docs/sference-code

**SferenceCode** runs your coding agents on open models. Claude Code, Pi, opencode, Codex, and Cursor keep working exactly as they do today — the harness, the tools, the workflow — but the model calls behind them go to sference instead of a closed provider.

You get open-model token prices, a per-request audit trail, and per-engineer spend attribution. The agent loop is unchanged.

## Why route a coding agent

Coding agents are the most token-hungry thing most teams run: a single refactor is hundreds of model calls, each resending a long system prompt and tool definitions. That is exactly the workload where open-model prices and prefix caching compound.

| | Closed provider | SferenceCode |
| --- | --- | --- |
| Price per 1M tokens | frontier pricing | `0.20 / 0.60` (GLM-5.3-Flash) to `3.00 / 15.00` (Kimi-K3) |
| Cached input | premium cache-write | no cache-write charge; cached input at 10–25% of input |
| Per-engineer attribution | usually per key | per key, per harness, per engineer |
| Model choice | the provider's lineup | any catalog model, or your own fine-tune |

## One command per harness

```bash
curl -fsSL https://raw.githubusercontent.com/s-ference/sference/main/install.sh | sh
sference auth login --api-key 'sk_...'
```

Then launch your harness:

| Harness | Command | Page |
| --- | --- | --- |
| **Claude Code** | `sference launch claude` | [Claude Code](https://sference.com/docs/sference-code/claude-code) |
| **Pi** | `sference launch pi` | [Pi](https://sference.com/docs/sference-code/pi) |
| **opencode** | `sference launch opencode` | [opencode](https://sference.com/docs/sference-code/opencode) |
| **Codex CLI** | manual config | [Codex](https://sference.com/docs/sference-code/codex) |
| **Cursor** | manual config | [Cursor](https://sference.com/docs/sference-code/cursor) |

Each launcher writes the harness's own config file with a `sference` provider and starts it. Nothing global is changed, so your existing providers stay available.

> **What the launchers write**
>
> `sference launch <harness>` edits only that harness's config — `~/.pi/agent/models.json` for Pi, `~/.config/opencode/opencode.json` for opencode, and so on. Run it with `--dry-run` to print the config and command without launching anything.

## Choosing a model

| Model | Input / output per 1M | Use for |
| --- | --- | --- |
| `zai-org/GLM-5.3-Flash` | 0.20 / 0.60 | Fast edits, formatting, small refactors, agent routing |
| `zai-org/GLM-5.3` | 1.20 / 4.20 | General coding turns; the default for most harnesses |
| `deepseek-ai/DeepSeek-V4.1-Flash` | 0.50 / 1.50 | Long-context work at low cost |
| `moonshotai/Kimi-K3` | 3.00 / 15.00 | Hard planning turns, multi-file reasoning |

Start on `GLM-5.3`, move routine turns to `Flash`, and reserve `Kimi-K3` for the turns that actually need it. Live ids and rates: `GET https://api.sference.com/v1/models`.

## What to expect

**It is a compatibility layer.** Open models plan differently and call tools less reliably than frontier closed models on long repo work. It is genuinely useful for scripted runs, bulk refactors, and cost-sensitive loops. Validate on your own repository before committing a workflow.

**Two calls per prompt is normal.** Claude Code fires a separate title-generation request alongside your turn. sference detects it, caps it, and forces reasoning off so it does not burn tokens. Seeing two requests per prompt is expected.

**Thinking works, signatures do not.** Reasoning models stream `thinking` blocks that render normally, but `signature` is empty; multi-turn thinking continuity is best-effort.

**Prefix caching is the main lever.** Every agent turn resends the system prompt and tool definitions. Keep them stable and first, and those tokens bill at the cached rate. See [Prompt caching](https://sference.com/docs/guides/prompt-caching).

## Spend attribution

Every request records the key that made it, so spend splits by engineer and by harness. `GET /control/v1/usage/by-key` and `GET /control/v1/activity` give the breakdown; see [Usage & analytics](https://sference.com/docs/usage).

Give each engineer their own key (or their own harness profile) and the console's usage view answers "who spent what" without any instrumentation on your side.

- [Claude Code](https://sference.com/docs/sference-code/claude-code): Proxy mode with hybrid routing: sference models alongside real Claude models.
- [Pi](https://sference.com/docs/sference-code/pi): Provider block in ~/.pi/agent/models.json, picker scoped to sference.
- [opencode](https://sference.com/docs/sference-code/opencode): sference provider in opencode.json with the full catalog in the picker.
- [Usage & analytics](https://sference.com/docs/usage): Per-key and per-member spend attribution.
