If you use pi as your coding agent, you know the drill: pick a model, hit the context ceiling mid-task, compact, and lose the thread. For me, the fix came quieter than I expected — not a new agent, not a new wrapper, but a new provider on an endpoint I was already hitting.
Relace (models.relace.ai) exposes an OpenAI-compatible Chat Completions server. That one fact does most of the work: it means pi — which already speaks openai-completions natively — can be pointed at Relace with no custom streaming, no OAuth dance, no fork. Just configuration.
The headline model is deepseek-ai/DeepSeek-V4-Flash-0731: roughly 1M tokens of context, 384K max output, reasoning-enabled, and text-native. That's the kind of window that changes how you work — you stop rationing the conversation and start working through longer, real tasks.
The setup is the point
Because pi treats Relace as a first-class provider, the whole thing becomes a one-liner:
pi install npm:pi-relace-provider@0.1.3Set one environment variable:
export RELACE_API_KEY=...And you're off:
pi --provider relace --model "deepseek-ai/DeepSeek-V4-Flash-0731"There's nothing proprietary about the integration. It's a thin, declarative package — a single index.ts that hands pi a base URL, an API type (openai-completions), and a model definition. That's the whole trick, and it's arguably the best part: no proprietary SDK, no vendor lock-in. If you tire of Relace, the same package shape ports to any other compatible endpoint with a config change.
Why the 1M context matters more than it sounds
Raw context numbers are easy to dismiss. But for an agent that reads files, runs tools, and holds more of the session in its working memory, the difference between 128K and 1M isn't linear — it's the difference between a model that summarizes what it forgot and a model that still knows. Fewer compactions, fewer dropped threads, cleaner reasoning across the whole session.
And the ergonomics held up in testing: the extension loads, the model lists, and auth resolves from pi's local credential store. Verified end to end on the real binary — a plain request round-tripped cleanly on the first try.
How it's shaped
If you're the kind of person who likes to see what they're running, the package is open and small: a manifest (package.json), a single extension (index.ts), the docs, and the license. Rusty anywhere? It's yours. Add models by copying an entry. Point it at another endpoint by editing the manifest. The whole thing is a config shape you can understand in one sitting.
| Piece | What it is |
|---|---|
package.json |
The manifest — base URL, API type, model entries |
index.ts |
The entire extension logic |
| Docs + license | Everything else |
The part I'd flag
Relace ships as a two-piece setup: the model provider (this package) and, separately, a compaction router (relace-compact-pi). They're independent — call the model directly or route expensive summarizations through Relace's separate compact endpoint. Both read RELACE_API_KEY, but they're not the same product. It's worth keeping their mental models separate.
Ship it
Whether or not you adopt Relace, the pattern is worth stealing: a provider package in a few minutes, no lock-in, full autonomy over the model list. That's a genuinely nice shape for tooling — and deepseek-ai/DeepSeek-V4-Flash-0731 at 1M context is a genuinely nice place to point it.
Set it up, or fork the package and make it yours. Either way, your agent owes you less context anxiety.