Setting up for Learn AI Agents
Building an agent takes surprisingly little setup. You need somewhere to send a request, permission to send it, and a model on the other end that can call tools.
That's three values. The rest of this guide is about getting them right the first time, so that nothing in the course fails for a reason that has nothing to do with agents.
These pages accompany Scrimba's Learn AI Agents course, and they stand on their own. If you're working through the course in the browser, you only need the first three pages. The last two are for when you want the code on your own machine, and then online.
The course code is JavaScript, and the JavaScript handbook is there if you want to shore that up first.
What you'll set up
Three environment variables carry everything the course code needs to reach a model:
| Variable | What it holds |
|---|---|
AI_URL | The provider's API base URL, which is where requests get sent |
AI_KEY | Your API key, which is what authorizes those requests |
AI_MODEL | The ID of the specific model you want to talk to |
They have to agree with each other. A valid key pointed at the wrong provider's URL fails, and a correct provider with a model ID that provider doesn't serve fails too. Whenever you switch providers, change all three together.
Coming from Intro to AI Engineering?
These are the same three variables that course used. If you already have them saved in Scrimba, you may be able to skip straight to recommended models and confirm your model supports tool calling.
AI_URL, AI_KEY and AI_MODEL are one setting in three parts. The URL says which company you're talking to, the key proves you're allowed to, and the model says which model answers. They only work as a matched set, so change all three together whenever you switch. One provider's key with another provider's URL is the mistake to watch for.
The pages in order
Provider setup walks through creating an account with OpenAI or OpenRouter, generating an API key, and storing all three values.
Recommended models covers the one hard requirement, tool calling, and gives a tested shortlist so you don't have to guess.
Chat Completions and Responses explains the two OpenAI APIs you'll see in the wild, how their request and reply shapes differ, and why this course uses Responses.
Running the code locally is for when you want the project off Scrimba and onto your own machine, covering the download, the .env file, installing dependencies, and the port collisions that catch people out.
Deploying your agent app is the step after the course: putting the finished OpenSwap app, or your Charta solo project, online with a production build and a host.
The last two can wait until you want the project on your own computer or online.
One thing to decide up front
The course code uses the OpenAI client pointed at whatever AI_URL you set, and it calls the Responses API. So a provider has to do more than accept OpenAI-shaped requests. It has to serve Responses, and the model behind it has to call tools reliably through it. The routes on the recommended models page have been tested that way.
Tool calling is the requirement that doesn't bend. This course builds its agent on the model's native tool calling: the model returns a structured request to run one of your functions, and your code runs it. Agents can be built in other ways, but this course's code can't run without it, however the rest is written.
Keep that in mind if you go exploring beyond the recommended list, because a model limitation and a bug in your code look identical from the console.
The agent in this course works by asking your code to run something, so a model that can't make that request can't run it. The shortlist on the models page has this checked already.
Other Scrimba AI courses
Every other AI course and project has its own local setup guide. Run an AI course project locally is the index for those, covering the AI Engineer Path, Chef Claude, and Intro to Mistral AI.

