One-shot local configurator for coding agents against a Substrate gateway
Project description
substrate-setup
One-shot configurator that points local coding agents at a Substrate gateway.
Install
substrate-setup requires Python 3.12+. The installers below pick the right interpreter automatically — you don't need a Python 3.12 already on your machine:
# Option A — uv (recommended; downloads Python 3.12 on demand if missing)
uv tool install substrate-setup
# Option B — pipx
pipx install substrate-setup
Don't have uv? Install it once with:
curl -LsSf https://astral.sh/uv/install.sh | sh # macOS / Linux
# or on Windows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Why not
pip install substrate-setup? It works only if thepipon your PATH is bound to a Python 3.12+ interpreter. Anaconda's defaultpip(Python 3.9) is the common pitfall — PyPI hides every release from it withRequires-Python >=3.12and the error message is unhelpful.uvandpipxboth create an isolated 3.12 venv for the tool, so they sidestep the issue entirely.
Use
substrate-setup configure # detect installed agents and wire them up
substrate-setup verify # read-only: confirm everything points at the gateway
substrate-setup remove # strip the substrate-managed entries
substrate-setup --help
After running configure
substrate-setup configure writes the API key for you automatically. On Windows it lands in HKCU\Environment\SUBSTRATE_API_KEY (visible to Codex Desktop and other GUI agents on next launch). On macOS / Linux it lands in your shell rc (~/.zshrc, ~/.bashrc, or ~/.config/fish/config.fish depending on $SHELL) inside a marker-fenced block — re-running configure replaces the block in place, no duplicates.
You should not need to set SUBSTRATE_API_KEY by hand. If auto-persistence fails (the printed message will say API key WARNING: …), you can set it manually:
- Windows:
[Environment]::SetEnvironmentVariable("SUBSTRATE_API_KEY", "<your-key>", "User")then re-launch the agent. - macOS / Linux: add
export SUBSTRATE_API_KEY=<your-key>to your shell rc andsourceit.
Supported agents: hermes, cursor, aider, continue, claude-code, codex.
Subset with --agents-only hermes,aider. Preview without writing: --dry-run. Override the gateway base URL: --base-url https://your-gateway.example.com.
Per-agent catalog UX (0.3.0+)
| Agent | How it learns about Substrate's models |
|---|---|
hermes |
Live URL fetch via model_catalog.providers.substrate.url. Picker shows all chat-capable Substrate models, refreshed on Hermes' 24h TTL. |
cursor |
Walkthrough printed after configure — copy the base URL, key, and model ids into Cursor's Settings → Models. |
aider |
~/.aider.model.metadata.json written with one entry per chat-capable Substrate model. Use --model openai/<id> to switch. |
continue |
All chat-capable Substrate models written as separate models: entries in ~/.continue/config.yaml. |
claude-code |
~/.claude/settings.json env block (ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_MODEL). The /model picker stays opus/sonnet/haiku — use claude --model openai/<id> for any other Substrate model. Requires Substrate's /v1/messages endpoint — shipped in gateway Phase 1. |
codex |
~/.codex/config.toml [model_providers.substrate] block with wire_api = "responses". API key is auto-persisted (see above). Requires Substrate's /v1/responses endpoint — shipped in gateway Phase 2. |
Heads-up: tool calling on Gemini 3.1 Pro Preview
If your CLI agent (Hermes, Aider, etc.) uses tool calling against
google/gemini-3.1-pro-preview, expect occasional misses (~20-30% of
attempts). All other Substrate models hit ≥95% reliability for tool calls.
Troubleshooting
Windows: Defender SmartScreen prompts on every Codex click
Codex Desktop spawns helper binaries (codex-command-runner.exe,
node_repl.exe) per UI action. With sandbox = "elevated" in
~/.codex/config.toml, each spawn triggers Windows Defender
SmartScreen, prompting you on every click until the Codex install
directory is whitelisted.
One-time fix — open an Administrator PowerShell window and run:
Add-MpPreference -ExclusionPath "$env:LOCALAPPDATA\OpenAI\Codex"
This excludes Codex's binaries from real-time scanning. Reverse with
Remove-MpPreference -ExclusionPath "$env:LOCALAPPDATA\OpenAI\Codex".
substrate-setup configure --agents-only codex also prints this
command at the end of its walkthrough on Windows.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file substrate_setup-0.3.1.tar.gz.
File metadata
- Download URL: substrate_setup-0.3.1.tar.gz
- Upload date:
- Size: 67.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
103bc9f1ba70ebbd153c4a447ad213fc09daf44afb39b7c4adaa9baed2bb4bf9
|
|
| MD5 |
e59046a1ef23c53ca9384743393a6880
|
|
| BLAKE2b-256 |
1d616c9ecd885d302df49e92d1e0c79e701002724c6e00072f4c2524223ef5ab
|
File details
Details for the file substrate_setup-0.3.1-py3-none-any.whl.
File metadata
- Download URL: substrate_setup-0.3.1-py3-none-any.whl
- Upload date:
- Size: 41.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1b2b066313eacaf9ba689006168a75a454f4aea7e5837fc59c9dc299cb706ff
|
|
| MD5 |
97a589b2f1834bc40d102a789a08a479
|
|
| BLAKE2b-256 |
588f6a7e6a73cb074783edd6297194ce3ac3e9826ccf0550adb3fbdfd756ac7a
|