DiscreteStack
Model Overview
Two models, one endpoint. Pick the one that fits the job — both are multimodal and work with the tools you already use.
Balanced model for everyday workloads.
The general-purpose option for small to moderately complex tasks — everyday business work, document analysis, content generation, and structured Q&A.
View details
Advanced model for complex reasoning and multimodal tasks.
The most capable tier — use it for complex problem-solving, advanced analysis, technical tasks, and long or complicated instructions where accuracy matters more than speed.
View details
DiscreteStack
Compact
The general-purpose model for everyday work — balanced speed and quality for small to moderately complex tasks.
API ID — discretestack-compact
Good for
| Property | Value |
|---|---|
| Context window | 1M tokens |
| Max output | 32k tokens |
| Modalities | Text + image input, text output |
DiscreteStack
Max
The most capable tier — complex problem-solving, advanced analysis, and technical tasks where accuracy matters more than speed.
API ID — discretestack-max
Good for
| Property | Value |
|---|---|
| Context window | 256k tokens |
| Max output | 32k tokens |
| Modalities | Text + image input, text output |
OpenCode
Configuration
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": 256000,
"output": 32000
}
},
"discretestack-compact": {
"name": "discretestack-compact",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"limit": {
"context": 1000000,
"output": 32000
}
}
}
}
}
}
Replace sk-your-api-key with your DiscreteStack API key before saving.
OpenCode
Debug
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.
-
Open a terminal (macOS: Terminal or iTerm; Windows: PowerShell or Windows Terminal). 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 detailsThis creates a file named
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.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 Finder / File Explorer in the same folder as your terminal.
Cursor
Configuration
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.
Cursor
Debug
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.
-
Open a terminal (macOS: Terminal or iTerm; Windows: PowerShell or Windows Terminal).
-
Go to Cursor’s projects folder:cd ~/.cursor/projectsThen 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-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 Finder / File Explorer and attach the file from there:open ~/.cursor/projects/<project>/agent-transcriptsTip: before sending, open the file and remove any API keys or secrets if you see them.
Claude Code
Configuration
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",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "discretestack-compact[1m]",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "discretestack-compact[1m]",
"CLAUDE_CODE_MAX_CONTEXT_TOKENS": "256000"
},
"skipWebFetchPreflight": true
}
Replace sk-your-api-key with your DiscreteStack API key before saving.
After a fresh install, edit ~/.claude.json 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.
Claude Code
External model (BYOK)
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 ~/.claude/settings.json — 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.
Claude Code
Anthropic subscription users
If you use Claude Code via an Anthropic subscription (Claude Pro / Team / Enterprise) rather than a standalone API key, editing ~/.claude/settings.json 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.
~/.claude/settings.json 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" export ANTHROPIC_DEFAULT_SONNET_MODEL="discretestack-compact[1m]" export ANTHROPIC_DEFAULT_HAIKU_MODEL="discretestack-compact[1m]" export CLAUDE_CODE_MAX_CONTEXT_TOKENS=256000 export API_TIMEOUT_MS="3000000" claude "$@"
Replace sk-your-ds-api-key with your DiscreteStack API key.
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
Important
Do not put DiscreteStack settings in ~/.claude/settings.json — this overrides your subscription credentials. The claude-ds wrapper is the correct approach for subscription users.
Claude Code
DiscreteStack + Anthropic subscription
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
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" export ANTHROPIC_DEFAULT_SONNET_MODEL="discretestack-compact[1m]" export ANTHROPIC_DEFAULT_HAIKU_MODEL="discretestack-compact[1m]" export CLAUDE_CODE_MAX_CONTEXT_TOKENS=256000 claude "$@"
Replace sk-your-ds-api-key with your DiscreteStack API key.
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
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 |
| Sonnet | ANTHROPIC_DEFAULT_SONNET_MODEL |
discretestack-compact |
| Haiku | ANTHROPIC_DEFAULT_HAIKU_MODEL |
discretestack-compact |
| 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.
AionUI
Configuration
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
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.jsonc"
BACKUP_FILE="$CONFIG_DIR/opencode.jsonc.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": 256000,
"output": 32000
}
},
"discretestack-compact": {
"name": "discretestack-compact",
"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 (256k context, 32k output)"
echo " - discretestack-compact (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
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-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.
AionUI
Auto Configure
One script installs and configures AionUI + OpenCode for DiscreteStack: both apps, productivity skills, OpenCode config, and model connectivity.
macOS only
This auto-configure script is written for macOS. On Windows or 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.
AionUI
Debug
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 →
-
Open a terminal (macOS: Terminal or iTerm; Windows: PowerShell or Windows Terminal).
-
Go to AionUI's built-in agent sessions folder:cd ~/Library/Application\ Support/AionUI/aionui/aionrs-sessionsOn Windows the path is:cd %APPDATA%\AionUI\aionui\aionrs-sessionsOn Linux the path is:cd ~/.config/AionUI/aionui/aionrs-sessions
-
List the session files (newest first):ls -ltFiles 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 Finder / File Explorer and attach the file from there:open ~/Library/Application\ Support/AionUI/aionui/aionrs-sessionsTip: before sending, open the file and remove any API keys or secrets if you see them.
Claude Code
Debug
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.
-
Open a terminal (macOS: Terminal or iTerm; Windows: PowerShell or Windows Terminal).
-
Go to Claude Code’s projects folder:cd ~/.claude/projectsThen 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-app). Pick the folder that matches the project where the problem happened. -
List the conversation files in that project folder (newest first):ls -lt <project>/*.jsonl | headReplace
<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 Finder / File Explorer and attach the file from there:open ~/.claude/projects/<project>Tip: before sending, open the file and remove any API keys or secrets if you see them.
Hermes
Configuration
Configure Hermes Agent to send requests to DiscreteStack's OpenAI-compatible endpoint.
~/.hermes/config.yamlIf 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.
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: 256000 discretestack-compact: context_length: 1000000
Already have a custom_providers entry? Add the two 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-compact |
Everyday coding and reasoning tasks — good default for Hermes. |
discretestack-max |
Complex coding, research, analysis, and image tasks. |
Replace placeholder
Replace sk-your-api-key with your DiscreteStack API key before saving. You can also paste your key in the header above to preview it here.
Prefer keeping secrets out of config.yaml? Move the API key to ~/.hermes/.env as DISCRETESTACK_API_KEY=sk-your-api-key and replace api_key in config.yaml with key_env: DISCRETESTACK_API_KEY.
Hermes
Debug
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.
-
Open a terminal (macOS: Terminal or iTerm; Windows: PowerShell or Windows Terminal).
-
List the available logs:ls ~/.hermes/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:tail -n 100 ~/.hermes/logs/agent.logReplace
agent.logwitherrors.logorgateway.logas needed. -
Session transcripts and request dumps are stored in:ls ~/.hermes/sessions/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.
Goose Desktop
Configuration
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.
Replace sk-your-api-key with your DiscreteStack API key before creating the 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": 256000,
"reasoning": true
},
{
"name": "discretestack-compact",
"context_limit": 1000000,
"reasoning": true
}
],
"headers": null,
"supports_streaming": true,
"requires_auth": true,
"preserves_thinking": true
}
Goose Desktop
Debug
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.
OpenClaw
Configuration
If ~/.openclaw/openclaw.json 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": 256000, "maxTokens": 32000 },
{ "id": "discretestack-compact", "name": "DiscreteStack Stable", "contextWindow": 1000000, "maxTokens": 32000 }
]
}
}
}
}
Replace sk-your-api-key with your DiscreteStack API key before saving.
OpenClaw
Debug
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
"sessionFile": "~/.openclaw/agents/main/sessions/7d41c117-27aa-473c-ac84-38d938c241c8.jsonl"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.
Codex
Configuration
Use DiscreteStack as the provider for OpenAI Codex. Once configured, run codex and switch models with /model.
Install Codex
You need the OpenAI Codex CLI installed and available as codex on your PATH.
npm install -g @openai/codex
If you prefer not to install globally, use npx @openai/codex and adjust the wrapper script accordingly.
Create the DiscreteStack model catalog
Save this JSON to ~/.codex/discretestack-models.json. It lists the DiscreteStack models available inside Codex.
{
"models": [
{
"slug": "discretestack-compact",
"display_name": "DiscreteStack",
"description": "DiscreteStack model",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{ "effort": "low", "description": "Low reasoning effort" },
{ "effort": "medium", "description": "Default" },
{ "effort": "high", "description": "High reasoning effort" }
],
"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-max",
"display_name": "DiscreteStack Max",
"description": "DiscreteStack model (max)",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{ "effort": "medium", "description": "Default" }
],
"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": 256000,
"max_context_window": 256000,
"auto_compact_token_limit": 230400,
"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 ~/.codex directory first if it does not exist.
Create the Codex config
Put these top-level settings in ~/.codex/config.toml. The catalog path must be absolute.
model_provider = "discretestack" model = "discretestack-compact" model_reasoning_effort = "medium" model_catalog_json = "/Users/you/.codex/discretestack-models.json" [model_providers.discretestack] name = "DiscreteStack" base_url = "https://api.discretestack.eu/v1" env_key = "DISCRETESTACK_API_KEY" wire_api = "responses" http_headers = { "x-discretestack-codex-mode" = "hosted" }
Replace /Users/you with your home directory. Run printf '%s\n' "$HOME" to see the exact path. Codex requires an absolute catalog path.
Create the command-scoped wrapper
This script injects your API key only into the Codex process. The key is not exported to the rest of your shell session.
#!/usr/bin/env bash exec env \ DISCRETESTACK_API_KEY="sk-your-ds-api-key" \ codex "$@"
Paste your DiscreteStack API key in the header field, then copy this block to keep the key out of your shell history.
Protect the wrapper and add the command
chmod 700 ~/.codex/codex-ds.sh echo 'alias codex="$HOME/.codex/codex-ds.sh"' >> ~/.zshrc source ~/.zshrc codex
For Bash, use ~/.bashrc instead. The wrapper contains your key locally and is restricted to your user account by chmod 700.
Codex
Debug
Share a session for support. Codex sessions live only on your machine — we cannot see them unless you send them.
If Codex hits a problem, send the relevant conversation file and a redacted diagnostic report to DiscreteStack support.
-
Open a terminal (macOS: Terminal or iTerm; Windows: PowerShell or Windows Terminal).
-
Open the Codex session picker for every working directory:codex resume --allFind the conversation where the problem happened by its working directory, title, and time. Note the session ID if it is shown, then press
Escto close the picker without resuming it. -
Codex stores conversations by date under
~/.codex/sessions. List the newest files first:find ~/.codex/sessions -type f -name '*.jsonl' -print0 | xargs -0 ls -lt | headEachrollout-*.jsonlfile is one conversation. Match its timestamp and session ID to the conversation from the picker.Full path looks like:
~/.codex/sessions/2026/08/25/rollout-2026-08-25T13-37-41-<session-id>.jsonl -
Generate a redacted Codex diagnostic report on your Desktop:codex --strict-config doctor --json > ~/Desktop/codex-doctor.jsonThe report includes configuration, authentication mode, provider reachability, and runtime details. It does not include the conversation transcript.
-
Send the matching
rollout-*.jsonlfile andcodex-doctor.jsonto DiscreteStack support. Include the command you used:codex. You can open the sessions folder in Finder:open ~/.codex/sessionsImportant: the JSONL contains conversation content, tool calls, and local paths. Open it first and remove any API keys or other secrets before sending it.