How to start coding with AI without going broke
Ollama, OpenCode Go, NVIDIA NIM, OpenRouter and friends. How to start coding with AI on the cheap, where that approach falls short, when it's worth paying for Codex or Claude Code, and which skills (RTK, caveman, ponytail) help you stop burning through tokens.

.jpg)
The first question I hear from people who want to start coding with AI isn't “which model is best?” It's “how much is this going to cost?” And that's a very good question, because a coding agent can burn through a surprising number of tokens in a single afternoon. For plenty of projects, though, you can get by with a free model. That's enough to write a few scripts for yourself, prototype an app, or see what these models can do.
Two terms first
A token is a small chunk of text, such as a whole word, part of a word, or a punctuation mark. Providers use tokens to measure and bill for usage.
An agent (a program that lets a model read files, run commands, and fix code on its own) sends dozens of requests to the model for a single task. Each request carries the conversation history, chunks of code, and command output. That's where those bills come from.
You can get started for next to nothing, but “next to nothing” comes with a few catches that people rarely talk about. I'll go through the cheapest options and where they fall short, then show you how to keep the pricier tools from eating up your budget.
Ollama: run a model on your own hardware
Ollama is the easiest way to run an open language model on your own computer. Install it, type ollama run <model-name>, and a moment later you're chatting with a model that runs entirely on your machine. No account, no credit card, nothing sent over the internet. Ollama also exposes a local API (at 127.0.0.1:11434 by default), so you can hook it up to an editor or coding agent.
Sounds ideal, until you get to the hardware. Models that are really good at coding have tens or hundreds of billions of parameters and need a lot of GPU memory. On a typical laptop, you can run smaller, heavily quantized versions. Their weights are stored at lower precision so they fit in memory, at the cost of some quality. Smaller models are fine for autocomplete and simple questions. They tend to struggle when you ask them to work through a large codebase on their own.
Ollama also has a cloud version for anyone who doesn't have the hardware. The Pro plan costs $20 a month and includes $60 in cloud model credits. Max costs $100 and includes $300 in credits. Ollama says it doesn't log cloud prompts or responses or use them to train its models. At that point, though, your code is leaving your machine for someone else's servers, mostly in the US.
OpenCode and the Go subscription
OpenCode is an open-source coding agent that runs in your terminal. Think of it as a free alternative to Claude Code that you can hook up to almost any model provider, including a local Ollama instance. The agent itself is free. You only pay for the models.
That's where OpenCode Go comes in. It's a $10-a-month subscription (Go Plus is $40, and the team plan is $20 per person). You get access to dozens of mostly open models, including GLM, Kimi, Qwen, DeepSeek, and MiniMax. All the paid models draw from one shared monthly allowance, but each model uses it up at a different rate, so the same dollar of usage takes a bigger bite on some models than on others. On top of that, a five-hour window is capped at 20% of the monthly allowance and a weekly window at 50%.
If you've read my post on Mixture of Experts, you'll know how they can charge so little. A good share of these models use MoE architectures, which only activate a fraction of their parameters for each token. That makes them cheap to serve.
What I like about the OpenCode Go docs is that they spell out what happens to your data with each model. For most models, there's zero data retention, and your requests aren't used for training. Some, including the OpenAI and xAI models on the plan, retain data for 30 days. Models marked “Contributor” are cheaper precisely because your prompts and responses go into training future models. Those models are disabled by default, and the allowed regions are Europe and the US. But a workspace owner or admin can turn them on with a single switch in the privacy settings. Worth checking before you hook up a company repository.
NVIDIA NIM, OpenRouter, Standard Compute: free and flat-rate APIs
The next group gives you one API (usually OpenAI-compatible) for a whole bunch of models.
NVIDIA NIM offers free access to many open models at build.nvidia.com through the NVIDIA Developer Program. All you need is an account. No credit card. There are two catches, both in the fine print. First, the rate limit. Some users report a limit of around 40 requests per minute. That sounds like plenty until your agent starts firing off requests in bursts and getting politely turned away. NVIDIA says the free-tier limit varies by model, use case, and traffic. The NVIDIA forums are full of people asking for a bump to 200 RPM (requests per minute) and mentioning their “agentic coding workflow.” Second, free access is for prototyping, testing, and research. Production use requires an NVIDIA AI Enterprise license, and NVIDIA reserves the right to end the service at any time.
OpenRouter is a middleman that gives you access to hundreds of models from different providers with a single API key. You pay for what you use, and there's a pool of free models (look for the :free suffix). Those models are capped at 20 requests a minute and 50 a day. Buy at least $10 in credits once and the daily cap goes up to 1,000. OpenRouter itself doesn't log prompt contents by default, but what happens to your data after that depends on the provider serving the model. And here's the price of free. Some free endpoints are run by providers that can train on your data.
Standard Compute takes a different approach. You pay a fixed monthly fee (from a few dollars to a few hundred, depending on the plan and speed) for an API the company calls “unlimited.” In practice, it's a layer that routes your requests to different model providers, and “unlimited” comes with a fair-use policy. They say so on their own site. A flat rate still comes with limits on compute. Most of what's written about the service comes from its own marketing, so take it with a grain of salt.
Where's the catch? The downsides and risks
All of these options are great for learning and personal projects. Before you point any of them at a client's code, though, go through this list.
Where your code goes
The agent sends the model chunks of your repository, configuration, and sometimes the contents of .env files. With every middleman, ask who can see that data, how long they keep it, and whether they train on it. The answers can get uncomfortable with free endpoints, and your client's NDA doesn't have a “but the model was free” clause.
A middleman is another link in the chain
The aggregator sees all your traffic, including code, prompts, and responses. Then there's the API key. You have to store it somewhere, and if it leaks, someone else can burn through your allowance or run up charges on your card.
Limits that don't fit the way agents work
Forty requests a minute or 50 a day may be enough for a chat. An agent can take dozens of steps on a single task. The task cuts off halfway through, and you're left wondering whether the agent finished or just got rate-limited.
Quality you can't control
The same model can behave differently across two providers. One might serve it at full precision while the other serves a quantized version. Free models also come and go. Today's “Free for a limited time” model might cost money tomorrow or disappear from the lineup altogether.
No guarantees
Free access usually means no SLA (an agreement that guarantees service availability), no support, and a clause that says the service can end at any time. Fine for experiments. Risky as the foundation for a team's work.
Running locally only gets you so far
In January 2026, researchers from SentinelOne and Censys found more than 175,000 Ollama servers across 130 countries that were reachable from the internet without authentication. Ollama only listens on 127.0.0.1 by default. But set it to 0.0.0.0 “so it works from the other computer,” or publish a port in Docker, and your model can turn into a free GPU for strangers. These servers are discovered automatically and resold as compute.
The agent has access to your computer
This goes for every agent, cheap or expensive. A model that can run commands can also follow an instruction slipped into a file, webpage, or issue. That's called prompt injection. A weaker model is easier to fool, so sometimes saving money on the model means cutting corners on security, too.
Free options still make sense, as long as you know what you're giving up.
The pricier options: Codex and Claude Code
If you want an agent that can genuinely work on a large project on its own, sooner or later you'll land on one of the two tools setting the bar today. There's OpenAI's Codex and Anthropic's Claude Code. Both run in the terminal and in editors, and both use their makers' leading models.
The two companies price their plans pretty similarly.
Table 1. Claude Code and Codex plans
| Tool | Paid plan compared | Higher tiers |
|---|---|---|
| Claude Code | Pro at $20/month ($17/month if billed annually) | Max at $100, Ultra at $200 |
| Codex (through ChatGPT) | Plus at $20/month (there's also Go at $8 and a limited free plan) | Pro from $100 ($100, $200, and $500 options) |
On a $20 plan, you'll quickly get familiar with usage windows. Both companies count usage in five-hour and weekly windows. Codex on Pro plans is the exception. OpenAI dropped the five-hour window there and kept the weekly limits. An agent that does a lot of reading and writing can burn through a window's allowance in an hour or two of heavy work. Then you wait or move up to a higher plan.
With an expensive tool, every wasted token stings twice as much. You're either paying more or hitting your limit sooner. And agents are very happy to waste tokens. They'll read the entire output of git log when they need three lines, give you three paragraphs when one sentence would do, and write 300 lines of code where 10 would have worked. You can cut down on all of that with the tool you already use. Let's start with the instruction file in your repository.
AGENTS.md and CLAUDE.md: a user's manual for your repository
Every agent session starts from scratch. The agent doesn't remember that this project runs tests with make test instead of pytest, that there's a specific command for generating migrations, or that it's best to leave legacy/ alone. Without that information, it starts poking around. It reads files, guesses at commands, runs the wrong ones, and tries again. Every one of those steps costs tokens and time.
That's where instruction files in your repository come in. AGENTS.md is an open format popularized by OpenAI, which handed it over in December 2025 to the Agentic AI Foundation under the Linux Foundation (Anthropic contributed the MCP protocol). Codex, OpenCode, and many other tools read it. CLAUDE.md is the Claude Code equivalent and works the same way. Claude Code can now also read AGENTS.md if there's no CLAUDE.md in the repo. Both files can live at the global level (your own preferences), the project root (team rules), or in subdirectories (rules for a particular module).
So what should go in them? Things the agent can't quickly pick up from the code. Build and test commands, conventions that break from the norm, gotchas specific to the project, and things you want it to leave alone.
Does this actually save anything? We have some early numbers. Lulla et al. (2026) ran Codex on 124 pull requests across 10 repositories, once with AGENTS.md and once without it. With the file, the agent's median runtime fell by about 28.6% and output token usage by about 16.6%, with comparable success rates.
But there's a big “but.” A team led by Gloaguen et al. (2026), including Martin Vechev from ETH Zurich, looked at the same question more broadly and tested several agents, including Claude Code and Codex. They found that context files generally didn't improve success rates and raised inference costs by more than 20%. Agents dutifully follow the instructions in these files, so every unnecessary requirement gives them more work. The most surprising finding was that general repository overviews (“the project has modules A, B, and C…”) don't help, even though they're popular and the model providers themselves recommend them. Files written by people fared better than ones generated by models. The authors recommend keeping them to the bare minimum and say they make the most sense for projects that do things in nonstandard ways.
The providers' practical advice is much the same. In the Claude Code docs, Anthropic recommends keeping CLAUDE.md under 200 lines. Longer files take up more context and Claude follows them less reliably. What actually gets loaded depends on where the files live and how you've set things up. CLAUDE.md files in the directories above where you start Claude Code are loaded at launch, files in subdirectories load only once Claude works there, and path-specific rules load only for matching files. If an instruction only applies to one part of the project, Anthropic suggests moving it into path-specific rules or skills. OpenAI's Codex docs explain that Codex combines AGENTS.md files from the project root down to your current directory and stops adding them once they reach a default combined limit of 32 KiB. They also recommend keeping detailed instructions as close as possible to the code they apply to.
My take? Write AGENTS.md or CLAUDE.md yourself, and keep it short and specific. Asking an agent to generate one in a single prompt and leaving it unread is an easy way to pay more for the same result.
Keep it short and specific. Every line has to earn its place.
What is a skill?
AGENTS.md and CLAUDE.md are for things the agent should always know. A skill supplements them with instructions that load only when they're needed.
A skill is a bundle of instructions that teaches the agent a particular way of working. At its simplest, it's a folder with one file, SKILL.md, with a name and a short description at the top and the instructions below in Markdown. That's enough to teach the agent something like your commit message conventions. More powerful skills bundle entire scripts and programs. The specification sets aside a scripts/ directory for them (usually Python, Bash, or JavaScript), alongside reference material and templates. For example, Anthropic's official PDF skill ships with its own scripts, and version 4 of caveman installs as a separate program with hooks. The agent can run the script instead of writing that code from scratch every time, and mostly just the output goes into its context.
WATCH OUT
There's a flip side. When you install a skill like that, you're running somebody else's code on your computer with the agent's permissions. Treat it like any other dependency and stick to official sources. The ponytail author says right in the README to get it only from his repository and that he never ships .exe or .dll files.
Anthropic introduced the format in Claude in October 2025 and released it as an open standard in December 2025. The specification is at agentskills.io. Dozens of tools can read skills today, including Claude Code, Codex, OpenCode, and Gemini CLI. Write a skill once and you can use it in a bunch of places.
The clever bit is how little the agent loads up front. The term for this is progressive disclosure. At the start of a session, the agent only sees each skill's name and description, a few dozen to a hundred tokens per skill. It loads the full instructions when it decides the skill fits the task, and only opens extra files when it actually needs them. It's a bit like a MoE router. You only reach for what you'll use.
One caveat in the interest of fairness. Skill descriptions still take up space in every session. Install fifty skills “just in case” and you can easily eat up your own savings.
Three skills that actually cut costs
I use all three tools daily. RTK cuts what the agent reads, caveman cuts what it says, and ponytail cuts how much code it writes.
RTK: less junk going in
RTK (Rust Token Killer) is a little Rust program that sits between the agent and the terminal. Technically it's a command-line tool with a hook that runs automatically before each agent command, though you install and use it much like a skill. When the agent wants to run git status, the hook quietly swaps it for rtk git status, and RTK sends back a shorter, grouped version of the output. It does the same for tests (only shows failures), logs (removes duplicates), file listings, and dozens of other commands.
The authors claim 60-90% fewer tokens on typical developer commands. My counter (rtk gain) currently shows more than 100,000 commands and about 912 million tokens saved, or almost 90% of what the agent would otherwise have had to read. The authors make two points about those numbers. First, the savings cover terminal output only, so they don't translate directly to your total bill. Second, the hook only catches shell commands. The agent's built-in file-reading tools bypass it.
caveman: less chatter coming out
caveman does something that sounds a little silly. It tells the agent to keep it short. No “Of course, happy to help!” No recap of what it just did. No three-paragraph introduction. Answer first, reasoning next, then the next step. Code, commands, paths, and error messages stay exactly as they are, down to the last character.
In one example from the docs, an answer that normally takes 63 tokens takes 20 in caveman mode and gives you the same fix. The latest version goes further and trims what the agent reads, too (logs, JSON, test results). The authors say that cuts input tokens by around 33% across a whole session.
Here's where it gets interesting. JetBrains tested the caveman approach on 86 real coding tasks and found no drop in quality, but with the skill forced on it only saved 8.5% on output tokens. Most tokens in agent work go toward code and tool calls, which caveman-style writing leaves alone. Adobe researchers also found that shortening your prompts in this style makes the responses worse, so caveman deliberately leaves those alone. I treat caveman as a nice extra that works best alongside RTK.
ponytail: less code
ponytail tackles the third place you lose tokens, the amount of code the agent writes. You'll see the difference in code review, too. The idea is simple. Everyone knows that experienced developer with a ponytail who looks at your 50 lines, says nothing, and replaces them with one. ponytail puts that developer inside the agent.
Before the agent writes anything, it works through a series of questions. Do we need to build this at all? Does something like it already exist in the repo? Can the standard library or browser handle it? Will a dependency we already have do the job? Only then does it write the minimum that works. In one example from the docs, asking for a date picker in a form gets you 335 lines of hand-written calendar code without the skill. With ponytail, you get 10 lines that use an existing component and the browser's native date input.
ponytail also draws a line at code golf, where the aim is to write the shortest possible program. Its instructions explicitly say to keep validation, error handling, security, and accessibility, and to keep a test for nontrivial logic. In their own benchmark (39 tasks, each run five times in Claude Code), the authors measured 53% less code, 45% fewer tokens, and a 26% lower cost. Those numbers come from the authors, so use them as a rough guide.
Where I'd start
If I were starting from scratch today, here's what I'd do.
IN PRACTICE
- Learning and personal projects. OpenCode with local Ollama or free models from NIM or OpenRouter. You'll spend next to nothing and learn a lot about how agents work and where they get things wrong.
- More serious personal projects. OpenCode Go at $10, with models that train on your data switched off.
- Company and client code. Stick to tools and plans your company has approved, with clear rules for how data is handled. In practice, that usually means Claude Code or Codex.
- Whatever you choose. A short AGENTS.md you wrote yourself in every repo, plus RTK, caveman, and ponytail from day one. They make every option cheaper to run.
Open the AGENTS.md or CLAUDE.md in your main repository and delete every line the agent could work out from the code on its own. If you're bringing agents into a large, long-lived codebase, read how we approach it in AI agents on mature codebases.
And if, after all that, the agent still gives you three paragraphs when you ask “did that test pass?”, you already know which skill to install first.
FAQ
Can I code with AI for free?
Yes, for learning and personal projects. You can run an open model locally with Ollama and connect it to a free agent such as OpenCode, or use free models from NVIDIA NIM or OpenRouter. The catches are hardware limits for local models, rate limits that depend on the service and the model (OpenRouter's free models, for example, are capped at 20 requests a minute), and providers that may train on your data.
Is it safe to use free AI models on company code?
Usually not without checking. A coding agent sends parts of your repository, configuration and sometimes .env files to the model. Some free endpoints are run by providers that can train on your data, and free access rarely comes with an SLA. For client code, stick to tools and plans your company has approved, with clear data-handling rules.
How much do Claude Code and Codex cost?
Claude Code is included in Claude Pro at $20/month. Codex has limited free access, with paid options starting at $8/month on ChatGPT Go. ChatGPT Plus costs $20/month. Higher tiers for both start at $100 a month. Usage is counted in five-hour and weekly windows, except Codex on Pro plans, which have no five-hour limit. Heavy agent work can use up a window's allowance in an hour or two.
Does an AGENTS.md or CLAUDE.md file reduce token costs?
Sometimes. One Codex study found lower token use, while a broader study found that context files increased inference costs on average. In the Codex study, AGENTS.md cut median runtime by about 28.6% and output tokens by about 16.6%. The broader study found costs rose by more than 20%, and generic repository overviews didn't help. Write the file yourself, keep it minimal, and focus on what the agent can't learn from the code.
Which skills help reduce token usage in coding agents?
Three tools target different sources of waste. RTK shortens terminal output before the agent reads it, caveman makes the agent's answers shorter, and ponytail makes it write less code. Independent tests can show smaller savings than the authors' figures. In its benchmark, JetBrains measured an 8.5% reduction in output tokens when caveman was forced on. Treat the authors' own numbers as a rough guide.
Sources
- Ollama. Pricing and privacy policy for cloud models.
- The Hacker News (January 2026). Researchers Find 175,000 Publicly Exposed Ollama AI Servers Across 130 Countries.
- OpenCode. OpenCode Go docs. Plans, limits and data retention.
- NVIDIA Developer Forums. Threads on free NIM API limits.
- OpenRouter. API limits and FAQ on prompt logging.
- Standard Compute. Plans and fair-use policy. Provider materials.
- Anthropic. Claude plan pricing.
- OpenAI. Codex pricing through ChatGPT plans.
- Agent Skills. Open specification.
- RTK (Rust Token Killer). GitHub repository.
- caveman. GitHub repository.
- JetBrains (July 2026). Testing the caveman approach on 86 tasks.
- Adobe Research (2026). CAVEWOMAN paper on compressing model responses.
- ponytail. GitHub repository.
- AGENTS.md. Format and list of tools that support it.
- OpenAI (December 2025). OpenAI co-founds the Agentic AI Foundation under the Linux Foundation.
- Anthropic. Claude Code docs for CLAUDE.md and AGENTS.md.
- OpenAI. Codex docs for AGENTS.md.
- Lulla et al. (2026). On the Impact of AGENTS.md Files on the Efficiency of AI Coding Agents.
- Gloaguen et al. (2026). Evaluating AGENTS.md: Are Repository-Level Context Files Helpful for Coding Agents?
Key takeaway

