Your AI Tools and Babson Key

On this page
  1. What you receive
  2. Rules and budget
  3. Set it up in marimo
  4. Set it up in VS Code
  5. Your agent's rules
  6. Spend the budget well
  7. Where your key is stored
  8. Other AI tools
  9. If something breaks

Babson gives you an API key for Claude Sonnet 5, with a $100 monthly budget paid for by the College. You do not request it: Babson's AI team emails it to you. This page sets it up in the two places this course uses, marimo in your browser and VS Code, one click at a time.

Which one to ask. Ask where the problem is. A question about your notebook, such as why a cell returns the wrong number, goes to the agent in your browser. A problem with your machine, such as a package that will not install or a push that fails, goes to VS Code, which can run a command in your terminal. The browser agent cannot.

Before you start, work through Starting a project until uv run marimo edit opens your notebooks. Then do the marimo part below first, because the VS Code part uses the packages it adds.

What you receive#

An email with four values in it:

Field What it is
Gateway base URL The address your tools send requests to
API key Your key, starting with sk-
Auth scheme x-api-key. Neither setup below asks for it
Model The exact model name to ask for, claude-sonnet-5

Keep that email open while you work. This page never shows the gateway URL or the key, so read both from your own message. If the email has not arrived, check your spam folder, then ask me.

Rules and budget#

  • Use it for coursework. For a personal project, use a key of your own.
  • Nothing public-facing. Do not put this key into a deployed website, an app, or any service where other people could send requests through it. Your own laptop, notebook and editor are fine, and so is publishing a notebook that does not contain the key.
  • Do not share it. Every request is attributed to your key, so lending it out means lending your identity.
  • Assume it is logged. Requests through the gateway, including what you ask and what comes back, are recorded and attributable to your key.
  • The budget is $100 a month. It resets each month, and requests stop when it runs out. A long chat spends it fastest, because every message sends the whole chat again. Spend the budget well has the habits that stretch it.
  • The key must go in marimo's settings screen and VS Code's model list, and into no file of your project except .env. Both settings screens keep it outside your repository. A program of your own that calls the API, such as the database project's Going further, reads it from .env in the root folder, once .gitignore lists .env, as the course's does; Python handbook §32 shows how. If an agent suggests putting the key into any other file in your project, such as pyproject.toml, say no. Everything else in your repository gets published.

Set it up in marimo#

Add the packages the agent needs#

The marimo in your project does not yet include the packages it uses to reach a model. Without them, the settings screen says Configured and your first message fails with ModuleNotFoundError: pydantic_ai. Add them once per project.

  1. Open your repository in VS Code from GitHub Desktop, and click into the Terminal where uv run marimo edit is running. If marimo is not running, skip to step 4.

  2. Press Ctrl+C. That is Ctrl on macOS too, not Cmd.

  3. marimo asks Are you sure you want to quit? (y/N). Type y and press Enter.

  4. Paste this line into the Terminal and press Enter:

    uv add "marimo[recommended]"

    It prints a list of packages, each line starting with +. Among them are openai, pydantic-ai-slim and ruff. ruff is the formatter, and Formatting on save in marimo Basics has the switch for it.

  5. Paste this line and press Enter:

    uv run marimo edit

    Your browser opens your project again. Click the notebooks folder, then the notebook you were working on.

Add the Babson provider#

  1. In the notebook page, click the settings gear. A settings dialog opens, with sections down the left: Editor, Display, Packages & Data, Runtime, AI, Optional Dependencies, Labs.
  2. Click AI. Four tabs appear across the top: AI Features, AI Providers, AI Models, MCP.
  3. Open AI Features first and check that Enable AI features is ticked. Do this before anything else. When it is unticked, marimo hides every AI action, the Chat & Agents icon included, and the rest of this page has nothing to configure. If you cannot find the tick box here, look under Settings → User settings → AI for the same one.
  4. Open AI Providers and scroll past the built-in providers to the heading CUSTOM PROVIDERS.
  5. Click + Add Provider. A form appears with three fields:
Field What to put in it
Provider Name babson_ai
Base URL The gateway base URL from your email, exactly as it appears. Add nothing to the end of it, not even /v1
API Key (optional) The key from your email, starting sk-, pasted whole with no space at either end. Optional for other providers, required here
  1. Click the form's Add Provider button.
  2. A new row appears, reading Babson Ai, with a grey Configured badge. marimo capitalizes the name for display, and the real name stays babson_ai.

