tutorials

How to Use Codex with VS Code and LLM Foundry

These are instructions to set up

You don’t need admin access or OpenAI API keys.

1. Install VS Code

Download Visual Studio Code and install it.

How Install Visual Studio Code on Windows 11 (VS Code) - 6 min

Then open any folder in VS Code.

2. Install Codex

Select the Extensions icon in the sidebar. Search for “Codex” in the search bar and install the one by OpenAI.

CAREFUL! There are multiple Codex extensions. You want the Codex - OpenAI’s coding agent.

How to Use OpenAI Codex in VSCode: Step-by-Step Beginner’s Guide (2025) - 1 min

3. Log in with a dummy API key

Click on the Codex icon in the sidebar.

This should show 2 buttons:

A "Sign in with ChatGPT" and a "Use API Key" button

Click on Use API Key and type “ABCD” (or any other random string) in the API key field and click “OK”. We will change this later.

Press “Continue” when prompted.

4. Configure LLM Foundry

Click on the gear-like settings icon to the right of the Codex pane, then Codex settings, then Open config.toml.

Paste the following into the config.toml file and save it.

profile = "llmfoundry"

[profiles.llmfoundry]
model_provider = "llmfoundry_openai"
model = "gpt-5-codex"
model_reasoning_effort = "low"

[model_providers.llmfoundry_openai]
name = "LLM Foundry - OpenAI"
base_url = "https://llmfoundry.straive.com/openai/v1"
env_key = "LLMFOUNDRY_TOKEN"
wire_api = "responses"

Any changes to config.toml require a restart of VS Code.

5. Set your LLM Foundry API key

Visit LLM Foundry and log in with your official Google account.

Then click on the “Code” tab.

Copy the LLM Foundry token.

Search for “Edit environment variables for your account” in the Windows search bar.

Select “New” from the “User variables” section.

Set the variable name to:

LLMFOUNDRY_TOKEN

CAREFULLY! Copy paste it. Or, if typing:

Set the variable value to the token you copied from LLM Foundry > Code.

How to Set Environment Variables in Windows 11 - 1 min

6. Restart VS Code

Close VS Code.

Then re-open it.

7. Verify Codex is working with LLM Foundry

Click on the Codex icon in the sidebar.

Type “Hi” (or anything else) in the prompt box and press Enter.

lf goes well, you should see a response from Codex.

8. Troubleshooting

If you see an error like this:

Try the following:

  1. Check if LLM Foundry is up. If not, try later.
  2. Check if your LLMFOUNDRY_TOKEN environment variable is correct. Re-add it and restart VS Code.

8. Try simple examples

You can now use Codex in VS Code with LLM Foundry. Here are a few simple things to try.

  1. Copy text documents into the folder and prompt Codex to “Summarize these documents”.
  2. Copy code files into the folder and prompt Codex to “Explain this code”.
  3. Copy Excel files into the folder and prompt Codex to “Write code to analyze this data”.

9. Install Python

Open the Windows search bar and search for “Python”. Install any of the Python versions from the Microsoft Store. This will allow Codex to run Python code locally.

How to Install and Setup Python 3 13 on Windows 11 via the Microsoft Store - 3 min

10. Usage tips

To avoid Codex asking for too many approvals, use the “Agent (full access)” mode.