Course setup guide
Setting up Claude Code and Codex for class
This class uses two AI coding assistants:
- Claude Code — Anthropic's assistant. Reads your files, writes code, and runs commands for you. Needs a paid Claude Pro account ($20/month) or a gateway key (see below).
- Codex — OpenAI's assistant, doing the same job. Needs a paid ChatGPT Plus account ($20/month) or a gateway key.
Higher account tiers work too — Claude Max, ChatGPT Pro. Free accounts won't.
If you're registered for the course, don't buy anything. Your instructor will discuss the setup with you and give you the options — including a key for the CU Math AI gateway (math.colorado.edu/ai), which works with both tools and with any model you're allowed to use.
Everything the Department of Mathematics provides — the gateway key, the departmental chat at math.colorado.edu/ai, and any subscriptions the department gives you — comes with three rules: your usage is not private, so submit no confidential or protected information; delete chats you no longer need; and don't enable sharing, model-improvement programs, connectors, plug-ins, or third-party integrations. The full statement is one short page: AI use rules.
You'll run both in a Codespace — a computer that lives in the cloud, not on your laptop. Everything below is a one-time setup. Follow it in order.
~20 minutes, once Works on Mac or Windows Nothing risky installed on your computer
Quick start
Already comfortable with GitHub and VS Code? Here's the fast version — click any step to jump to its full detail, screenshots, and fixes below.
- Get ready — install VS Code and the GitHub Codespaces extension; have a GitHub account and your Claude/ChatGPT login handy.
- Copy the repo — Use this template on the class repo, then Create repository.
- Create a Codespace — on your copy, Code → Codespaces → Create codespace on main.
- Open it in VS Code — browser hamburger menu → Open in VS Code Desktop, or Cmd/Ctrl Shift P → Connect to Codespace.
- Open a terminal — Ctrl `.
- Log in with your account — the recommended path; nothing to set up first. (Gateway key instead? Read the AI use rules, store the key as a Codespaces secret named
MATHPROXY_API_KEY, and restart the Codespace.) - Run
claude, choose Claude account with subscription, approve in the browser. (Gateway: set two variables and runclaude.) - Run
codex, choose Sign in with ChatGPT, approve in the browser. (Gateway: runcodexwith the provider options.) - Check it worked —
claude --versionandcodex --version, then start each tool, typehi, and make sure it answers.
Why we're doing it this way
Claude Code and Codex read files, write files, and run commands.
A Codespace is a throwaway Linux computer in a data center. When an agent makes a mess there, you delete the Codespace and make a new one in three minutes. Your own laptop, your files, and your other work are never in reach.
If you've never used a terminal
A terminal is a panel where you type commands as text instead of clicking buttons. The tools you'll use in this class — Claude Code and Codex — are CLI tools (Command Line Interface), meaning you start them by typing their name and pressing Enter. There is no icon to double-click. The terminal is the interface.
Throughout this guide you'll see boxes like this one:
- The
$is not something you type. It's the computer saying "ready" — you type after it. - So the line above means: type
claude --versionand press Enter. - Every box has a Copy button in its top-right corner. It copies just the command — no
$, no greyed-out output — so you can paste it straight into the terminal. (Selecting the text by hand also skips the$.) - You can paste several lines at once. Some boxes hold a command that spans multiple lines, or a few commands in a row; paste the whole thing and the terminal runs it line by line. (Some terminals ask "paste multiple lines?" — say yes.)
- Greyed-out lines are what the computer prints back at you.
- Anything from a
#to the end of the line is a note for you. The computer ignores it, so there's no need to strip these out before pasting — they're harmless.
0Get ready
Checklist
- A GitHub account. Free. Sign up at github.com/signup if you don't have one.
- Visual Studio Code installed on your laptop, from code.visualstudio.com. Free. Strongly recommended — see the note below.
- The GitHub Codespaces extension installed in VS Code — open the Extensions view (Cmd Shift X on Mac, Ctrl Shift X on Windows), search GitHub Codespaces, and click Install. Step 3 depends on this already being in place — see the note below.
- Your paid Claude and/or ChatGPT account login handy. That's the default for this class. If your instructor is giving you a gateway key to use instead, have it somewhere you can copy it from, and read the AI use rules that come with it. Step 5 explains the difference; you don't have to decide yet.
You can do all of this in a browser tab. But the VS Code app makes Codex's login easier — in a browser-only setup, signing in to Codex with a ChatGPT account needs an extra device-code step (see the note in step 7). Using the app avoids that, and it's what these instructions assume, so we recommend it if you can install it.
Step 3 has you click Open in VS Code Desktop from the browser, expecting VS Code to prompt you to install the GitHub Codespaces extension on the spot. In practice that prompt doesn't always show up, and the click can just quietly do nothing. Install the extension yourself now — in VS Code, open the Extensions view (Cmd Shift X on Mac, Ctrl Shift X on Windows), search for GitHub Codespaces, and click Install — then step 3 should go smoothly.
Some school or work laptops block installs. Tell your instructor before class — there's a browser-only route that uses the gateway key instead, and it can be arranged.
1Make your own copy of the class repo
This step happens on the GitHub website, in your ordinary web browser — not in VS Code. First log in to github.com, then click this link to open the class repository:
github.com/agnes-beaudry/ai-sandbox
Then:
- Click the green Use this template button, then Create a new repository.
- Give it any name you like —
ai-classis fine. - Leave the other settings alone and click Create repository.
Everything after this happens on your copy, not the link above — so you don't need to come back to it.
You now have your own copy under your own GitHub account. Your work is yours; nothing you do affects your classmates or the original.
2Create your Codespace
On your new copy of the repo (look at the top left of the screen — it should say your-username / ai-class or equivalent):
- Click the green Code button.
- Click the Codespaces tab in the dropdown.
- Click Create codespace on main.
A new tab opens and builds your cloud computer. It's installing Claude Code and Codex for you, so give it time. You may see setup messages scroll past (especially on the bottom) while it works — that's the installation talking, not an error.
When it's finished you'll be looking at a page of text — the repository's README file, opened for you automatically. That's the normal resting state, and it means you're in.
If there's a panel open along the bottom of the window, you'll also see this in it:
That line was written into the class repo's setup file, so seeing it means your tools installed correctly. If there's no panel and you can't see it, that's fine too — nothing has gone wrong, and you'll get another chance to spot it in step 4.
Either way, there's nothing to do here. Carry straight on to step 3.
3Open it in the VS Code app
Two ways to get there — pick whichever's easier. Both need the GitHub Codespaces extension, so install it first if you skipped that in Get ready: open the Extensions view (Cmd Shift X on Mac, Ctrl Shift X on Windows), search GitHub Codespaces, and click Install.
Option A — from the browser tab you're already in.
- Click the ☰ hamburger menu at the very top-left of the codespaces page.
- Click Open in VS Code Desktop.
- Your browser will ask permission to open VS Code. Allow it.
Option B — from VS Code directly. Quicker once you know it, and it's the same shortcut you'll use every week in Reconnecting.
- Open VS Code.
- Press Cmd Shift P (Mac) or Ctrl Shift P (Windows) — this opens the Command Palette, VS Code's "search all commands" box.
- Type
Connect to Codespace. - Choose "Codespaces: Connect to Codespace..." from the results.
- Pick your Codespace from the list that appears.
A few prompts will appear as it connects, either way. Here's what to do with each:
| Prompt | Do this | Why |
|---|---|---|
| Install the "GitHub Codespaces" extension? | Install | This is the piece that connects VS Code to your cloud computer. Required. You shouldn't see this prompt if you already installed it in Get ready — if it does appear, install it now. |
| Install the recommended "Dev Containers" extension? | Cancel | Wrong tool. It's for running containers on your own laptop — see the warning below. |
| Authenticate with GitHub? | Authenticate | Depending on your GitHub account settings, you may be sent back to the browser to authenticate, so VS Code is logged in to GitHub as you. |
| "Do you trust the authors of the files in this folder?" | Yes, I trust the authors | It's your own repo, running in a disposable cloud container. |
If you install it, VS Code will later offer you a button called "Reopen in Container." Clicking that tries to run everything on your own laptop instead of in the cloud — which either fails confusingly, or quietly works and removes all the protection this setup exists to give you. Decline it.
Look at the bottom-left corner of the VS Code window. You should see a coloured badge reading Codespaces: … — that's your "I'm in the cloud" indicator. A VS Code window showing your own laptop's files looks almost identical, so get in the habit of glancing at this badge.
If you're not connected and wish to be, click the small >< button in that same bottom-left corner — it's VS Code's "open a remote window" button — and choose Connect to Codespace. There's no single keystroke for it, but the Command Palette gets you there too: Cmd Shift P (Mac) or Ctrl Shift P (Windows), then type Connect to Codespace. The Reconnecting section walks through this in detail.
4Open a terminal in VS Code
You may already have one. Look along the bottom of the VS Code window — if there's a panel there with a tab labelled TERMINAL, click that tab and skip ahead. There's no need for a second one.
If there's no panel at all, open one:
| Where the menu is | Keyboard shortcut | |
|---|---|---|
| Mac | Menu bar at the top of your screen: Terminal → New Terminal | Ctrl ` |
| Windows | Menu bar inside the VS Code window: Terminal → New Terminal | Ctrl ` |
That ` is the backtick — top-left of the keyboard, above Tab, sharing a key with ~.
Either way, what you're after is a panel showing a line that ends in $. That's your prompt. You're ready.
You may also spot the Sandbox ready message here if you didn't see it earlier. Either way, step 8 checks properly.
5Choose how you'll log in
Each tool can be used two ways. You pick one per tool — they don't have to match. For this class, log in with your subscription account — it's the default we recommend, and it means nothing below needs setting up on GitHub. The department's AI gateway key is the alternative, if your instructor gives you one.
| Method | What it uses | What it costs |
|---|---|---|
| Account login (recommended) | Your paid Claude or ChatGPT account — the same one you log into on the website | Nothing extra. Included in the subscription you already pay for. |
| Gateway key (alternative) | A long secret code for the CU Math AI gateway at math.colorado.edu/ai. One key serves both tools, and any model you're allowed to use — Claude, GPT, or Gemini — from either of them. Use is subject to the AI use rules. | Paid by the department, per use. Nothing for you to buy. |
If you use your ChatGPT account for Codex, you must be in the VS Code app. That login cannot finish in a browser tab without additional steps. Everything else works in either place.
There's nothing to set up here. Each tool asks you to log in the first time you run it — that happens in step 6 for Claude Code and step 7 for Codex. Skip ahead to step 6.
Alternative: using the gateway key instead
The gateway is the department's AI access, and using it means agreeing to the AI use rules: your usage is not private — do not submit any confidential or protected information; delete chats you no longer need; and do not enable sharing, model-improvement programs, connectors, plug-ins, or third-party integrations. With a coding tool, "submit" includes every file it reads, so keep anything you can't share out of the Codespace.
Two short jobs: create the key on the gateway site, then store it with GitHub so every Codespace you open has it.
First, create your key
- In your browser, go to math.colorado.edu/ai and log in. You land on a chat screen.
- Look at the row of small buttons under the message box, at the bottom centre of the screen — Download chat · Open chat · New chat · API keys. Click API keys.
- A panel titled API keys for coding tools (Claude Code / Codex) opens. Scroll to the bottom of it: there's a box labelled Label (e.g. laptop) next to a Create key button. Type a label —
codespaceis fine; it's only so you can recognise the key later — and click Create key. - The new key appears under "New key — shown once, copy it now". It starts with
cuai-. Click Copy beside it. This is the only time the site will show it; if you lose it, come back here, Revoke it, and create another.
The panel also prints the Claude Code and Codex commands with <your key> pasted in literally. You don't need to copy those. The steps below put the key into your Codespace as a secret instead, so the commands in steps 6 and 7 refer to it by name and the key never appears on screen or in a file.
Also read the notice at the top of that site — it says the same thing as the AI use rules: whatever a coding tool sends through the gateway — your prompts, and the code it reads — goes to the AI providers, exactly as a chat message would. The top-right corner shows how much of your allowance is left.
It's a secret: don't paste it into chat windows, screenshots, or files in your repo.
Then store it with GitHub
You'll store it as a Codespaces secret. Do this once, and it's waiting for you — as an environment variable named MATHPROXY_API_KEY — in every Codespace you create, and it survives rebuilds. One secret covers both tools.
- Go to github.com/settings/codespaces. Note this is your GitHub account settings, not the class repo — which is why each of you does this separately with your own key.
- Find Codespaces secrets and click New secret.
- Fill in the name and paste your key as the value. The name must be exactly:
| For… | Name the secret exactly |
|---|---|
| Claude Code and Codex (one key for both) | MATHPROXY_API_KEY |
All capitals, underscores between words, spelled exactly as above. If you get it wrong you won't see an error — the key simply won't be found, and you'll spend a while debugging the wrong thing.
- Under repository access, choose your copy of the class repo. You can add more repositories later if you need to; keep it to the one for now.
- Click Add secret.
Keys are handed to your Codespace when it starts up. A Codespace that's already running won't see a key you just added.
Go to github.com/codespaces, click the … menu on your Codespace's row, choose Stop codespace, and wait for it to stop.
Then open it again. The easiest way: go back to the VS Code window, which notices the Codespace has stopped and shows a pop-up with a Start button — click it. If there's no pop-up, reconnect as in Reconnecting (Cmd/Ctrl Shift P → Connect to Codespace), or click the Codespace's name at github.com/codespaces to open it in a browser tab. Any of these starts it up again, and the new key is there when it does.
To confirm a key arrived, run this in a terminal — it checks without displaying your key:
Don't use a command that prints the key itself — a key on screen is a key in your next screenshot.
Check the two usual causes first: the secret's name must be spelled exactly right, and you must have restarted the Codespace since adding it.
If it still says NOT SET, ask an instructor rather than guessing. You can also describe the problem to Claude at claude.ai — but don't paste your key into any chat window while doing it.
6Log in to Claude Code
It asks a couple of setup questions first (a colour theme — pick anything). What happens next depends on which method you're using.
If you're using your Claude account (recommended)
You'll see this menu:
Choose 1. A browser opens — approve the login there and the terminal picks it up.
Ignore the window that opened by itself. Look in the terminal for the web address printed there, copy it, and paste it into a new browser tab yourself.
It's a sign-in to a separate developer account, not a way to use the gateway key. The gateway isn't a menu choice at all — it's two environment variables, set as in the alternative below, and when they're set this menu doesn't appear. Option 3 is for cloud platforms — ignore it.
Claude Code takes over the whole panel and becomes an app — a bordered box with menus. This is correct, not a crash. Move with the arrow keys, confirm with Enter; clicking mostly won't work.
To get out: press Esc, or type /exit and Enter. That returns you to the $ prompt.
To sign out later: type /logout inside Claude Code.
Alternative: if you're using the gateway key
Claude Code talks to the gateway when two environment variables are set: where to send requests (ANTHROPIC_BASE_URL) and the key to send (ANTHROPIC_AUTH_TOKEN). Your key is already in the Codespace as MATHPROXY_API_KEY (step 5), so you never type it. No login menu, no browser. You can set the variables inline, every time you start it:
Or set them once, so that plain claude works from then on in every terminal (the first two lines append to your shell's start-up file; the third loads it into the current terminal):
Either way, Claude Code starts without asking you to log in. Inside it, /status shows the gateway address, which is how you know you're on the key and not on an account. Then type hi and press Enter: a wrong or revoked key still gets you into Claude Code, and only fails when you actually send a message. A reply means the key works; an error (typically mentioning authentication or a 401) means it doesn't — see step 8. Remember the AI use rules: everything it reads goes to the provider.
The gateway serves every model you're allowed to use — Claude, GPT, and Gemini (which has no coding tool of its own) — through both Claude Code and Codex. Switch with --model, for example claude --model gpt-5.6-sol. Without it you get the gateway's default.
The two variables aren't set in the terminal you started claude from. Check with echo $ANTHROPIC_BASE_URL — if it prints nothing, either use the inline form above, or (if you edited ~/.bashrc) open a new terminal. If echo $MATHPROXY_API_KEY is also empty, the secret hasn't reached this Codespace: see step 5's restart note.
7Log in to Codex
You'll see this menu:
| If you're using… | Choose |
|---|---|
| Your paid ChatGPT account (recommended) | Option 1 — Sign in with ChatGPT |
| The gateway key (alternative) | None of these. Press Ctrl C to leave this menu and follow the gateway instructions below instead. |
It can't finish in a browser Codespace. That's why the VS Code app is recommended — use option 2 below if you're staying in the browser.
If you chose option 1, a browser opens — sign in with your ChatGPT account and approve. The terminal picks it up on its own within a few seconds.
Use option 2 — Sign in with Device Code instead. Same ChatGPT account, but you have to switch it on first: in ChatGPT, go to Settings → Security and login and Enable device code authorization for Codex.
Then pick option 2, open the web address it prints, and type the short code by hand.
To sign out later: type /logout inside Codex. Somewhat hilariously, if you type "exit" or other attempts to leave, Codex will cheerfully bid you goodbye and not close.
Alternative: if you're using the gateway key
Codex doesn't read a base-URL variable the way Claude Code does (it ignores OPENAI_BASE_URL), so instead you tell it about the gateway as a model provider, with five -c options. The key itself is read from MATHPROXY_API_KEY, which step 5 put in your Codespace — nothing to paste. Run it inline, nothing to install or edit:
Codex starts straight away — no sign-in menu — because the key comes from the environment. Type hi and press Enter to make sure it actually answers: a bad key gets you this far and fails only when you send a message (see step 8). The AI use rules apply here just as for Claude Code. Add -m <model> to choose a model, e.g. -m claude-opus-5. These options leave any existing Codex config and ChatGPT login untouched, so you can use both ways side by side.
Typing all that every week is tedious, so you can also write it once into Codex's config file, after which plain codex uses the gateway:
To go back to your ChatGPT account later, delete those lines from ~/.codex/config.toml (or the whole file) and run codex again.
8Check everything works
At the $ prompt, run these two. Version numbers mean success.
Your numbers may differ — that's fine. Any version number means the tool is installed. It does not mean the tool can reach a model — a wrong, expired, or revoked key, or a login that didn't finish, lets you start the tool and only fails when you send a message. So, second check: start each tool, say hi, and make sure it answers.
(If you're on the gateway, start them the gateway way from steps 6 and 7 instead of plain claude and codex.) Any reply at all — a greeting, a question about what you'd like to do — means the connection works.
On the gateway: the key isn't reaching the provider. An error mentioning authentication, unauthorized, or 401 means the key itself is wrong — most often a stray character from copying, or a key you've since revoked. Go back to math.colorado.edu/ai → API keys, revoke it, create a new one, and update the MATHPROXY_API_KEY secret (then stop and start the Codespace, as in step 5). If instead it says the variable is empty or the model is unknown, re-check the commands in steps 6 and 7. On an account login: the sign-in didn't complete — run /login (Claude Code) or /logout then codex again (Codex) and finish the browser approval.
Once both tools have answered you, you're done. Come to class ready to work.
Managing your free hours
GitHub gives free accounts a monthly allowance of Codespaces time, measured in "core hours": hours of wall-clock running time multiplied by the machine's CPU count. Free accounts get 120 core hours a month, and the standard Codespace machine has 2 CPUs — so in practice you have about 60 hours per month. That's plenty for this class, as long as your Codespace isn't running while you're off doing something else.
The meter counts wall-clock time while the Codespace is running — not time you're typing, and not time the machine is working hard. An idle Codespace burns hours exactly as fast as a busy one. Closing the browser tab or quitting VS Code leaves it running — it keeps going until an idle timeout shuts it down, 30 minutes later by default.
Stop it when you're done for the day
Any of these works — they all pause the meter without losing anything:
- From VS Code: click the Codespaces: … badge in the bottom-left corner and choose Stop Current Codespace.
- Or open the Command Palette (Cmd/Ctrl Shift P) and run Codespaces: Stop Current Codespace.
- Or go to github.com/codespaces, click the … menu on your Codespace's row, and choose Stop codespace.
Stopping is not deleting. Your files, your logins, and anything you installed are all there when you reconnect.
Shorten the idle timeout
The idle timeout is your safety net for the times you forget to stop it. You can make it tighter:
- Go to github.com/settings/codespaces — the same settings page as the gateway key.
- Find Default idle timeout and set it to something short. 15 minutes is a good choice for this class.
The new timeout applies to Codespaces you start after changing it, so stop and reopen yours if it's currently running.
A stopped Codespace that sits untouched for about 30 days is automatically deleted, along with any work you haven't pushed to GitHub. During the semester you'll be using it weekly, so this shouldn't bite — but if you take a long break, reconnect once to reset the clock.
Reconnecting: getting back to your work
Everything above is one-time setup. This section is the one you'll use every week.
Your Codespace doesn't go anywhere. Your files, your logins, and anything you installed are all still sitting there exactly as you left them. It goes to sleep when you stop using it — that's normal, and it's how you avoid burning through your free hours — but nothing is lost. Coming back is a matter of reconnecting to it.
First, the thing that confuses everyone
VS Code can show you two completely different computers, and they look identical. It can show files on your own laptop, or files in your Codespace. Same window, same sidebar, same terminal, no obvious difference.
This matters because the class tools only exist in the Codespace. They were never installed on your laptop. So if you open VS Code, type claude, and get command not found, you almost certainly aren't connected — the tool isn't missing, you're just looking at the wrong computer.
Look at the bottom-left corner of the VS Code window. If you're connected, there's a coloured badge reading Codespaces: … followed by your Codespace's name.
No badge means you're on your own laptop. Get in the habit of glancing there before you type anything — it takes half a second and saves a lot of confusion.
Two ways to connect
Both do the same thing. Use whichever you find easier to remember.
Option A — the Command Palette. Faster once you know it.
- Open VS Code.
- Press Cmd Shift P on Mac, or Ctrl Shift P on Windows. A search box appears at the top — this is VS Code's "search all commands" box, and it can run anything VS Code does.
- Type
Connect to Codespace. - Choose "Codespaces: Connect to Codespace..." from the results.
- Pick your Codespace from the list that appears.
Option B — the Remote Explorer sidebar. More clicking, but you can see what you're doing.
- Open VS Code.
- In the narrow icon strip down the left edge, click the Remote Explorer icon — it looks like a small monitor or screen. If you don't see it, it's because the extension only appears once installed; use Option A instead.
- At the top of that panel there's a dropdown. Set it to GitHub Codespaces.
- Your Codespaces are listed. Clicking the name does nothing useful — you have to click the small plug icon that appears to the right of the name when you hover over it. That's the connect button, and it's very easy to miss.
- If you can't find the plug, right-click your Codespace and choose Connect to Codespace instead — same result.
Either way, VS Code will take a few seconds to connect — and longer if the Codespace was asleep, because it has to wake up first. Wait for the badge in the corner before you start typing. A terminal opened too early may be pointing at your laptop.
If you go to github.com/codespaces and click your Codespace's name, it opens in a browser tab, not the VS Code app. That's GitHub's default.
Do I need to log in again?
Normally, no. Your Claude and Codex logins are stored inside the Codespace and survive it going to sleep and waking up.
You will need to log in again if the Codespace gets rebuilt or deleted — for example if you delete it to start fresh, or if you change its settings in a way that recreates it. That's not a sign anything is wrong; just run claude and codex again and log in as you did the first time.
Before you start work: check how you're logged in
This is worth thirty seconds at the start of a session. Because your login is remembered, it's entirely possible to be signed in a way you didn't intend and not notice — most commonly, running on the gateway key when you meant to use your own subscription, or the other way round.
In Claude Code, start it and run:
A Login method row shows your subscription account. If you're on the gateway instead, you'll see the gateway address (math.colorado.edu/ai) and an auth-token row — and the AI use rules apply. That's your answer in one command.
Switching between them
You can switch either direction. The two tools do it differently.
The gateway is used only when you start Codex with the -c options from step 7 (or put them in ~/.codex/config.toml); plain codex without them uses your ChatGPT login. To change the ChatGPT login itself, type /logout inside Codex, then run codex again and pick from the menu.
The gateway is used whenever ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN are set in the terminal you start it from (step 6). To use your account instead, start claude from a terminal where they aren't set — if you added them to ~/.bashrc, remove those two lines and open a new terminal — then /login if it asks. /status tells you which you're on.
When things break
Everything here has happened to someone. None of it means you broke anything.
My browser showed an error right after I approved a login
Common, and fixable. Don't use the browser window that opened by itself. Go back to the terminal, find the web address printed there, copy it, and paste it into a new browser tab yourself. That reliably works.
If the error page mentions localhost, that's this exact problem.
The terminal turned into some app and I can't get out
Press Esc. If that doesn't do it, type /exit (Claude Code) or /quit (Codex) and press Enter.
If it's asking you to paste something, slash commands won't work — it's treating everything you type as the thing you're pasting. Press Ctrl C twice.
Guaranteed escape: click the trash-can icon on the terminal panel to close it entirely, then open a new terminal. You lose nothing — the terminal is disposable, your Codespace isn't.
I set up the gateway key but Claude Code still shows the login menu
Claude Code only uses the gateway when ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN are set in the terminal it's started from. At the $ prompt, run echo $ANTHROPIC_BASE_URL. If it prints nothing, the variables aren't set here: use the inline command from step 6, or — if you added the two export lines to ~/.bashrc — open a new terminal.
If echo $MATHPROXY_API_KEY is also empty, the secret itself hasn't reached the Codespace: it must be named exactly MATHPROXY_API_KEY, and the Codespace must have been stopped and started since you added it (see "I added the gateway key but nothing seems different").
Option 2 in the login menu — "Anthropic Console account" — is not the gateway; it's a browser sign-in to a separate developer account.
I want to switch between my account and the gateway key
Run /status inside Claude Code to see which you're on now.
Claude Code: it's decided by the environment. Variables set → gateway; not set → your account (run /login if it asks). See step 6 and Reconnecting.
Codex: it's decided by how you start it. With the -c options from step 7 → gateway; plain codex → your ChatGPT login (unless you wrote the options into ~/.codex/config.toml, in which case delete them to go back).
I pressed Ctrl+C to copy and something died
In a terminal, Ctrl C traditionally means stop the running program. VS Code is usually smart enough to copy when you have text selected — but with nothing selected, it interrupts. On Mac use Cmd C. No harm done; just start the command again.
claude or codex — "command not found"
Most likely: you're not connected to your Codespace. These tools were never installed on your own computer, so they can't run there. Check the bottom-left corner for the Codespaces: … badge — no badge means you're on your laptop. See Reconnecting.
On a brand-new Codespace: the setup step may still be running. Wait a minute and try again. If it still fails, run this yourself and let it finish:
npm install -g @anthropic-ai/claude-code @openai/codex
I added the gateway key but nothing seems different
Secrets are only handed to your Codespace when it starts. Stop it (from github.com/codespaces, the … menu → Stop codespace), then start it again — click Start in the pop-up VS Code shows, or reconnect as in Reconnecting, or click its name on that same GitHub page. Then check with:
[ -n "$MATHPROXY_API_KEY" ] && echo "KEY IS SET" || echo "KEY IS NOT SET"
If it says NOT SET, the most likely cause is a typo in the secret's name. It must be exactly MATHPROXY_API_KEY — all capitals, underscores.
Adding a secret can also cause your Codespace to be rebuilt, which logs you out of both tools. That's not a fault; just log in again.
Where did my Codespace go?
Go to github.com/codespaces — every Codespace you own is listed there. Click one to reopen it. Your files and your logins are exactly as you left them.
Codespaces go to sleep after about 30 minutes of inactivity. That's normal and nothing is lost.
VS Code is showing files but I'm not sure it's the Codespace
Check the bottom-left corner for the Codespaces: … badge. No badge means you're looking at your own laptop. Reopen from github.com/codespaces.
macOS asked if VS Code can "access data from other apps"
You can decline. Nothing in this setup needs it, and you can always grant it later in System Settings if something turns out to require it.
GitHub says I'm out of free Codespaces hours
Free accounts get a monthly allowance of Codespaces time. Stop your Codespace when you're done for the day — from github.com/codespaces, the … menu on its row has Stop codespace. That pauses the meter without losing your work. See Managing your free hours for the idle-timeout setting that catches the times you forget.
If you run out anyway, tell your instructor.
Everything is broken and I want to start over
That's a completely legitimate move and costs about three minutes. At github.com/codespaces, delete the Codespace, then create a new one from your repo. You'll need to log in to both tools again.
Being able to throw it away and start fresh is the whole point of working this way.
Set up once, then come to class ready to work. If you get stuck on any step, bring the exact error text with you — copying what you actually saw makes it much easier to help you.