Configured means the provider was saved. It does not mean the key works. The check comes after the next step.

Choose the model#

Stay in the settings dialog and open the AI Features tab. It has two sections, CODE COMPLETION and AI ASSISTANT. Set four boxes:

Section Box Set it to
CODE COMPLETION Provider custom
CODE COMPLETION Autocomplete Model babson_ai/claude-sonnet-5
AI ASSISTANT Chat Model babson_ai/claude-sonnet-5
AI ASSISTANT Edit Model babson_ai/claude-sonnet-5

Once the provider exists, each model dropdown offers babson_ai/claude-sonnet-5.

  • Set all four. A box left empty gives no error anywhere: the part you set works, and the part you missed never answers. The one people miss is Provider under CODE COMPLETION, which has a dropdown of its own.
  • The model name comes from your email. If your Model line says something other than claude-sonnet-5, put what it says after babson_ai/, hyphens included.
  • Leave Enable AI features checked. Unchecked, it hides the AI panel and everything else on this page.

Then close the settings dialog.

Check that it works#

  1. On the left edge of the notebook page, click the icon whose tooltip reads Chat & Agents. A panel opens beside your notebook, with a Type your message box at the bottom.

  2. Under that box are two dropdowns. Set the left one to Agent. The right one should read babson_ai/claude-sonnet-5.

  3. Ask this question about your own notebook:

    What cells are in this notebook right now, and which of them have not run yet?

  4. Then ask: Add a cell that prints the number 1. When the cell appears, click Discard cell.

It worked when you have seen all three of these:

  • The model dropdown reads babson_ai/claude-sonnet-5. That is how you can always tell what answered you.
  • A row starting Done:, such as Done: get_tables_and_variables, sits above the answer. That row is the agent reading your running notebook instead of guessing from the file.
  • The new cell arrives with Keep cell and Discard cell, and a Keep all / Discard all bar appears at the bottom of the notebook. Nothing reaches your notebook until you press one of them.

If an error comes back instead, go to If something breaks at the bottom of this page.

Read back what you set#

This step is optional and changes nothing. In VS Code, open a second Terminal with Terminal → New Terminal, and run:

uv run marimo config show

It prints your marimo settings. Look for a section named [ai.custom_providers.babson_ai] with your base_url, and three lines under [ai.models] reading babson_ai/claude-sonnet-5. Your key prints as ********, so the output is safe to paste into a question.

Do not edit marimo's configuration file by hand, and do not let an agent edit it. A section added by hand can make marimo reject the whole file and fall back to its defaults, which removes your provider and all three models without a message on screen.

Set it up in VS Code#

VS Code can open the same notebook inside the editor, and its Chat can run on the same key. You do not need a GitHub Copilot account or plan for this, because a model on your own key works without signing in.

Install the marimo extension#

  1. In VS Code, open the Extensions view: press Ctrl+Shift+X on Windows or Cmd+Shift+X on macOS, or click the icon of four squares on the left edge.
  2. Type marimo in the search box.
  3. Install the extension named marimo whose publisher is marimo-team. Several extensions mention marimo, so check the publisher. Its identifier is marimo-team.vscode-marimo.
  4. VS Code installs Microsoft's Python extension along with it, because the marimo extension needs it. There is nothing to install separately.

Open your notebook in VS Code#

  1. Open your repository from GitHub Desktop with Open in Visual Studio Code, so VS Code has your course folder open.
  2. Open the Command Palette with Ctrl+Shift+P on Windows or Cmd+Shift+P on macOS. Type Python: Select Interpreter, run it, and choose the entry whose path ends in .venv. That is your project's environment, with marimo and the packages from the marimo part in it. If no entry ends in .venv, run uv sync in the Terminal and try again.
  3. In the file list on the left, open the notebooks folder and click a notebook, such as 01-first-notebook.py. VS Code first shows it as plain lines of Python.
  4. At the top right of the editor, click the marimo logo, a dark green circle with an m inside. The file reopens as a notebook, with cells and a toolbar reading Generate, + Code, + Markdown and Run All.
  5. At the right end of that toolbar, click Select Kernel and choose your project's environment, the same .venv you picked in step 2.
  6. Click Run All and wait until each cell shows a check mark and a time.

Do not skip Run All. An agent cannot read a notebook that has not run, so it either guesses from your file or tells you there is no active kernel.

