Skip to Content
VS Code extensions

VS Code extension

Use this section when you drive AI coding from inside VS Code through the OpenAI Codex plugin (publisher: OpenAI, extension ID openai.chatgpt), which reads the same ~/.codex/config.toml as the Codex CLI. If you have already set up Codex CLI, the plugin will pick up that configuration automatically. Otherwise follow the steps below.

Tip:

Launching VS Code from a Finder / Start Menu shortcut inherits whatever environment the OS process has, which usually does not include INFER_API_KEY. For the Codex plugin to see the key, always launch VS Code from the shell where the exports were applied (code . from a terminal).

Prerequisites

  • Install VS Code .
  • Install the OpenAI Codex plugin from the VS Code Marketplace (publisher OpenAI, extension ID openai.chatgpt) — not GitHub Copilot, which is a different product and cannot be routed through Infer.
  • Open the plugin so it can write its config file: click the OpenAI icon in the Activity Bar on the left edge of VS Code (or open the Command Palette with Cmd+Shift+P on macOS / Ctrl+Shift+P on Windows / Linux and run ChatGPT: Focus on Chat View), then sign in once with any OpenAI account. The plugin creates ~/.codex/config.toml on first sign-in — that is the file you will edit later in this guide.
  • Create an Infer API key in the API Keys dashboard.
  • Make sure the team has available balance on the Billing page.
  • If the Codex plugin is already signed in with another provider, sign out first before switching the endpoint.

Environment (macOS / Linux)

Add this export to your shell profile (~/.zshrc or ~/.bashrc), or run it directly in your current session:

Copy, replace the key, and load it in your shell or shell profile.

bash
export INFER_API_KEY="your_api_key"

If you edited your shell profile, reload it so the new value takes effect in the current terminal (or just open a fresh one):

Reload whichever profile file you edited, or open a fresh terminal.

bash
source ~/.zshrc
# or: source ~/.bashrc

Environment (Windows PowerShell)

Set the variable for the current session. To persist it across sessions, run the persistent snippet instead and restart PowerShell:

Set variables for the current PowerShell session before launching Codex.

powershell
$env:INFER_API_KEY = "your_api_key"

Persist user-level variables, then restart PowerShell before launching Codex.

powershell
[Environment]::SetEnvironmentVariable("INFER_API_KEY", "your_api_key", "User")

Codex config

Open ~/.codex/config.toml (Windows: %USERPROFILE%\.codex\config.toml; the plugin creates this file on first sign-in) and add a provider block pointing at Infer:

Add or update this block in ~/.codex/config.toml so Codex CLI, the VS Code extension, and the Codex app use Infer.

toml
# Tell Codex which provider and model to use by default
model_provider = "infer"
model = "your_model"
model_reasoning_effort = "high"

[model_providers.infer]
name = "Infer"
# Base URL must include the /v1 suffix
base_url = "https://api-agenthub-pre.riema.xyz/v1"
# Codex reads the API key from this environment variable
env_key = "INFER_API_KEY"
Warning:

base_url must include /v1. The Codex plugin sends requests directly to the URL you paste; copy it verbatim from the Base URL section of the Quickstart. No trailing slash.

Restart VS Code and the Codex plugin after editing config.toml to apply changes.

Launch

Launch VS Code from the shell with INFER_API_KEY exported, so the Codex plugin picks it up:

cd your-project
code .

Verify

Open the Codex panel inside VS Code and send a short test prompt, for example Reply with 'ok' if you can see this.. A reply confirms Infer is reachable and the key is valid. The dashboard usage chart should also tick up once the response returns.

Troubleshooting

  • 401 Unauthorized: confirm echo $INFER_API_KEY is non-empty in the shell that launched VS Code. If the exports were added after launching VS Code, relaunch it from the updated shell.
  • Model not found: the model in config.toml must match a model id from the Models catalog. Model ids are case-sensitive.
  • Plugin still hits the default endpoint: Codex resolves model_provider to the [model_providers.<name>] table of the same name. Confirm both say infer and restart VS Code.
  • 404 on the request: base_url is missing the /v1 suffix. See the warning above.

Other extensions

Third-party extensions like Cline and Continue configure models in their own settings panel, but the values are the same: base URL = https://api-agenthub-pre.riema.xyz/v1, API key = your Infer key, model id from the Models catalog. Extension-specific walkthroughs are planned for the next docs pass.

Last updated on