Save this file, then replace the placeholder key — or paste your key in the header and copy.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"myprovider": {
"npm": "@ai-sdk/openai-compatible",
"name": "DiscreteStack",
"options": {
"baseURL": "https://api.discretestack.eu/v1",
"apiKey": "sk-your-api-key"
},
"models": {
"discretestack-max": {
"name": "discretestack-max",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"limit": {
"context": 1000000,
"output": 32000
},
"variants": {
"low": { "reasoningEffort": "low" },
"high": { "reasoningEffort": "high" },
"max": { "reasoningEffort": "max" }
}
},
"discretestack-compact": {
"name": "discretestack-compact",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"limit": {
"context": 1000000,
"output": 32000
},
"variants": {
"low": { "reasoningEffort": "low" },
"medium": { "reasoningEffort": "medium" },
"high": { "reasoningEffort": "high" }
}
},
"discretestack-fast": {
"name": "discretestack-fast",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"limit": {
"context": 1000000,
"output": 32000
}
}
}
}
}
}
Save this file, then replace the placeholder key — or paste your key in the header and copy.
This setup is for OpenCode 2, the newly rebuilt version of OpenCode (currently in beta). If you still use the older OpenCode 1, use the OpenCode 1.x tab instead — its settings are not compatible with this one.
Upgrading from OpenCode 1? Follow the official migration guide.
{
"$schema": "https://opencode.ai/config.json",
"model": "myprovider/discretestack-max",
"provider": {
"myprovider": {
"npm": "@ai-sdk/openai-compatible",
"name": "DiscreteStack",
"options": {
"baseURL": "https://api.discretestack.eu/v1",
"apiKey": "sk-your-api-key"
},
"models": {
"discretestack-max": {
"name": "discretestack-max",
"limit": {
"context": 1000000,
"output": 32000
},
"variants": {
"low": { "reasoningEffort": "low" },
"high": { "reasoningEffort": "high" },
"max": { "reasoningEffort": "max" }
}
},
"discretestack-compact": {
"name": "discretestack-compact",
"limit": {
"context": 1000000,
"output": 32000
},
"variants": {
"low": { "reasoningEffort": "low" },
"high": { "reasoningEffort": "high" },
"max": { "reasoningEffort": "max" }
}
},
"discretestack-fast": {
"name": "discretestack-fast",
"limit": {
"context": 1000000,
"output": 32000
}
}
}
}
}
}
Share a session for support. These sessions live only on your machine — we cannot see them unless you send them.
If OpenCode hits a problem, export that conversation to a file and send it to DiscreteStack support.
- You can run these commands from any folder.
- Show your recent OpenCode conversations:
opencode session listYou will see a table with a Session ID (starts with
ses_), a title, and when it was last updated. Find the conversation that had the problem and copy its Session ID.Example output:
ses_0bdc56fd1ffe… Weather in Sofia 5:55 PM - Export that session to a file on your computer.
Replace
ses_XXXXwith the Session ID you copied. Choose one option:# Option A (recommended) — hides sensitive details
opencode session export ses_XXXX --sanitize > opencode-session.json
# Option B — full conversation, including your prompts
# Use only if you are comfortable sharing what you typed
opencode session export ses_XXXX > opencode-session.json# Option A (recommended) — hides sensitive detailsThis creates a file named
opencode session export ses_XXXX --sanitize | Out-File -Encoding utf8 opencode-session.json
# Option B — full conversation, including your prompts
# Use only if you are comfortable sharing what you typed
opencode session export ses_XXXX | Out-File -Encoding utf8 opencode-session.jsonopencode-session.jsonin your current folder (the folder shown in the terminal before you ran the command). - Send
opencode-session.jsonto DiscreteStack support (email, ticket, or whatever channel you use). You can find the file in in the same folder as your terminal.
Cursor is configured from its Settings UI — no config file to edit. Paste your key in the header to preview it in the mockup.
In the top menu where it says Add or search model, click View All Models → + Add Custom Model and add each one:
Your DiscreteStack models now show up in the model picker — select one and start prompting.
Share a session for support. These sessions live only on your machine — we cannot see them unless you send them.
If Cursor Agent hits a problem, share that conversation file with DiscreteStack support.
- Go to Cursor’s projects folder:
Then list the folders:
lsEach folder is a project. Names encode the full path to your project (for example
/Users/you/AI/my-appbecomes something likeUsers-you-AI-my-appC:\Users\you\AI\my-appbecomes something likec-Users-you-AI-my-app). Pick the folder that matches the project where the problem happened. - List the Agent conversations for that project:
ls <project>/agent-transcriptsReplace
<project>with the folder name from the previous step. Each folder name is a conversation ID (a long UUID). Open the one from when the problem happened, then find the.jsonlfile inside:ls <project>/agent-transcripts/<session-id>
Full path looks like:
<project>/agent-transcripts/<session-id>/<session-id>.jsonl - Send that
.jsonlfile to DiscreteStack support (email, ticket, or whatever channel you use). You can open the folder in and attach the file from there: Tip: before sending, open the file and remove any API keys or secrets if you see them.
For a standalone DiscreteStack API key. If you log in with an Anthropic subscription, use claude-ds instead — do not edit settings.json.
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "sk-your-api-key",
"ANTHROPIC_BASE_URL": "https://api.discretestack.eu",
"API_TIMEOUT_MS": "3000000",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "discretestack-max[1m]",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "discretestack-compact[1m]",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "discretestack-fast[1m]",
"CLAUDE_CODE_MAX_CONTEXT_TOKENS": "1000000"
},
"skipWebFetchPreflight": true
}
After a fresh install, edit and set hasCompletedOnboarding to true:
{
"numStartups": 1,
"installMethod": "native",
"autoUpdates": false,
"tipsHistory": {
"new-user-warmup": 1
},
"hasCompletedOnboarding": true,
"projects": {}
}
Important
Only change hasCompletedOnboarding from false to true. This skips the initial setup wizard.
Use discretestack-compact-external to route Claude Code requests through DiscreteStack to your own provider (Anthropic, OpenRouter, etc.). DiscreteStack authenticates your API key; your provider credentials travel in custom headers and are never stored.
Not a full config. Merge the two entries below into the existing env section of — alongside Configuration.
Only ANTHROPIC_CUSTOM_HEADERS changes per provider. Provider keys are not filled from the header field.
{
"env": {
// Copy these two entries into your existing env section
"ANTHROPIC_CUSTOM_HEADERS": "x-provider-url: https://api.anthropic.com \n x-provider-api-key: sk-ant-your-provider-key \n x-provider-model: claude-opus-4-7",
"ANTHROPIC_CUSTOM_MODEL_OPTION": "discretestack-compact-external"
}
}
Replace placeholders
x-provider-api-key — your real provider API key in the custom headers (see table below)
x-provider-model — the actual model you want to use
After saving the config, switch to the external model in Claude Code with the /models command and select discretestack-compact-external:
ANTHROPIC_CUSTOM_MODEL_OPTION registers discretestack-compact-external in this list. BYOK routing only applies while that model is selected.
Provider presets for ANTHROPIC_CUSTOM_HEADERS (three \n -separated lines):
| Header | Anthropic | OpenRouter |
|---|---|---|
x-provider-url |
https://api.anthropic.com |
https://openrouter.ai/api |
x-provider-api-key |
sk-ant-... |
sk-or-... |
x-provider-model |
claude-opus-4-7 |
anthropic/claude-opus-4 |
Important
Requests still go to https://api.discretestack.eu — not directly to your provider. DiscreteStack authenticates your key, substitutes provider auth, and forwards the request unchanged.
If you use Claude Code via an Anthropic subscription (Claude Pro / Team / Enterprise) rather than a standalone API key, editing would break your subscription login. The claude-ds alias solves this — it's a wrapper script that injects DiscreteStack env vars for that session only, so your main config stays untouched.
These wrapper scripts are for Anthropic subscription users only. If you use a standalone API key, use the Configuration file instead.
unchanged
env vars override, no settings.json change
Step 1 — Create the wrapper script:
#!/usr/bin/env bash export ANTHROPIC_BASE_URL="https://api.discretestack.eu" export ANTHROPIC_AUTH_TOKEN="sk-your-ds-api-key" export ANTHROPIC_DEFAULT_OPUS_MODEL="discretestack-max[1m]" export ANTHROPIC_DEFAULT_SONNET_MODEL="discretestack-compact[1m]" export ANTHROPIC_DEFAULT_HAIKU_MODEL="discretestack-fast[1m]" export CLAUDE_CODE_MAX_CONTEXT_TOKENS=1000000 export API_TIMEOUT_MS="3000000" claude "$@"
Step 2 — Make it executable and add the alias to your shell config:
# Make the script executable chmod +x ~/.claude/claude-ds.sh # Add to ~/.zshrc (or ~/.bashrc) echo 'alias claude-ds="~/.claude/claude-ds.sh"' >> ~/.zshrc source ~/.zshrc
Step 1 — Create the wrapper script (PowerShell):
$vars = @{
ANTHROPIC_BASE_URL = "https://api.discretestack.eu"
ANTHROPIC_AUTH_TOKEN = "sk-your-ds-api-key"
ANTHROPIC_DEFAULT_OPUS_MODEL = "discretestack-max[1m]"
ANTHROPIC_DEFAULT_SONNET_MODEL = "discretestack-compact[1m]"
ANTHROPIC_DEFAULT_HAIKU_MODEL = "discretestack-fast[1m]"
CLAUDE_CODE_MAX_CONTEXT_TOKENS = "1000000"
API_TIMEOUT_MS = "3000000"
}
$saved = @{}
foreach ($k in $vars.Keys) {
$saved[$k] = [Environment]::GetEnvironmentVariable($k)
[Environment]::SetEnvironmentVariable($k, $vars[$k])
}
try { claude @args }
finally {
foreach ($k in $vars.Keys) { [Environment]::SetEnvironmentVariable($k, $saved[$k]) }
}
Step 2 — Add the command to your PowerShell profile:
# Add a function to your PowerShell profile if (-not (Test-Path $PROFILE)) { New-Item -Type File -Force $PROFILE | Out-Null } Add-Content $PROFILE 'function claude-ds { & "$env:USERPROFILE\.claude\claude-ds.ps1" @args }' . $PROFILE
The wrapper restores your environment when Claude Code exits, so your normal login is unaffected. If PowerShell blocks the script, run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once.
Important
Do not put DiscreteStack settings in — this overrides your subscription credentials. The claude-ds wrapper is the correct approach for subscription users.
Want to keep your Anthropic subscription and route requests through DiscreteStack? The claude-ds-sub alias combines both — your Anthropic subscription handles the Claude Code session while the env vars route model requests to Anthropic through DiscreteStack.
Anthropic subscription only — this approach relies on Claude Code's subscription auth flow, which is specific to Anthropic.
settings.json unchanged
stable / max / fast
subscription + BYOK
Step 1 — Create the wrapper script:
#!/usr/bin/env bash export ANTHROPIC_BASE_URL="https://api.discretestack.eu" export ANTHROPIC_CUSTOM_MODEL_OPTION="discretestack-compact-external" export ANTHROPIC_CUSTOM_HEADERS="x-provider-url: https://api.anthropic.com x-provider-api-key: sk-your-ds-api-key x-provider-model: claude-opus-4-6" export API_TIMEOUT_MS="3000000" export ANTHROPIC_DEFAULT_OPUS_MODEL="discretestack-max[1m]" export ANTHROPIC_DEFAULT_SONNET_MODEL="discretestack-compact[1m]" export ANTHROPIC_DEFAULT_HAIKU_MODEL="discretestack-fast[1m]" export CLAUDE_CODE_MAX_CONTEXT_TOKENS=1000000 claude "$@"
Step 2 — Make it executable and add the alias:
# Make the script executable chmod +x ~/.claude/claude-ds-sub.sh # Add to ~/.zshrc (or ~/.bashrc) echo 'alias claude-ds-sub="~/.claude/claude-ds-sub.sh"' >> ~/.zshrc source ~/.zshrc
Step 1 — Create the wrapper script (PowerShell):
$vars = @{
ANTHROPIC_BASE_URL = "https://api.discretestack.eu"
ANTHROPIC_CUSTOM_MODEL_OPTION = "discretestack-compact-external"
ANTHROPIC_CUSTOM_HEADERS = "x-provider-url: https://api.anthropic.com`nx-provider-api-key: sk-your-ds-api-key`nx-provider-model: claude-opus-4-6"
ANTHROPIC_DEFAULT_OPUS_MODEL = "discretestack-max[1m]"
ANTHROPIC_DEFAULT_SONNET_MODEL = "discretestack-compact[1m]"
ANTHROPIC_DEFAULT_HAIKU_MODEL = "discretestack-fast[1m]"
CLAUDE_CODE_MAX_CONTEXT_TOKENS = "1000000"
API_TIMEOUT_MS = "3000000"
}
$saved = @{}
foreach ($k in $vars.Keys) {
$saved[$k] = [Environment]::GetEnvironmentVariable($k)
[Environment]::SetEnvironmentVariable($k, $vars[$k])
}
try { claude @args }
finally {
foreach ($k in $vars.Keys) { [Environment]::SetEnvironmentVariable($k, $saved[$k]) }
}
Step 2 — Add the command to your PowerShell profile:
# Add a function to your PowerShell profile if (-not (Test-Path $PROFILE)) { New-Item -Type File -Force $PROFILE | Out-Null } Add-Content $PROFILE 'function claude-ds-sub { & "$env:USERPROFILE\.claude\claude-ds-sub.ps1" @args }' . $PROFILE
The wrapper restores your environment when Claude Code exits, so your normal login is unaffected. If PowerShell blocks the script, run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once.
How it works
Your Claude.ai subscription authenticates the Claude Code session. When you select discretestack-compact-external via /models, DiscreteStack reads the custom headers, authenticates your access, and forwards the request to your provider.
When you run /models inside claude-ds-sub, Claude Code shows its standard model names — but the env vars map them to DiscreteStack models behind the scenes:
/models |
Env var | Routed to |
|---|---|---|
| Opus | ANTHROPIC_DEFAULT_OPUS_MODEL |
discretestack-max[1m] |
| Sonnet | ANTHROPIC_DEFAULT_SONNET_MODEL |
discretestack-compact |
| Haiku | ANTHROPIC_DEFAULT_HAIKU_MODEL |
discretestack-fast |
| discretestack-compact-external ✓ | ANTHROPIC_CUSTOM_MODEL_OPTION |
Your anthropic subscription |
Select options 1–3 to use DiscreteStack-hosted inference. Select option 4 to route through your external provider via subscription auth. You can switch at any time without restarting.
Set up AionUI with DiscreteStack models. We recommend pairing AionUI with OpenCode for the best experience.
Download and install AionUI. Once installed, open it once, then close it.
If you already have OpenCode configured for another DiscreteStack tool, you can skip this step.
curl -fsSL https://opencode.ai/install | bash
npm install -g opencode-ai
Copy the script below and save it to your Desktop as opencode-setup.sh (no spaces).
#!/usr/bin/env bash
set -euo pipefail
CONFIG_DIR="$HOME/.config/opencode"
CONFIG_FILE="$CONFIG_DIR/opencode.json"
BACKUP_FILE="$CONFIG_DIR/opencode.json.bak.$(date +%Y%m%d%H%M%S)"
echo "DiscreteStack OpenCode Setup"
echo "============================"
echo ""
# Check if config file exists
if [ -f "$CONFIG_FILE" ]; then
echo "Found existing config at $CONFIG_FILE"
read -p "Back up existing config? [Y/n] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]] || [[ -z $REPLY ]]; then
cp "$CONFIG_FILE" "$BACKUP_FILE"
echo "Backed up to $BACKUP_FILE"
fi
else
echo "No existing config found. Creating directory..."
mkdir -p "$CONFIG_DIR"
fi
# Ask for API key
echo ""
read -p "Enter your DiscreteStack API key: " API_KEY
if [ -z "$API_KEY" ]; then
echo "Error: API key cannot be empty."
exit 1
fi
# Write the config
cat > "$CONFIG_FILE" << EOF
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"myprovider": {
"npm": "@ai-sdk/openai-compatible",
"name": "DiscreteStack",
"options": {
"baseURL": "https://api.discretestack.eu/v1",
"apiKey": "$API_KEY"
},
"models": {
"discretestack-max": {
"name": "discretestack-max",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"limit": {
"context": 1000000,
"output": 32000
}
},
"discretestack-compact": {
"name": "discretestack-compact",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"limit": {
"context": 1000000,
"output": 32000
},
"variants": {
"low": { "reasoningEffort": "low" },
"medium": { "reasoningEffort": "medium" },
"high": { "reasoningEffort": "high" }
}
},
"discretestack-fast": {
"name": "discretestack-fast",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"limit": {
"context": 1000000,
"output": 32000
}
}
}
}
}
}
EOF
echo ""
echo "Config written to $CONFIG_FILE"
echo ""
echo "Models configured:"
echo " - discretestack-max (1M context, 32k output)"
echo " - discretestack-compact (1M context, 32k output)"
echo " - discretestack-fast (1M context, 32k output)"
echo ""
echo "Done! Restart OpenCode to pick up the new config."
Open Terminal, navigate to your Desktop, and run the script:
cd ~/Desktop ./opencode-setup.sh
Permission error?
If you see a permission error, run chmod +x opencode-setup.sh first, then run ./opencode-setup.sh again.
When prompted Back up existing config? [Y/n], type:
n
When prompted, paste your DiscreteStack API key. You can also paste it in the header above to preview it here:
Enter your DiscreteStack API key: sk-your-api-key
Copy the script below and save it to your Desktop as opencode-setup.ps1 (no spaces).
$ConfigDir = "$env:USERPROFILE\.config\opencode"
$ConfigFile = "$ConfigDir\opencode.json"
$BackupFile = "$ConfigFile.bak.$(Get-Date -Format yyyyMMddHHmmss)"
Write-Host "DiscreteStack OpenCode Setup"
Write-Host "============================"
Write-Host ""
# Check if config file exists
if (Test-Path $ConfigFile) {
Write-Host "Found existing config at $ConfigFile"
$reply = Read-Host "Back up existing config? [Y/n]"
if ($reply -eq "" -or $reply -match "^[Yy]") {
Copy-Item $ConfigFile $BackupFile
Write-Host "Backed up to $BackupFile"
}
} else {
Write-Host "No existing config found. Creating directory..."
New-Item -ItemType Directory -Force $ConfigDir | Out-Null
}
# Ask for API key
Write-Host ""
$ApiKey = Read-Host "Enter your DiscreteStack API key"
if (-not $ApiKey) {
Write-Host "Error: API key cannot be empty."
exit 1
}
# Write the config
$Config = @"
{
"`$schema": "https://opencode.ai/config.json",
"provider": {
"myprovider": {
"npm": "@ai-sdk/openai-compatible",
"name": "DiscreteStack",
"options": {
"baseURL": "https://api.discretestack.eu/v1",
"apiKey": "$ApiKey"
},
"models": {
"discretestack-max": {
"name": "discretestack-max",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"limit": {
"context": 1000000,
"output": 32000
}
},
"discretestack-compact": {
"name": "discretestack-compact",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"limit": {
"context": 1000000,
"output": 32000
},
"variants": {
"low": { "reasoningEffort": "low" },
"medium": { "reasoningEffort": "medium" },
"high": { "reasoningEffort": "high" }
}
},
"discretestack-fast": {
"name": "discretestack-fast",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"limit": {
"context": 1000000,
"output": 32000
}
}
}
}
}
}
"@
# UTF-8 without BOM
[IO.File]::WriteAllText($ConfigFile, $Config, (New-Object Text.UTF8Encoding($false)))
Write-Host ""
Write-Host "Config written to $ConfigFile"
Write-Host ""
Write-Host "Models configured:"
Write-Host " - discretestack-max (1M context, 32k output)"
Write-Host " - discretestack-compact (1M context, 32k output)"
Write-Host " - discretestack-fast (1M context, 32k output)"
Write-Host ""
Write-Host "Done! Restart OpenCode to pick up the new config."
Open PowerShell, navigate to your Desktop, and run the script:
cd ~\Desktop powershell -ExecutionPolicy Bypass -File .\opencode-setup.ps1
Script blocked?
The -ExecutionPolicy Bypass flag allows this one run. If your Desktop is synced to OneDrive, use cd "$([Environment]::GetFolderPath('Desktop'))" instead of cd ~\Desktop.
When prompted Back up existing config? [Y/n], type:
n
When prompted, paste your DiscreteStack API key. You can also paste it in the header above to preview it here:
Enter your DiscreteStack API key: sk-your-api-key
Close AionUI completely and open it again.
Open a new chat, make sure you are connected to OpenCode, and choose a model from the bottom of the model selector:
| Model | Best for |
|---|---|
discretestack-fast |
Quick questions, summaries, translations, and simple writing. |
discretestack-compact |
Everyday work needing balanced speed and quality — great for AionUI. |
discretestack-max |
Coding, research, complex reasoning, analysis, and image tasks. |
At this point AionUI is configured to work with OpenCode + DiscreteStack. If you prefer AionUI to send requests through your private DiscreteStack infrastructure directly instead of through OpenCode, configure the DiscreteStack provider inside AionUI.
One script installs and configures AionUI + OpenCode for DiscreteStack: both apps, productivity skills, OpenCode config, and model connectivity.
Linux
No auto-configure script for Linux. Follow the manual Configuration steps →
Click the button below to download aion_opencode_setup.sh to your Mac.
The script isn't signed with an Apple developer certificate, so macOS may block it. If Terminal refuses to run it, allow it once:
xattr -d com.apple.quarantine ~/Downloads/aion_opencode_setup.sh
No error about "cannot be verified"? Skip this step and go straight to step 3.
Open Terminal (Cmd+Space, type "Terminal"), then run:
chmod +x ~/Downloads/aion_opencode_setup.sh ~/Downloads/aion_opencode_setup.sh
What the script does
Installs AionUI and OpenCode, downloads productivity skills, writes the OpenCode config, and launches AionUI. It only asks for your DiscreteStack API key.
When prompted, paste your DiscreteStack API key. You can also paste it in the header above and it's inserted into snippets:
DiscreteStack API key (hidden): sk-your-api-key
The script launches AionUI. Complete the login in the AionUI window (first run only), then press Enter in Terminal so the script can finish installing your skills into AionUI.
When it prints ✓ All done!, everything is configured. Open a new chat in AionUI, select OpenCode as the agent, and pick a DiscreteStack model.
Click the button below to download aion_opencode_setup.ps1 to your PC.
The script installs OpenCode through npm, so it needs Node.js. Check whether you already have it:
node --version
Prints a version number? Skip this step and go straight to step 3. Otherwise install it from nodejs.org, then open a new PowerShell window.
Open PowerShell (Start menu, type "PowerShell"), then run:
powershell -ExecutionPolicy Bypass -File "$env:USERPROFILE\Downloads\aion_opencode_setup.ps1"
What the script does
Installs AionUI and OpenCode, downloads productivity skills, writes the OpenCode config, and launches AionUI. It only asks for your DiscreteStack API key. Windows SmartScreen may warn about the AionUI installer — choose More info → Run anyway.
When prompted, paste your DiscreteStack API key. You can also paste it in the header above and it's inserted into snippets:
DiscreteStack API key (hidden): sk-your-api-key
The script launches AionUI. Complete the login in the AionUI window (first run only).
When it prints All done!, everything is configured. Open a new chat in AionUI, select OpenCode as the agent, and pick a DiscreteStack model.
Skills are installed for OpenCode. They are not added to AionUI's own skills list on Windows.
Share a session for support. These sessions live only on your machine — we cannot see them unless you send them.
If AionUI's built-in agent hits a problem, share that session file with DiscreteStack support.
Using OpenCode with AionUI?
If the problem happened in an OpenCode-backed session, go to OpenCode Debug →
- Go to AionUI's built-in agent sessions folder:
cd ~/Library/Application\ Support/AionUI/aionui/aionrs-sessionsOn Linux the path is:cd ~/.config/AionUI/aionui/aionrs-sessionscd $env:APPDATA\AionUI\aionui\aionrs-sessions
- List the session files (newest first):
Files are named
YYYY-MM-DD_<session-id>.json. Theindex.jsonfile lists all sessions with their IDs, models, and summaries. Choose the.jsonfile from when the problem happened (usually the newest). - Send that
.jsonfile to DiscreteStack support (email, ticket, or whatever channel you use). You can open the folder in and attach the file from there: Tip: before sending, open the file and remove any API keys or secrets if you see them.
Share a session for support. These sessions live only on your machine — we cannot see them unless you send them.
If Claude Code hits a problem, share that conversation file with DiscreteStack support.
- Go to Claude Code’s projects folder:
Then list the folders:
lsEach folder is a project. Names look a bit odd — they encode the full path to your project (for example
/Users/you/AI/my-appbecomes something like-Users-you-AI-my-appC:\Users\you\AI\my-appbecomes something likeC--Users-you-AI-my-app). Pick the folder that matches the project where the problem happened. - List the conversation files in that project folder (newest first):
Replace
<project>with the folder name from the previous step. Each.jsonlfile is one conversation. Choose the one from when the problem happened (usually the newest).Example:
cc35691e-8e5d-409e-8e75-72edc5c29448.jsonl - Send that
.jsonlfile to DiscreteStack support (email, ticket, or whatever channel you use). You can open the folder in and attach the file from there: Tip: before sending, open the file and remove any API keys or secrets if you see them.
Configure Hermes Agent to send requests to DiscreteStack's OpenAI-compatible endpoint.
If the file doesn't exist, create it. Set the provider to custom, point it at DiscreteStack, and register the models under custom_providers so Hermes knows each one's context window.
Windows: if HERMES_HOME is set, use that folder instead of %LOCALAPPDATA%\hermes.
model: default: discretestack-compact provider: custom base_url: "https://api.discretestack.eu/v1" api_key: "sk-your-api-key" custom_providers: - name: DiscreteStack base_url: "https://api.discretestack.eu/v1" api_key: "sk-your-api-key" models: discretestack-max: context_length: 1000000 discretestack-compact: context_length: 1000000 discretestack-fast: context_length: 1000000
Already have a custom_providers entry? Add the three model blocks above under its existing models: key instead of duplicating the provider.
Set model.default to the DiscreteStack model that fits your workflow.
| Model | Best for |
|---|---|
discretestack-fast |
Quick questions, summaries, translations, and simple writing. |
discretestack-compact |
Everyday coding and reasoning tasks — good default for Hermes. |
discretestack-max |
Complex coding, research, analysis, and image tasks. |
Prefer keeping secrets out of config.yaml? Move the API key to as DISCRETESTACK_API_KEY=sk-your-api-key and replace api_key in config.yaml with key_env: DISCRETESTACK_API_KEY.
Share a session or log file for support. These files live only on your machine — we cannot see them unless you send them.
If Hermes Agent hits a problem, share the relevant log or session file with DiscreteStack support.
- List the available logs:
Common files are
agent.log(agent activity and API calls),errors.log(warnings and errors), andgateway.log(messaging gateway activity). - View the recent output for the log that matches the problem:
Replace
agent.logwitherrors.logorgateway.logas needed. - Session transcripts and request dumps are stored in:
Choose the
.jsonlfile from when the problem happened. - Send the log or session file to DiscreteStack support (email, ticket, or whatever channel you use). Tip: before sending, open the file and remove any API keys or secrets if you see them.
Verified on Goose Desktop version 1.55.0.
In Goose Desktop, click Settings in the bottom left of the window.
Click Configure providers, scroll to the bottom of the provider list, and select Add Provider.
In the Add Provider dialog, choose how you'd like to set up your provider and pick Configure manually.
Choose how you'd like to set up your provider.
Enter the DiscreteStack connection details, then click Create Provider.
The Add Provider dialog has no field for context window, so Goose defaults every model to 128000. To match each model's real limit, quit Goose and edit the provider file it wrote (named after the Display Name from step 4, prefixed with custom_):
{
"name": "custom_discretestack",
"engine": "openai",
"display_name": "DiscreteStack",
"description": "Custom DiscreteStack provider",
"api_key_env": "CUSTOM_DISCRETESTACK_API_KEY",
"base_url": "https://api.discretestack.eu",
"models": [
{
"name": "discretestack-max",
"context_limit": 1000000,
"supports_vision": true,
"reasoning": true,
"request_params": {
"reasoning_effort": "high"
}
},
{
"name": "discretestack-compact",
"context_limit": 1000000,
"supports_vision": true,
"reasoning": true,
"request_params": {
"reasoning_effort": "high"
}
},
{
"name": "discretestack-fast",
"context_limit": 1000000,
"supports_vision": true,
"reasoning": false
}
],
"headers": null,
"supports_streaming": true,
"requires_auth": true,
"preserves_thinking": true
}
Change reasoning_effort in request_params to set how much each model reasons:
| Model | Supported reasoning_effort values |
|---|---|
discretestack-max | low, high, max |
discretestack-compact | low, high, max |
discretestack-fast | None (no reasoning, no request_params) |
Share a diagnostics bundle for support. It's generated and saved on your machine — we cannot see it unless you send it.
If Goose Desktop hits a problem, generate a diagnostics bundle and send it to DiscreteStack support.
- Open the conversation that had the problem, then look at the message toolbar at the bottom of the window. Click the diagnostics icon (the bug, next to the paperclip) to generate a diagnostics bundle:
- This opens the Report a Problem dialog. Click Download
to save a diagnostics JSON file to your computer — do not use File Bug on GitHub,
that reports directly to Goose's public issue tracker, not DiscreteStack.
Report a Problem
You can download a diagnostics JSON report to share with the team, or file a bug directly on GitHub with your system details pre-filled. A diagnostics report contains the following:
- Basic system info
- Your current session messages
- Recent log files
- Configuration settings
Warning: If your session contains sensitive information, do not share the diagnostics file publicly. If you file a bug, consider attaching the diagnostics report to it.
Cancel ⬇ Download File Bug on GitHub - Find the downloaded file and send it to DiscreteStack support (email, ticket, or whatever channel you use). Tip: before sending, open the file and remove any API keys or secrets if you see them.
Use these values to add DiscreteStack as a provider in any tool that supports a custom OpenAI-compatible or Anthropic-compatible provider. Paste your key in the header to fill it in below.
In your tool's settings, look for Custom provider, OpenAI-compatible, or Override OpenAI base URL. Enter these values:
| Field | Value |
|---|---|
| Provider type | OpenAI-compatible, OpenAI Responses, or Anthropic Messages (see below) |
| Provider name | DiscreteStack |
| Base URL | https://api.discretestack.eu/v1 |
| API key | sk-your-api-key |
The base URL also works without /v1 (https://api.discretestack.eu). If your tool adds /v1 on its own, use that form.
Pick the provider type that matches the API your tool speaks. The same base URL and API key work for all of them:
| API | Endpoint | Choose this if your tool offers |
|---|---|---|
| Chat Completions | /v1/chat/completions | OpenAI-compatible, Custom OpenAI |
| Responses | /v1/responses | OpenAI Responses API |
| Messages | /v1/messages | Anthropic-compatible, Custom Anthropic |
For the Messages API, set the base URL to https://api.discretestack.eu without /v1 if your tool appends /v1/messages itself.
Add each model by typing its exact name into the tool's model field:
| Model name | Context window | Reasoning efforts | Use it for |
|---|---|---|---|
discretestack-max | 1000000 | low, high, max | Coding, research, complex reasoning, analysis, and image tasks |
discretestack-compact | 1000000 | low, high (default), max | Everyday coding and reasoning tasks |
discretestack-fast | 1000000 | None (no reasoning) | Quick questions, summaries, translations, and simple writing |
If your tool asks for a limit, enter the context window from the table (1M tokens). Set the reasoning effort to one of the values listed for that model; other values are not supported, and discretestack-fast has no reasoning to configure.
OpenWork can run on top of OpenCode, so it picks up your OpenCode configuration. Set up OpenCode with DiscreteStack once and OpenWork uses it.
Already set up OpenCode with DiscreteStack? Skip this step. Otherwise, follow the OpenCode configuration page.
Download OpenWork for macOS, Windows, or Linux, then pick a folder to work in.
Select a discretestack-* model from the model picker in a chat. If the models don't show up, restart OpenWork.
If you don't have OpenCode, go through these install steps.
Download OpenWork for macOS, Windows, or Linux, then pick a folder to work in.
In OpenWork, go to Settings → Advanced → Chat engine and choose OpenCode v2 (preview).
Create opencode.jsonc in your workspace folder, the folder you want to work in with OpenWork (by default ), and paste this config. To use it in every workspace, save the file one level up instead, in your home folder (). Replace the placeholder key — or paste your key in the header and copy.
{
"$schema": "https://opencode.ai/config.json",
"providers": {
"myprovider": {
"name": "DiscreteStack",
"package": "@opencode/ai/providers/openai-compatible",
"settings": {
"baseURL": "https://api.discretestack.eu/v1",
"apiKey": "sk-your-api-key"
},
"models": {
"discretestack-max": {
"name": "discretestack-max",
"capabilities": { "tools": true, "input": ["text", "image"], "output": ["text"] },
"limit": { "context": 1000000, "output": 32000 },
"variants": [
{ "id": "low", "settings": { "reasoningEffort": "low" } },
{ "id": "high", "settings": { "reasoningEffort": "high" } },
{ "id": "max", "settings": { "reasoningEffort": "max" } }
]
},
"discretestack-compact": {
"name": "discretestack-compact",
"capabilities": { "tools": true, "input": ["text", "image"], "output": ["text"] },
"limit": { "context": 1000000, "output": 32000 },
"variants": [
{ "id": "low", "settings": { "reasoningEffort": "low" } },
{ "id": "high", "settings": { "reasoningEffort": "high" } },
{ "id": "max", "settings": { "reasoningEffort": "max" } }
]
},
"discretestack-fast": {
"name": "discretestack-fast",
"capabilities": { "tools": true, "input": ["text", "image"], "output": ["text"] },
"limit": { "context": 1000000, "output": 32000 },
"variants": [
{ "id": "low", "settings": { "reasoningEffort": "low" } }
]
}
}
}
}
}
Select a discretestack-* model from the model picker in a chat. If the models don't show up, restart OpenWork.
OpenWork sometimes does not pick up your global OpenCode config. The DiscreteStack provider does not appear under Settings → AI Providers, so its models are missing from the model picker. Fix it by putting the same config in your OpenWork workspace.
Your workspace is the folder you want to work in with OpenWork. Open it and create opencode.jsonc in its root, if it does not exist. Paste the same DiscreteStack config you saved to .
In OpenWork, run Reload OpenCode config from the command palette, or restart OpenWork.
If DiscreteStack still does not appear under Settings → AI Providers, contact us through your preferred contact channel.
Share a conversation for support. These conversations live only on your machine — we cannot see them unless you send them.
OpenWork stores its chats in OpenCode, so you export them with the opencode command. Install OpenCode first if you don't have it.
- You can run these commands from any folder.
- Show your recent conversations:
opencode session listOpenWork chats appear in the same list. Find the one that had the problem by its title and time, and copy its Session ID (starts with
ses_). - Export that session to a file on your computer.
Replace
ses_XXXXwith the Session ID you copied. Choose one option:# Option A (recommended) — hides sensitive details
opencode export ses_XXXX --sanitize > opencode-session.json
# Option B — full conversation, including your prompts
# Use only if you are comfortable sharing what you typed
opencode export ses_XXXX > opencode-session.json# Option A (recommended) — hides sensitive detailsThis creates a file named
opencode export ses_XXXX --sanitize | Out-File -Encoding utf8 opencode-session.json
# Option B — full conversation, including your prompts
# Use only if you are comfortable sharing what you typed
opencode export ses_XXXX | Out-File -Encoding utf8 opencode-session.jsonopencode-session.jsonin your current folder. On OpenCode 2 the command isopencode session export. - Send
opencode-session.jsonto DiscreteStack support (email, ticket, or whatever channel you use).
OMP has no built-in DiscreteStack provider, and is not created for you. Create the file (or add the provider to it if you already made one). Replace the placeholder key — or paste your key in the header and copy.
providers: discretestack: baseUrl: https://api.discretestack.eu/v1 api: openai-completions apiKey: sk-your-api-key models: - id: discretestack-max name: DiscreteStack Max reasoning: true thinking: mode: effort efforts: [low, high, max] defaultLevel: high contextWindow: 1000000 maxTokens: 32000 - id: discretestack-compact name: DiscreteStack Compact reasoning: true thinking: mode: effort efforts: [low, high, max] defaultLevel: high contextWindow: 1000000 maxTokens: 32000 - id: discretestack-fast name: DiscreteStack Fast reasoning: false contextWindow: 1000000 maxTokens: 32000
OMP reads apiKey as an environment variable name first and uses it as a literal key if no such variable exists, so pasting the key directly works.
Pick the reasoning effort with Shift+Tab, or start OMP with --thinking high. discretestack-fast has no reasoning.
omp --model discretestack/discretestack-compact
To make a model the default, run /model inside OMP and assign it to Default.
Share a session for support. These sessions live only on your machine — we cannot see them unless you send them.
If OMP hits a problem, find the session file and send it to DiscreteStack support.
- Open the session that had the problem. Inside OMP, use
/resumeto pick it, or start OMP with:omp --resumeThe picker searches titles, session IDs, project paths and conversation text. - Inside that session, run:
/session infoThis shows the session ID and the path to its file on disk:Example:
- Send that
.jsonlfile to DiscreteStack support (email, ticket, or whatever channel you use). Tip: the file contains your prompts, tool output and file paths. Check it for API keys or secrets before sending.
If exists, add this config. If not, create the file and paste it in. Replace the placeholder key — or paste your key in the header and copy.
{
"models": {
"providers": {
"discretestack": {
"baseUrl": "https://api.discretestack.eu/v1",
"api": "openai-completions",
"apiKey": "sk-your-api-key",
"models": [
{
"id": "discretestack-max",
"name": "DiscreteStack Stable Max",
"contextWindow": 1000000,
"maxTokens": 32000
},
{
"id": "discretestack-compact",
"name": "DiscreteStack Stable",
"contextWindow": 1000000,
"maxTokens": 32000
},
{
"id": "discretestack-fast",
"name": "DiscreteStack Stable Fast",
"contextWindow": 1000000,
"maxTokens": 32000
}
]
}
}
}
}
Share a session for support. These sessions live only on your machine — we cannot see them unless you send them.
If OpenClaw hits a problem, find the session file and send it to DiscreteStack support.
- List sessions:
openclaw sessions --jsonThis prints all sessions as JSON.
- Each session includes a
sessionFilepath to the conversation on disk:Example:Find the session from when the problem happened and note its
sessionFilepath. - Send that
.jsonlfile to DiscreteStack support (email, ticket, or whatever channel you use). Tip: before sending, redact any API keys or secrets if you see them.
Set up shared Codex defaults and the DiscreteStack hosted profile.
Before you start
Use Codex CLI 0.162.1 or newer. These examples use standalone profiles (--profile NAME) and .
This page configures DiscreteStack hosted mode. For BYOK, Hybrid, or ChatGPT subscription, use the matching Codex section in the left rail.
Launch modes after setup:
ChatGPT login
compact / fast / max
provider key + DS key
hybrid /model
Keep shared defaults and the hosted provider in config.toml
Merge these settings into your existing user config. Keep your projects, plugins, MCP servers, and other settings. Put top-level keys before any TOML table.
model = "discretestack-compact" model_provider = "discretestack" model_reasoning_effort = "low" model_verbosity = "medium" approval_policy = "on-request" approvals_reviewer = "user" sandbox_mode = "workspace-write" web_search = "live" [sandbox_workspace_write] network_access = false [model_providers.discretestack] name = "DiscreteStack Local" base_url = "https://api.discretestack.eu/v1" env_key = "DISCRETESTACK_API_KEY" wire_api = "responses" [model_providers.discretestack.http_headers] x-discretestack-codex-mode = "hosted"
These examples use env_key. Remove any experimental_bearer_token from this provider.
Save your hosted model catalog
Save the complete JSON below as . It matches the hosted Compact, Fast, and Max models and their supported reasoning levels.
{
"models": [
{
"slug": "discretestack-compact",
"display_name": "DiscreteStack Compact",
"description": "Balanced model for everyday work.",
"default_reasoning_level": "high",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Faster, lighter reasoning"
},
{
"effort": "high",
"description": "Default"
},
{
"effort": "max",
"description": "Deeper reasoning"
}
],
"shell_type": "shell_command",
"visibility": "list",
"supported_in_api": true,
"priority": 0,
"availability_nux": null,
"upgrade": null,
"base_instructions": "You are Codex, a coding agent. You and the user share the same workspace and collaborate to achieve the user's goals.",
"support_verbosity": true,
"default_verbosity": null,
"default_reasoning_summary": "auto",
"truncation_policy": {
"mode": "tokens",
"limit": 10000
},
"context_window": 1000000,
"max_context_window": 1000000,
"auto_compact_token_limit": 900000,
"effective_context_window_percent": 95,
"experimental_supported_tools": [],
"input_modalities": [
"text",
"image"
],
"supports_parallel_tool_calls": true,
"supports_reasoning_summaries": true,
"supports_reasoning_summary_parameter": true,
"supports_search_tool": true,
"supports_image_detail_original": false,
"tool_mode": "direct",
"web_search_tool_type": "text",
"use_responses_lite": false,
"used_fallback_model_metadata": false,
"multi_agent_version": "v2",
"additional_speed_tiers": [],
"service_tiers": [],
"default_service_tier": null,
"model_messages": null
},
{
"slug": "discretestack-fast",
"display_name": "DiscreteStack Fast",
"description": "Fast model for quick tasks.",
"default_reasoning_level": "low",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Default"
}
],
"shell_type": "shell_command",
"visibility": "list",
"supported_in_api": true,
"priority": 1,
"availability_nux": null,
"upgrade": null,
"base_instructions": "You are Codex, a coding agent. You and the user share the same workspace and collaborate to achieve the user's goals.",
"support_verbosity": true,
"default_verbosity": null,
"default_reasoning_summary": "auto",
"truncation_policy": {
"mode": "tokens",
"limit": 10000
},
"context_window": 1000000,
"max_context_window": 1000000,
"auto_compact_token_limit": 900000,
"effective_context_window_percent": 95,
"experimental_supported_tools": [],
"input_modalities": [
"text",
"image"
],
"supports_parallel_tool_calls": true,
"supports_reasoning_summaries": true,
"supports_reasoning_summary_parameter": true,
"supports_search_tool": true,
"supports_image_detail_original": false,
"tool_mode": "direct",
"web_search_tool_type": "text",
"use_responses_lite": false,
"used_fallback_model_metadata": false,
"multi_agent_version": "v2",
"additional_speed_tiers": [],
"service_tiers": [],
"default_service_tier": null,
"model_messages": null
},
{
"slug": "discretestack-max",
"display_name": "DiscreteStack Max",
"description": "Advanced model for complex reasoning.",
"default_reasoning_level": "high",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Faster, lighter reasoning"
},
{
"effort": "high",
"description": "Deep reasoning"
},
{
"effort": "max",
"description": "Deeper reasoning"
}
],
"shell_type": "shell_command",
"visibility": "list",
"supported_in_api": true,
"priority": 2,
"availability_nux": null,
"upgrade": null,
"base_instructions": "You are Codex, a coding agent. You and the user share the same workspace and collaborate to achieve the user's goals.",
"support_verbosity": true,
"default_verbosity": null,
"default_reasoning_summary": "auto",
"truncation_policy": {
"mode": "tokens",
"limit": 10000
},
"context_window": 1000000,
"max_context_window": 1000000,
"auto_compact_token_limit": 900000,
"effective_context_window_percent": 95,
"experimental_supported_tools": [],
"input_modalities": [
"text",
"image"
],
"supports_parallel_tool_calls": true,
"supports_reasoning_summaries": true,
"supports_reasoning_summary_parameter": true,
"supports_search_tool": true,
"supports_image_detail_original": false,
"tool_mode": "direct",
"web_search_tool_type": "text",
"use_responses_lite": false,
"used_fallback_model_metadata": false,
"multi_agent_version": "v2",
"additional_speed_tiers": [],
"service_tiers": [],
"default_service_tier": null,
"model_messages": null
}
]
}Create the DiscreteStack profile
model_provider = "discretestack" model = "discretestack-compact" model_reasoning_effort = "max" model_verbosity = "medium" model_catalog_json =
Replace /Users/you with your absolute home path (printf '%s\n' "$HOME").Replace C:/Users/you with your home path using forward slashes (run echo $env:USERPROFILE and swap \ for /). TOML does not expand ~ or $HOME in catalog paths. If you set CODEX_HOME, put all config, profile, and catalog files in that directory and adjust the paths and wrappers.
Create the hosted launcher
#!/usr/bin/env bash
exec env \
DISCRETESTACK_API_KEY="sk-your-ds-api-key" \
codex --profile discretestack "$@"Enter your DS key in the page header before copying, or replace the placeholder in the saved file. The wrapper contains the key locally; protect it with the command below.
chmod 700 ~/.codex/codex-ds.sh echo 'alias codex-ds="$HOME/.codex/codex-ds.sh"' >> ~/.zshrc source ~/.zshrc codex-ds
Add the alias once. For Bash, use ~/.bashrc. The wrapper passes "$@", so commands such as resume --all work too.
$old = $env:DISCRETESTACK_API_KEY
$env:DISCRETESTACK_API_KEY = "sk-your-ds-api-key"
try { codex --profile discretestack @args }
finally { $env:DISCRETESTACK_API_KEY = $old }Enter your DS key in the page header before copying, or replace the placeholder in the saved file. The launcher restores your environment when Codex exits and lives in your user profile folder.
if (-not (Test-Path $PROFILE)) { New-Item -Type File -Force $PROFILE | Out-Null }
Add-Content $PROFILE 'function codex-ds { & "$env:USERPROFILE\.codex\codex-ds.ps1" @args }'
. $PROFILE
codex-dsAdd the function once. The launcher passes @args, so commands such as resume --all work too. If PowerShell blocks the script, run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once.
Use your own Responses-compatible provider through DiscreteStack. This mode uses an upstream API key and its API billing; a ChatGPT subscription is not the upstream credential.
provider key + DS key
Save the BYOK model catalog
{
"models": [
{
"slug": "discretestack-stable-external",
"display_name": "DiscreteStack External (BYOK)",
"description": "Your external Responses API provider routed through DiscreteStack.",
"default_reasoning_level": "medium",
"context_window": 250000,
"max_context_window": 250000,
"auto_compact_token_limit": 225000,
"shell_type": "shell_command",
"additional_speed_tiers": [],
"service_tiers": [],
"default_service_tier": null,
"availability_nux": null,
"upgrade": null,
"base_instructions": "You are Codex, a coding agent. You and the user share the same workspace and collaborate to achieve the user's goals.",
"model_messages": null,
"supports_reasoning_summary_parameter": true,
"supports_reasoning_summaries": true,
"default_reasoning_summary": "auto",
"support_verbosity": true,
"default_verbosity": null,
"web_search_tool_type": "text",
"truncation_policy": {
"mode": "tokens",
"limit": 10000
},
"supports_parallel_tool_calls": true,
"supports_image_detail_original": false,
"effective_context_window_percent": 95,
"experimental_supported_tools": [],
"input_modalities": [
"text",
"image"
],
"supported_reasoning_levels": [
{
"effort": "medium",
"description": "Balanced"
},
{
"effort": "high",
"description": "Deep reasoning"
}
],
"used_fallback_model_metadata": false,
"supports_search_tool": true,
"use_responses_lite": false,
"multi_agent_version": "v2",
"tool_mode": "direct",
"visibility": "list",
"priority": 0,
"supported_in_api": true
}
]
}This matches your local catalog: one external alias, medium/high reasoning, a 250,000-token context window, and compaction at 225,000 tokens. Adjust metadata if you choose an upstream with different limits.
Create the BYOK profile
model_provider = "discretestack-external" model = "discretestack-stable-external" model_reasoning_effort = "medium" model_catalog_json = [model_providers.discretestack-external] name = "DiscreteStack External (BYOK)" base_url = "http://localhost:8082/v1" env_key = "CODEX_BYOK_API_KEY" wire_api = "responses" [model_providers.discretestack-external.http_headers] "x-discretestack-codex-mode" = "byok" "x-provider-url" = "https://api.openai.com" "x-provider-model" = "gpt-5.6-sol" [model_providers.discretestack-external.env_http_headers] "x-api-key" = "DISCRETESTACK_API_KEY"
Replace /Users/you with your absolute home path (printf '%s\n' "$HOME").Replace C:/Users/you with your home path using forward slashes (run echo $env:USERPROFILE and swap \ for /). TOML does not expand ~ or $HOME in catalog paths. If you set CODEX_HOME, put all config, profile, and catalog files in that directory and adjust the paths and wrappers.
Local or public endpoint
Your local BYOK and Hybrid profiles use http://localhost:8082/v1. This requires the local DiscreteStack gateway to be running. For the public service, replace only base_url with https://api.discretestack.eu/v1. Keep /v1 on this gateway URL; x-provider-url is the upstream prefix before /v1/responses.
The upstream model matches your BYOK profile (gpt-5.6-sol). Replace x-provider-url, x-provider-model, and the provider key together for another upstream. The upstream URL must use HTTPS and support the Responses API; a Chat Completions-only endpoint is insufficient.
Create the BYOK launcher
#!/usr/bin/env bash
exec env \
DISCRETESTACK_API_KEY="sk-your-ds-api-key" \
CODEX_BYOK_API_KEY="sk-your-provider-key" \
codex --profile discretestack-byok "$@"Replace sk-your-provider-key with the upstream key. Keep this key separate from the DiscreteStack key.
chmod 700 ~/.codex/codex-byok.sh echo 'alias codex-byok="$HOME/.codex/codex-byok.sh"' >> ~/.zshrc source ~/.zshrc codex-byok
Add the alias once. For Bash, use ~/.bashrc. The wrapper passes "$@", so commands such as resume --all work too.
$oldDs = $env:DISCRETESTACK_API_KEY
$oldByok = $env:CODEX_BYOK_API_KEY
$env:DISCRETESTACK_API_KEY = "sk-your-ds-api-key"
$env:CODEX_BYOK_API_KEY = "sk-your-provider-key"
try { codex --profile discretestack-byok @args }
finally {
$env:DISCRETESTACK_API_KEY = $oldDs
$env:CODEX_BYOK_API_KEY = $oldByok
}Replace sk-your-provider-key with the upstream key. Keep this key separate from the DiscreteStack key.
if (-not (Test-Path $PROFILE)) { New-Item -Type File -Force $PROFILE | Out-Null }
Add-Content $PROFILE 'function codex-byok { & "$env:USERPROFILE\.codex\codex-byok.ps1" @args }'
. $PROFILE
codex-byokAdd the function once. The launcher passes @args, so commands such as resume --all work too. If PowerShell blocks the script, run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once.
| Credential | Purpose | Sent as |
|---|---|---|
DISCRETESTACK_API_KEY
|
DiscreteStack access | x-api-key
|
CODEX_BYOK_API_KEY
|
Upstream API access | Authorization: Bearer
|
Use native Codex models directly with your ChatGPT login. Your current subscription profile selects gpt-6.1-sol with medium reasoning.
ChatGPT login
Create the subscription profile
model_provider = "openai" model = "gpt-6.1-sol" model_reasoning_effort = "medium" approvals_reviewer = "user"
Use the built-in openai provider. Leave model_catalog_json out of both this profile and the shared base config; the DS catalogs belong in their respective profiles. Codex manages the native catalog. Do not point this profile at models_cache.json.
Use the exact filename subscription.config.toml and launch --profile subscription. Your local subsription.config.toml and dsubscription.config.toml are separate profiles; they omit model_provider and can inherit the DS provider.
Sign in with ChatGPT and check the credential type
codex login codex login status
Complete the ChatGPT sign-in flow. If browser login is unavailable, use codex login --device-auth where your workspace permits it. API key authentication uses API billing rather than included subscription usage. Choose a model available to your signed-in account; use /model if your account cannot access gpt-6.1-sol.
Create the subscription launcher
#!/usr/bin/env bash exec env -u OPENAI_API_KEY -u OPENAI_BASE_URL \ codex --profile subscription "$@"
chmod 700 ~/.codex/codex-sub.sh echo 'alias codex-sub="$HOME/.codex/codex-sub.sh"' >> ~/.zshrc source ~/.zshrc codex-sub
Add the alias once. For Bash, use ~/.bashrc. The wrapper passes "$@", so commands such as resume --all work too.
This launcher clears OPENAI_API_KEY and OPENAI_BASE_URL for the Codex process so inherited shell values do not select API billing or another endpoint. Stored authentication still needs to be a ChatGPT login; verify it with codex login status.
$oldKey = $env:OPENAI_API_KEY
$oldUrl = $env:OPENAI_BASE_URL
Remove-Item Env:OPENAI_API_KEY, Env:OPENAI_BASE_URL -ErrorAction SilentlyContinue
try { codex --profile subscription @args }
finally {
$env:OPENAI_API_KEY = $oldKey
$env:OPENAI_BASE_URL = $oldUrl
}This launcher clears OPENAI_API_KEY and OPENAI_BASE_URL for the Codex process only, so inherited values do not select API billing or another endpoint. They are restored when Codex exits.
if (-not (Test-Path $PROFILE)) { New-Item -Type File -Force $PROFILE | Out-Null }
Add-Content $PROFILE 'function codex-sub { & "$env:USERPROFILE\.codex\codex-sub.ps1" @args }'
. $PROFILE
codex-subAdd the function once. The launcher passes @args, so commands such as resume --all work too. If PowerShell blocks the script, run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once.
Subagents inherit shared settings
If your shared config sets agents.default_subagent_model = "discretestack-compact", override that default with a native model available to your account:
[agents] default_subagent_model = "gpt-6.1-sol"
Keep DS hosted models and your ChatGPT subscription in one Codex session. Switch with /model: the Compact, Fast, and Max aliases use DS; discretestack-stable-external uses your ChatGPT credential through DS.
hybrid /model
Sign in and save the Hybrid catalog
codex login codex login status
{
"models": [
{
"slug": "discretestack-compact",
"display_name": "DiscreteStack Compact",
"description": "Balanced model for everyday work.",
"default_reasoning_level": "high",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Faster, lighter reasoning"
},
{
"effort": "high",
"description": "Default"
},
{
"effort": "max",
"description": "Deeper reasoning"
}
],
"shell_type": "shell_command",
"visibility": "list",
"supported_in_api": true,
"priority": 0,
"availability_nux": null,
"upgrade": null,
"base_instructions": "You are Codex, a coding agent. You and the user share the same workspace and collaborate to achieve the user's goals.",
"support_verbosity": true,
"default_verbosity": null,
"default_reasoning_summary": "auto",
"truncation_policy": {
"mode": "tokens",
"limit": 10000
},
"context_window": 1000000,
"max_context_window": 1000000,
"auto_compact_token_limit": 900000,
"effective_context_window_percent": 95,
"experimental_supported_tools": [],
"input_modalities": [
"text",
"image"
],
"supports_parallel_tool_calls": true,
"supports_reasoning_summaries": true,
"supports_reasoning_summary_parameter": true,
"supports_search_tool": true,
"supports_image_detail_original": false,
"tool_mode": "direct",
"web_search_tool_type": "text",
"use_responses_lite": false,
"used_fallback_model_metadata": false,
"multi_agent_version": "v2",
"additional_speed_tiers": [],
"service_tiers": [],
"default_service_tier": null,
"model_messages": null
},
{
"slug": "discretestack-fast",
"display_name": "DiscreteStack Fast",
"description": "Fast model for quick tasks.",
"default_reasoning_level": "low",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Default"
}
],
"shell_type": "shell_command",
"visibility": "list",
"supported_in_api": true,
"priority": 1,
"availability_nux": null,
"upgrade": null,
"base_instructions": "You are Codex, a coding agent. You and the user share the same workspace and collaborate to achieve the user's goals.",
"support_verbosity": true,
"default_verbosity": null,
"default_reasoning_summary": "auto",
"truncation_policy": {
"mode": "tokens",
"limit": 10000
},
"context_window": 1000000,
"max_context_window": 1000000,
"auto_compact_token_limit": 900000,
"effective_context_window_percent": 95,
"experimental_supported_tools": [],
"input_modalities": [
"text",
"image"
],
"supports_parallel_tool_calls": true,
"supports_reasoning_summaries": true,
"supports_reasoning_summary_parameter": true,
"supports_search_tool": true,
"supports_image_detail_original": false,
"tool_mode": "direct",
"web_search_tool_type": "text",
"use_responses_lite": false,
"used_fallback_model_metadata": false,
"multi_agent_version": "v2",
"additional_speed_tiers": [],
"service_tiers": [],
"default_service_tier": null,
"model_messages": null
},
{
"slug": "discretestack-max",
"display_name": "DiscreteStack Max",
"description": "Advanced model for complex reasoning.",
"default_reasoning_level": "high",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Faster, lighter reasoning"
},
{
"effort": "high",
"description": "Deep reasoning"
},
{
"effort": "max",
"description": "Deeper reasoning"
}
],
"shell_type": "shell_command",
"visibility": "list",
"supported_in_api": true,
"priority": 2,
"availability_nux": null,
"upgrade": null,
"base_instructions": "You are Codex, a coding agent. You and the user share the same workspace and collaborate to achieve the user's goals.",
"support_verbosity": true,
"default_verbosity": null,
"default_reasoning_summary": "auto",
"truncation_policy": {
"mode": "tokens",
"limit": 10000
},
"context_window": 1000000,
"max_context_window": 1000000,
"auto_compact_token_limit": 900000,
"effective_context_window_percent": 95,
"experimental_supported_tools": [],
"input_modalities": [
"text",
"image"
],
"supports_parallel_tool_calls": true,
"supports_reasoning_summaries": true,
"supports_reasoning_summary_parameter": true,
"supports_search_tool": true,
"supports_image_detail_original": false,
"tool_mode": "direct",
"web_search_tool_type": "text",
"use_responses_lite": false,
"used_fallback_model_metadata": false,
"multi_agent_version": "v2",
"additional_speed_tiers": [],
"service_tiers": [],
"default_service_tier": null,
"model_messages": null
},
{
"slug": "discretestack-stable-external",
"display_name": "Codex Subscription via DiscreteStack",
"description": "Native Codex subscription routed through DiscreteStack.",
"default_reasoning_level": "medium",
"context_window": 250000,
"max_context_window": 250000,
"auto_compact_token_limit": 225000,
"shell_type": "shell_command",
"additional_speed_tiers": [],
"service_tiers": [],
"default_service_tier": null,
"availability_nux": null,
"upgrade": null,
"base_instructions": "You are Codex, a coding agent. You and the user share the same workspace and collaborate to achieve the user's goals.",
"model_messages": null,
"supports_reasoning_summary_parameter": true,
"supports_reasoning_summaries": true,
"default_reasoning_summary": "auto",
"support_verbosity": true,
"default_verbosity": null,
"web_search_tool_type": "text",
"truncation_policy": {
"mode": "tokens",
"limit": 10000
},
"supports_parallel_tool_calls": true,
"supports_image_detail_original": false,
"effective_context_window_percent": 95,
"experimental_supported_tools": [],
"input_modalities": [
"text",
"image"
],
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Faster, lighter reasoning"
},
{
"effort": "medium",
"description": "Balanced"
},
{
"effort": "high",
"description": "Deep reasoning"
},
{
"effort": "xhigh",
"description": "Extra deep reasoning"
},
{
"effort": "ultra",
"description": "Maximum reasoning"
}
],
"used_fallback_model_metadata": false,
"supports_search_tool": true,
"use_responses_lite": false,
"multi_agent_version": "v2",
"tool_mode": "direct",
"visibility": "list",
"priority": 3,
"supported_in_api": true
}
]
}The catalog matches your local four-model Hybrid catalog. The external alias and upstream selection are different: the alias appears in /model, while x-provider-model selects the subscription model. Catalog entries do not confirm account entitlement.
Create the Hybrid profile
model_provider = "discretestack-hybrid"
model = "discretestack-compact"
model_reasoning_effort = "high"
model_catalog_json =
[model_providers.discretestack-hybrid]
name = "DiscreteStack + ChatGPT Subscription"
base_url = "http://localhost:8082/v1"
wire_api = "responses"
requires_openai_auth = true
http_headers = { "x-discretestack-codex-mode" = "hybrid", "x-provider-model" = "gpt-5.6-sol" }
env_http_headers = { "x-provider-api-key" = "DISCRETESTACK_API_KEY" }Replace /Users/you with your absolute home path (printf '%s\n' "$HOME").Replace C:/Users/you with your home path using forward slashes (run echo $env:USERPROFILE and swap \ for /). TOML does not expand ~ or $HOME in catalog paths. If you set CODEX_HOME, put all config, profile, and catalog files in that directory and adjust the paths and wrappers.
Local or public endpoint
Your local BYOK and Hybrid profiles use http://localhost:8082/v1. This requires the local DiscreteStack gateway to be running. For the public service, replace only base_url with https://api.discretestack.eu/v1. Keep /v1 on this gateway URL; x-provider-url is the upstream prefix before /v1/responses.
Keep requires_openai_auth = true and do not add env_key or experimental_bearer_token to this provider. Codex supplies the stored ChatGPT token. The x-provider-api-key header carries your DS key for this Hybrid route.
Create the Hybrid launcher
#!/usr/bin/env bash
exec env \
DISCRETESTACK_API_KEY="sk-your-ds-api-key" \
codex --profile discretestack-hybrid "$@"chmod 700 ~/.codex/codex-ds-sub.sh echo 'alias codex-ds-sub="$HOME/.codex/codex-ds-sub.sh"' >> ~/.zshrc source ~/.zshrc codex-ds-sub
Add the alias once. For Bash, use ~/.bashrc. The wrapper passes "$@", so commands such as resume --all work too.
$old = $env:DISCRETESTACK_API_KEY
$env:DISCRETESTACK_API_KEY = "sk-your-ds-api-key"
try { codex --profile discretestack-hybrid @args }
finally { $env:DISCRETESTACK_API_KEY = $old }Enter your DS key in the page header before copying, or replace the placeholder in the saved file. The launcher restores your environment when Codex exits and lives in your user profile folder.
if (-not (Test-Path $PROFILE)) { New-Item -Type File -Force $PROFILE | Out-Null }
Add-Content $PROFILE 'function codex-ds-sub { & "$env:USERPROFILE\.codex\codex-ds-sub.ps1" @args }'
. $PROFILE
codex-ds-subAdd the function once. The launcher passes @args, so commands such as resume --all work too. If PowerShell blocks the script, run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once.
/model selection |
Route | Configured effort |
|---|---|---|
discretestack-compact
|
DS hosted (default) | low / high / max |
discretestack-fast
|
DS hosted fast | low |
discretestack-max
|
DS hosted max | low / medium / high |
discretestack-stable-external
|
ChatGPT via DS → gpt-5.6-sol
|
low / medium / high / xhigh / ultra |
The listed effort levels come from your saved catalog. Use only levels accepted by the selected upstream model. Change x-provider-model if you want another native model, and update the external entry’s limits and reasoning levels to match.
| Credential | Sent as |
|---|---|
| ChatGPT login token | Authorization: Bearer
|
DISCRETESTACK_API_KEY
|
x-provider-api-key
|
Check the selected profile, endpoint, catalog, and credential type before sharing a redacted diagnostic report.
codex --version command -v codex codex login status codex doctor --summary codex doctor --json
codex --version Get-Command codex codex login status codex doctor --summary codex doctor --json
doctor is available in the verified CLI version. Review its output before sharing it. Never send auth.json, API keys, or unredacted config/wrapper files.
| Symptom | Check |
|---|---|
| Profile not found | Match --profile NAME to NAME.config.toml under the active CODEX_HOME. Check codex --help for standalone-profile support. |
| Connection refused on port 8082 | Start your local gateway, or set the profile’s base_url to https://api.discretestack.eu/v1. |
| 401 / 403 | Hosted: DS bearer key. BYOK: provider bearer key + DS x-api-key. Hybrid: ChatGPT login + DS x-provider-api-key. Also check upstream model access. |
Wrong models in /model
|
Check the profile’s absolute catalog path. Direct subscription should inherit no DS catalog. A catalog controls the selector, not access rights. |
| Catalog parse error | Validate the JSON, check its models array, and remove duplicate/extra braces. |
| Unsupported reasoning effort | Match the effort to the selected model. Your hosted fast entry supports low; hosted max supports medium. |
| Subscription runs through DS | Set model_provider = "openai" explicitly. Avoid the misspelled or incomplete subscription profiles. Check shell environment overrides and authentication status. |
| Subagent model unavailable | Shared [agents] settings are inherited. Override the default with a model available through this profile’s provider. |
python3 -m json.tool ~/.codex/models.json > /dev/null python3 -m json.tool ~/.codex/discretestack-byok-models.json > /dev/null python3 -m json.tool ~/.codex/discretestack-hybrid-models.json > /dev/null
Get-Content $env:USERPROFILE\.codex\models.json -Raw | ConvertFrom-Json | Out-Null Get-Content $env:USERPROFILE\.codex\discretestack-byok-models.json -Raw | ConvertFrom-Json | Out-Null Get-Content $env:USERPROFILE\.codex\discretestack-hybrid-models.json -Raw | ConvertFrom-Json | Out-Null
For support, include the Codex version, profile name, endpoint, model, effort, error, and time. To locate a conversation, open codex resume --all (or the matching wrapper with resume --all).
Legacy rollout files live under . Current versions can also store paginated thread history, so a conversation may not have a standalone JSONL file. Use your installed version’s export/support flow if available. Review any conversation export for prompts, tool output, paths, and secrets before sharing it.