Add the Babson model#

  1. Open the Command Palette and run Chat: Manage Language Models. If it is not in the list, VS Code's chat is turned off: type chat in the Command Palette, run Use AI Features with Copilot for Free, sign in with GitHub if it asks, and try this step again.
  2. Click Add Models.
  3. Choose Custom Endpoint.
  4. For the group name, enter Babson AI.
  5. For the display name, enter Sonnet 5 (Babson). Then paste the API key from your email.
  6. For the API type, choose Messages. The other choices fail with an error that looks like a bad key.
  7. VS Code opens a file called chatLanguageModels.json. Change only its models list: find the line "models": [, delete everything between that [ and the ] that closes it, and paste this block in its place.
{
  "id": "claude-sonnet-5",
  "name": "Sonnet 5 (Babson)",
  "url": "YOUR_GATEWAY_BASE_URL/v1/messages",
  "toolCalling": true,
  "vision": true,
  "maxInputTokens": 200000,
  "maxOutputTokens": 64000
}
  1. In the url line, replace YOUR_GATEWAY_BASE_URL with the gateway base URL from your email, and keep /v1/messages after it.
  2. Format the file with Shift+Alt+F on Windows or Shift+Option+F on macOS. If VS Code will not format it, a bracket, quotation mark or comma is missing or extra; compare the file with the block above.
  3. Save the file with Ctrl+S on Windows or Cmd+S on macOS.

Get these right:

  • id has to match the Model line in your email exactly, every hyphen included. A near miss returns an error that looks like a broken key.
  • url has to be your gateway base URL with /v1/messages on the end. Keep its https://. This is the one place the URL takes an ending, and marimo's Base URL box takes it bare.
  • Leave the apiKey line alone. VS Code wrote it, and it looks like ${input:chat.lm.secret...}. It points at the key you pasted in step 5, which VS Code keeps in its secret storage. Pasting over it breaks the model.
  • Keep maxInputTokens and maxOutputTokens as shown. The Babson deployment accepts up to a million input tokens and 128,000 output tokens. VS Code summarizes the older part of a chat once it nears the size these values set, so 200,000 also limits how much one request sends.

Check that it works in VS Code#

Keep the notebook open, with its cells run.

  1. Open the Chat view: in the title bar at the top of VS Code, select the Chat menu, then Open Chat. You can also press Ctrl+Alt+I on Windows or Ctrl+Cmd+I on macOS. It opens on the right.
  2. Click the model picker at the bottom of the chat box and choose Sonnet 5 (Babson). Until you choose it, the chat uses Copilot's default model on its own small allowance. If it is not in the list, open chatLanguageModels.json, check that the name line reads "Sonnet 5 (Babson)", then restart VS Code and look again.
  3. Set the agent picker beside it to Agent.
  4. Ask the same question as in the marimo check: What cells are in this notebook right now, and which of them have not run yet?

It worked when the answer names your cells. A collapsed line such as Completed 4 steps appears above it, and when you expand it you see rows like Running code in the marimo kernel.... Those rows are the agent reading your running notebook.

How VS Code differs from the browser#

Both agents read your running notebook. The difference is when you see a change. In the browser, a change arrives with Keep cell and Discard cell, and nothing reaches your notebook until you press one. In VS Code the cell is added and run straight away, the file shows as unsaved, and the way back is Restore Checkpoint: hover over your request in the chat, select it, and confirm. VS Code puts your files back as they were before that request and removes that request, and every one after it, from the chat. It does not undo a command the agent already ran. So in VS Code, read the code before you save the file.

The Generate button in the notebook toolbar belongs to marimo, and it runs on the key you set up in marimo, not on this one.

Your agent's rules#

Keep the course's AGENTS.md in the root folder of your repository and commit it. It is a short set of rules for your agent: how to explain code to a beginner, how marimo works, and to install packages with uv. The agent in VS Code sends the file with every request, so you never have to repeat the rules in a chat.

Add the file#

  1. Open Your agent's rules and click Copy the text.
  2. In VS Code's file list, make a new file named AGENTS.md in the root folder of your repository, beside README.md. Paste the text into it and save.
  3. In GitHub Desktop, write add AGENTS.md in the Summary box, click Commit to main, then Push origin.

Open the repository folder itself#

VS Code reads AGENTS.md only from the root of the folder it has open. Open your repository from GitHub Desktop with Open in Visual Studio Code, as in Starting a project. When the folder above it is open instead, such as GitHub, the file is not read.

Trust the folder#

The first time VS Code opens your repository, it asks Do you trust the authors of the files in this folder? Click Yes, I trust the authors. An untrusted folder opens in Restricted Mode, where Chat does not run and the Terminal asks for trust before it opens.

Check that the agent reads it#

Ask the agent anything in Chat. Under its reply, expand References. AGENTS.md is in the list.

The same rules in marimo#

marimo does not read the file, so paste the same text into its settings. Click the settings gear, then AI, then the AI Features tab, paste the whole file into the Custom Rules box, and close the settings. When you change the rules in one place, change them in the other.

Make the rules your own#

The file is yours. Delete a rule you disagree with. When the agent makes the same mistake twice, add a rule that says what to do instead. Keep the file short, because the agent reads all of it with every request and follows a long list less closely.

The same file can work differently with another model or another tool. When a rule is not followed, first check References to see whether the file was read, then rewrite the rule to be more specific.

In a project repository#

Copy your AGENTS.md into the project's repository, then add a section at the end headed ## This project that covers these four things:

  • how to run the project
  • where the data comes from, or where the key goes
  • which files the agent must not change
  • which parts you write by hand

Leave out anything the README already says.

A repository somebody else wrote#

Read its AGENTS.md before you trust the folder. Its rules go to your agent with every request, the same way yours do.

Spend the budget well#

Every message in a chat sends the whole conversation again, including the files and screenshots in it. Each message costs more than the one before, and the replies slow down.

Anthropic's Explore the context window plays a Claude Code session from start to finish and shows each file, instruction and reply adding to what the agent sends with every message. The agents in marimo and VS Code build up a chat the same way.

  • Start a new chat for each task. When a chat gets long, ask the agent to write what you have decided into a Markdown file in the project, then start a new chat and have it read that file.
  • Put several changes in one message. A single message with five changes costs far less than five separate messages.
  • Make small edits yourself. A word, a number or a color is faster to change in the file than to ask for.
  • Paste text when you can select it. Copy an error message, a line of code or a table and paste it into the chat. Text costs a fraction of an image, and the agent reads it exactly. Add a screenshot only when the agent needs to see the screen itself, such as a layout or a chart.

In VS Code, start a new chat with New Chat (+) in the Chat view. When a chat nears the size set in chatLanguageModels.json, VS Code replaces its older part with a summary, and details from early in the chat can drop out.

In marimo, start a new chat with the icon whose tooltip reads New chat, in the Chat & Agents panel. marimo sends the whole chat with every message, however long it gets, and your Custom Rules with it. Its agent cannot write a file, so ask it to put what you have decided into a markdown cell at the top of the notebook, click Keep cell, and then start the new chat. With Agent selected, the new chat reads that cell along with the rest of the notebook.

These habits stretch this key's budget. They are not a reason to use AI less. Token prices keep falling and the models keep improving, so learning to get the most out of the strongest ones is worth what it costs. When a task needs more than this budget allows, use a key of your own and keep going.

Where your key is stored#

  • marimo writes it to its configuration file in your home folder. uv run marimo config show prints that file with the key hidden.
  • VS Code keeps the key in its secret storage, and chatLanguageModels.json among its own settings.

Both are outside every project folder, so neither reaches git or GitHub.

Other AI tools#

Advanced. Nothing in this course requires anything in this section. The Babson key in marimo and in VS Code covers every piece of course work.

A key from another provider#

VS Code takes a key from another provider the same way it takes the Babson one. Run Chat: Manage Language Models, click Add Models, and choose the provider, such as Anthropic, OpenAI or Gemini, where the steps above chose Custom Endpoint. Paste your key when VS Code asks for it. The model then appears in the model picker beside Sonnet 5 (Babson).

marimo works the same way. Its AI Providers tab lists the built-in providers above CUSTOM PROVIDERS, and each one takes a key of its own.

You pay that provider for what you use. The rules at the top of this page apply to that key too: keep it out of anything public-facing, do not share it, and keep it out of your repository.

The course MCP server#

This course has an MCP server, a read-only connection that lets an agent look things up on this site. It can list the sessions, read one session with its post-class notes, find the next session, and search the guides. With it, the agent in VS Code reads its answer to a question about the course from this site.

  1. In the root folder of your repository, make a folder named .vscode, and in it a file named mcp.json.
  2. Open /llms.txt on this site, find the line that contains {"servers", and copy that whole line.
  3. Paste it into mcp.json and save the file.
  4. Restart VS Code. If it asks whether to start or trust the server, allow it. The server reads the course site and changes nothing.
  5. In the Chat view, with Agent selected, ask What is the next session of this course about?

It worked when the answer gives the date and topic of the next session.

Claude Code and Codex#

Both are agents that work on the files in your repository and run commands in your terminal, beyond a single notebook. Each comes as a VS Code extension and as a program you run in a terminal. Both read your AGENTS.md.

Claude Code, from Anthropic:

  • In VS Code, install the extension Claude Code whose publisher is Anthropic. Its identifier is anthropic.claude-code.
  • In a terminal, install it with one line: curl -fsSL https://claude.ai/install.sh | bash on macOS, or irm https://claude.ai/install.ps1 | iex in Windows PowerShell. Then run claude in your repository.
  • To sign in, it needs a paid Claude plan (Pro, Max, Team or Enterprise) or a Claude Console account. The free Claude plan does not include it.
  • On your Babson key, Claude Code is switched off by default. The Babson AI team, at ai@babson.edu, can turn it on.

Codex, from OpenAI:

  • In VS Code, install the extension whose publisher is OpenAI. Its identifier is openai.chatgpt.
  • In a terminal, the install command for your system is on the Codex CLI page.
  • To sign in, use a ChatGPT account, whose Free, Go, Plus, Pro, Business, Edu and Enterprise plans all include Codex, or an OpenAI API key, which is billed at API prices.

Review works differently. The agent in your browser hands you each change as Keep cell or Discard cell. These agents change files and run commands, and how often they stop to ask first depends on their settings, so read each request before you approve it.

If something breaks#

In marimo

What you see What to do
Settings says Configured, and your first message fails with ModuleNotFoundError: pydantic_ai The packages are missing. Do Add the packages the agent needs again
An error that looks like a bad key Check the key for a space at either end, the Base URL for anything added to it, and the model name against your email
babson_ai/claude-sonnet-5 is missing from the dropdowns Check that AI Providers lists Babson Ai with a Configured badge. If it does, add the model by hand on the AI Models tab, then go back to AI Features
The chat answers, but no suggestion appears as you type in a cell Provider or Autocomplete Model under CODE COMPLETION is still empty
There is no Chat & Agents icon, or no robot icon on the left Enable AI features is unticked. It is on the AI Features tab, and the same tick box is under Settings → User settings → AI. Check this before anything else: with it off, nothing else on this page has any effect
uv trampoline failed to canonicalize script path, or marimo will not start at all The virtual environment is broken. Delete the .venv folder in your repository, then run uv add "marimo[recommended]" again. It rebuilds .venv from pyproject.toml, so you lose nothing

In VS Code

What you see What to do
No extension named marimo from marimo-team Search for marimo-team.vscode-marimo
There is no marimo logo at the top right of the editor Run marimo: Open as marimo notebook from the Command Palette. If VS Code does not offer that command, the extension is not installed
Select Kernel offers nothing ending in .venv Run uv sync in the Terminal, then Python: Select Interpreter again
The agent says there is no active kernel Click Run All, then ask again
The model picker reads Models unavailable while in Restricted mode The folder is not trusted. Run Workspaces: Manage Workspace Trust from the Command Palette and trust it
Sonnet 5 (Babson) is missing from the model picker Run Chat: Manage Language Models, select the gear icon next to Babson AI, and check the details. In chatLanguageModels.json, look for a missing comma or bracket. Then restart VS Code
It is still missing after a restart Under the chat box, open Session Target and choose Local. A model you added yourself runs in a Local session
An error naming the model id does not match the Model line in your email
An authentication error A space came along with the pasted key, or url is missing /v1/messages
It broke right after you pasted into the JSON file The paste replaced the apiKey line. Run Chat: Manage Language Models, select the gear icon next to Babson AI, and enter the key again
It answers without looking at your data Set the agent picker to Agent, check that Session Target is Local, and run the notebook
It only tells you which command to run Set the agent picker to Agent
AGENTS.md is not under References Check that the folder VS Code has open is your repository itself, and that the file is named AGENTS.md and sits beside README.md

In either one, if the agent worked and then stopped, the monthly budget has probably run out. It resets next month.

For a problem installing anything, Babson's IT Service Center is at support@babson.edu. For the key itself, such as a replacement or the budget, the Babson AI team is at ai@babson.edu. Bring everything else to class or office hours.

Last updated: Sunday, 11/1/2026