Codex Integration

Codex Integration

Bring Ask Sage's AI models directly into your terminal with Codex CLI

Codex VSCode

Table of Contents
  1. Prerequisites
  2. Installation
  3. Configuration Methods
  4. DoD/DoW Network Configuration (In Development)
  5. Recommended Models
  6. Troubleshooting
  7. Additional Resources

Instance-Specific Base URL: The endpoints and configuration shown reflect the instance at chat.asksage.ai. The api. prefix and path suffix stay the same across deployments — only the instance segment in the middle changes based on which Ask Sage instance you are logging into. Always use the instance approved by your organization and applicable regulatory requirements, and match the base URL in your configuration to the instance you authenticate against.


Prerequisites

Prerequisites

Before you begin, ensure you have the following:

Ask Sage Account

Sign up or log in

Ask Sage API Key

Valid user API Key from Ask Sage

Codex Access

Install the Codex CLI, the VS Code extension, or the ChatGPT desktop app in the next section

Using the ChatGPT desktop app? It is built on Codex and reads the very same ~/.codex/config.toml, so this page configures it too — including the Work mode. See ChatGPT Work for what that means for each mode in the app.

Installation

Installation

Codex can be installed in three ways:

Option 1: VSCode Extension

Install the Codex extension directly in Visual Studio Code:

1

Open VSCode and navigate to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X on Mac)

2

Search for "Codex-OpenAI's coding agent" by OpenAI

3

Click the Install button to add the extension to your VSCode

Codex VSCode Extension Installation

Option 2: CLI Installation

The standalone installer is the recommended method — it self-updates.

# Standalone installer (recommended)
curl -fsSL https://chatgpt.com/codex/install.sh | sh

# Homebrew — note the --cask flag
brew install --cask codex

# npm
npm i -g @openai/codex

# Verify
codex --version
Three install traps:
  • brew install codex without --cask installs something else entirely. Codex is distributed as a Homebrew cask (a prebuilt binary), not a formula, and the bare name resolves to an unrelated formula.
  • The npm package is @openai/codex, not codex. The unscoped codex package is an unrelated old package. If you installed it by mistake, run npm uninstall -g codex first.
  • Do not mix install methods. Having two Codex installs on one machine is the most common cause of version confusion and command not found PATH conflicts. Pick one and update with that same method.

Option 3: ChatGPT desktop app

The ChatGPT desktop app (macOS, Windows, Linux) bundles Codex and drives it through its own copy of the CLI. Select Codex from the mode dropdown. Because it reads the same ~/.codex/config.toml, the configuration below applies to it without any extra steps — see ChatGPT Work.


Configuration Methods


DoD/DoW Network Configuration (In Development)



Troubleshooting

Troubleshooting

Issue: "stream disconnected before completion: stream closed before response.completed"

This is a generic error message indicating something is not configured correctly.

Solutions:

  • Verify your API key is correct and not missing
  • Ensure you are using a model your account has access to
  • Double-check the base_url in your config.toml
  • If using Option 2, confirm you exported ASKSAGE_API_KEY in the same terminal session
Issue: Authentication errors

Solutions:

  • Verify your Ask Sage API Key is valid
  • Remove any extra spaces from the API key string
  • Confirm the x-access-tokens header (Option 1) or env_key (Option 2) is correctly configured
Issue: Connection errors

Solutions:

  • Verify the base_url is correct and accessible
  • Ensure there are no firewall rules blocking the connection
  • Check your network connectivity
Need Help? If you can't resolve the issue, reach out to support@asksage.ai.

Additional Resources


Back to top

Copyright © 2026 Ask Sage Inc. All Rights Reserved. Ask Sage is a BigBear.ai company.