Agent setup · Exercise 01

Models

Get to know the models your agent can use, when each one is worth it, and the best-value way to pay for them.

Models

The model behind your agent is the biggest factor in how useful it’ll be. Your agent can probably use several, and picking the right one for the task, and paying for it the right way, makes a real difference.

The models in your agent

Each agent offers its own lineup, usually from fast and cheap to slow and most capable. In Claude Code, that’s Haiku, Sonnet, Opus, and Fable. In Codex, it’s Luna, GPT-6.1 Sol, and Astra. Agents that aren’t tied to one lab, like OpenCode and Pi, offer whatever models the providers you sign in with have.

You’ve been using a model this whole time: it’s what’s been answering you. Your agent will tell you which one, then help you choose on purpose.

Most agents let you see and switch models with a /model command. The goal here is to find where your app picks the model, compare what’s in it (which models are more capable, which are faster or cheaper), and choose one for a quick fix and one for a bigger task. If /model doesn’t work in your app, look for a model picker or a setting instead, or ask your agent. Comparing what’s there matters more than the exact command.

Bigger isn’t always better

More capable models plan better, catch more of their own mistakes, and need less hand-holding on hard problems. They’re also slower, and they use up your plan’s limits faster. Smaller models are quick and great for small, well-defined changes.

A good habit: stick with your agent’s default for most work, switch up for big or tricky tasks (or when it’s going in circles), and switch down for quick, mechanical ones.

Paying for it

For everyday coding, a subscription is usually the best value: a flat monthly price and no surprise bills. If you’re new to this, start with Claude Pro for Claude Code or ChatGPT Plus for Codex. Both are $20/month with generous usage limits. ChatGPT’s free plan works in Codex too, with lower limits.

Plans don’t work everywhere. OpenAI lets you use a ChatGPT plan in other agents like OpenCode and Pi. Anthropic doesn’t allow Claude plans outside Claude Code. What’s an agent? lists how you pay for each supported agent.

Context windows

Every model has a context window: the amount of text it can consider at once, measured in tokens (roughly ¾ of a word). It includes your messages, files the agent has read, and its own previous responses. Today’s flagship models handle around a million tokens, but they still do best when a session stays focused. If your agent starts acting like it forgot something you said earlier, start a fresh session for the next task.

Cloudflare as a model provider

If you already have a Cloudflare account, AI Gateway is worth knowing about, though it isn’t required for this course. Its REST API reaches models from Anthropic, OpenAI, Google, and xAI (Grok), plus open-weights models like Kimi, GLM, and DeepSeek, all through the same endpoints. With Unified Billing, you load credits into your Cloudflare account and pay for all of them there, with no separate provider accounts or API keys.

Where you’ll use this

The model you picked does the work in every course from here. A short, well-defined exercise like Deploy a Worker is a good fit for your default. A bigger build that spans several exercises, like Build a guestbook, is where switching to a more capable model can pay off.