Run Your OpenClaw and Claude Code for $20 a Month with Ollama Cloud

Run Your OpenClaw and Claude Code for $20 a Month with Ollama Cloud

If you want to run a coding agent like Claude Code or a personal AI assistant like OpenClaw against a frontier model, the economics are unfavorable. Agentic tools are not chat — they run loops, and every step of every loop resends the entire conversation. A single afternoon of autonomous work can put tens of millions of tokens through an API. At frontier output rates, that is not a casual expense.

The open-weights models have closed most of the capability gap for exactly this kind of work, and they are priced one to two orders of magnitude below the frontier. GLM-5.3 and Kimi K3 sit at the top of the open-weights leaderboards. If you want to see the current spread for yourself, OpenRouter’s model list publishes live per-token rates across hundreds of models and providers, and is the fastest way to sanity check any pricing claim — including the ones in this article.

Ollama Cloud is the best-value way to get at those models. $20 a month gets you every model they host, three concurrent requests, and $60 of usage credits refreshed monthly. The $20 is not the interesting part. The interesting part is that $60 of credits is either absurdly generous or gone by day six, and the difference is entirely down to how you configure things.

This is Part 1 of a three-part series: setup, pricing mechanics, and the two multipliers that drive your bill. Part 2 covers running OpenClaw on a budget. Part 3 covers every other tool and what to do when credits run out anyway.

All pricing and model availability below is as of September 2026. Ollama changes rates and retires models on a rolling schedule; verify against ollama.com/pricing before committing.

What $20 buys

PlanPriceIncluded creditsConcurrent requestsModel access
Free$0Starter credits1Starter models only
Pro$20/mo (or $200/yr)$60/mo3All cloud models
Max$100/mo$300/mo10All cloud models
Team$500/mo$1,000/mo shared10All cloud models

Four mechanics that are easy to get wrong:

  1. Credits refresh monthly and do not roll over. They reset on your subscription anniversary date, not the first of the month. Unspent credits are lost, not banked.
  2. Included credits are drawn first. Any plan, including Free, can add a separate credit balance. That balance is only touched after the included $60 is exhausted, which makes it a clean stopgap rather than a parallel budget.
  3. You get an email at 90% of included usage, toggleable in settings. Leave it on. It is the only automatic warning you will get, and as Part 2 explains, your agent framework almost certainly will not warn you.
  4. Requests over the concurrency limit are queued, then rejected once the queue fills. Three concurrent is easy to hit with an assistant, a scheduled job, and you typing.

Local models on your own hardware are unlimited and free — they never touch credits.

On privacy: Ollama does not log prompts or responses and does not train on them. Hosting is US-primary but may route to the EU or Singapore.

Setup

1. Install, sign in, verify

ollama signin
ollama run gemma4-cloud

signin links the local CLI to your ollama.com account. The -cloud suffix is the whole mechanism: it routes inference to Ollama’s infrastructure rather than your machine. ollama pull <model>-cloud registers a cloud model without opening a chat, which is what you want when another tool will consume it.

2. API key for direct access

Generate a key at ollama.com/settings/keys:

export OLLAMA_API_KEY="sk-..."

curl https://ollama.com/api/chat \
  -H "Authorization: Bearer $OLLAMA_API_KEY" \
  -d '{
    "model": "gemma4",
    "messages": [{"role": "user", "content": "ping"}],
    "stream": false,
    "options": { "num_ctx": 65536 }
  }'

Note the endpoint: /api/chat, Ollama’s native API. There is an OpenAI-compatible shim at /v1, and it is a common source of trouble with agentic tools — Part 2 covers a specific failure mode it causes in OpenClaw. Prefer the native path unless a tool explicitly requires otherwise.

3. Wire up your agent

ollama launch openclaw

ollama launch <app> installs the tool if missing, prompts for a model, and writes the configuration. It supports openclaw, claude, opencode, codex, hermes, pi, goose, cline, and others. Run ollama launch with no arguments to see the current list — it is the only reliably up-to-date source, since the roster grows monthly.

For Claude Code specifically, the manual path is worth knowing because it shows how the trick works:

export ANTHROPIC_AUTH_TOKEN=ollama
export ANTHROPIC_API_KEY=""
export ANTHROPIC_BASE_URL=http://localhost:11434
claude --model gemma4-cloud

Ollama serves an Anthropic-compatible API, so Claude Code believes it is talking to Anthropic.

BEWARE THIS GOTCHA:ANTHROPIC_API_KEY must be an empty string, not merely unset — a stale key in your shell profile gets picked up and sent to a server that does not want it.

Advertisement

4. Fix the context window before anything else

Ollama’s default num_ctx is 4096 tokens, and it truncates silently. No error, no warning. Your agent simply stops seeing the beginning of its own conversation.

This is the single most common footgun with Ollama-backed agents, and it presents as model stupidity: the agent forgets instructions from four turns ago, re-reads files it already read, loses the thread of a multi-step task, emits malformed tool calls. Every one of those is a truncation bug in costume.

Set 64k minimum for anything agentic. Three places to do it, depending on the tool:

MechanismWhereExample
options.num_ctxPer-request, native API"options": { "num_ctx": 65536 }
params.num_ctxProvider config fileOpenClaw, most config-driven harnesses
Provider UI fieldEditor extensions“Context Window Size (num_ctx)” in Kilo, Cline, Roo

You can also set it interactively to test:

ollama run gemma4-cloud
>>> /set parameter num_ctx 65536

If a harness also has its own input budget — OpenClaw’s contextTokens, for instance — keep the two aligned. A budget larger than num_ctx gets silently truncated by Ollama; a num_ctx much larger than the budget just reserves memory you never use.

Model pricing, as of September 2026

This is the subset worth caring about for agentic work — the current generation, cheapest first. A dash means no separate cached-input rate is published.

ModelInputCached inputOutputCache discount
nemotron-3-super$0.015$0.015$0.60none
gemma4$0.14$0.05$0.402.8x
deepseek-v4-flash$0.22$0.007$0.6631x
minimax-m2.7$0.30$0.06$1.205x
minimax-m3$0.60$0.12$2.405x
deepseek-v4-pro$0.66$0.022$1.9830x
glm-5.3$1.40$0.26$4.405.4x
kimi-k3$3.00$0.30$15.0010x

These rates are per 1M tokens.

Two structural facts drive everything downstream.

Output costs three to five times input. On kimi-k3 it is 5x; on gemma4 it is 2.9x. Anything that generates more tokens — verbose responses, and especially reasoning traces — is billed at the expensive rate.

Cached input is where the leverage is. deepseek-v4-flash caches at $0.007, 31x below its own input rate. In an agent loop, the replayed conversation prefix is exactly what the cache is for, so a model with a steep cache discount can be dramatically cheaper in practice than its headline input rate suggests.

Cost per session, not cost per token

The pricing table tells you what a token costs. This is the number you actually budget against.

The model: one long agent session of 1M cumulative input tokens (50% cache hits, which is realistic for a stable system prompt) and 100k output tokens. These are computed estimates from the rate table, not measurements from my account — use them to rank models against each other, not to forecast a bill.

ModelBucketEst. $/sessionSessions per $60Best for
nemotron-3-superWorkhorse$0.08~800Bulk edits, summarization, cron jobs, cheap fallback
gemma4Workhorse$0.14~440General coding, daily driver
deepseek-v4-flashCache-optimized$0.18 off-peak
$0.36 peak
~330 / ~170Very long sessions, scheduled batch work
minimax-m2.7Balanced coding$0.30~200Multi-file refactors
deepseek-v4-proCache-optimized$0.54 off-peak
$1.08 peak
~110 / ~56Long sessions needing more capability
minimax-m3Balanced coding$0.60~100Harder reasoning at moderate cost
glm-5.3Premium$1.27~47Architecture and design work
kimi-k3Premium$3.15~19Reserve for genuinely hard problems

Nineteen sessions versus eight hundred, for the same $60. That 40x spread is the entire article in one comparison.

Advertisement

The two multipliers

Model choice sets your baseline. These decide how fast you slide along it.

Reasoning tokens bill as output

Thinking tokens are output tokens, priced at the output rate. A high-reasoning run on kimi-k3 bills your model’s deliberation at $15 per million, and reasoning models are verbose by design — a hard problem can generate more thinking than answer.

The rule: reasoning effort should scale with problem difficulty, not with habit. Most agent turns are mechanical — read a file, run a command, apply an edit. Those do not need extended thinking. Reserve it for the turn where you genuinely do not know the answer. Part 2 covers the per-turn and per-model controls.

Agent loops replay the whole conversation

This is the one that surprises people, and it is the core of the cost model.

Every tool call sends the entire conversation back to the model. A ten-step autonomous run is not one request carrying your context — it is roughly ten requests, each carrying a progressively larger context. Total tokens grow with the square of the step count, not linearly.

Two consequences:

  • Cached-input pricing matters enormously, because that replayed prefix is precisely what the cache serves. deepseek-v4-flash at $0.22 input / $0.007 cached beats a cheaper model with no cache discount over any session long enough to matter.
  • Every token in your system prompt is billed on every step of every loop. A bloated instruction file is not a one-time cost; it is a tax on every tool call you will ever make. This makes context hygiene the highest-leverage optimization available, which is why Part 2 spends most of its length there.

The peak-pricing footnote

You may have heard Ollama has off-peak pricing. As of September 2026 it applies to DeepSeek only: deepseek-v4-flash and deepseek-v4-pro double between 12:00 and 18:00 UTC, Monday through Friday. Everything else is flat-rate around the clock.

Narrow, but useful — deepseek-v4-flash has the best cached-input rate on the platform. If you have batch work (nightly summarization, scheduled research, bulk refactors), pointing it at DeepSeek and scheduling outside that six-hour window is close to free.

# 03:00 UTC — comfortably outside the 12:00–18:00 peak window
0 3 * * * OLLAMA_MODEL=deepseek-v4-flash /usr/local/bin/nightly-digest.sh

Worked budget

Three substantial agent sessions a day, thirty days, using the estimates above:

Primary modelPer dayPer monthOutcome on $60
gemma4$0.41~$12Nowhere near the cap. Could triple usage.
minimax-m2.7$0.90~$27Comfortable, room to escalate on hard problems.
glm-5.3$3.81~$114Credits gone around day 16.
kimi-k3$9.45~$284Credits gone on day 6.

The lesson is not “always use the cheap model.” It is that a fallback chain — a cheap primary plus a premium model you escalate to deliberately — beats any single model choice. Running gemma4 daily and reaching for kimi-k3 on the two or three genuinely hard problems each month lands around $20 of credits. Running kimi-k3 for everything is $284.

That is the real answer to “can I run my agents for $20 a month?” Yes, comfortably — with model discipline. Without it, $20 buys you six days.

Where this goes next

  • Part 2 takes OpenClaw, the most token-hungry tool in the stack, through fallback chains, thinking control, and the context trimming that made the biggest difference to my burn rate.
  • Part 3 covers Claude Code, Kilo Code, Cline, Goose and the rest, plus a concrete plan for the month you hit 90% on day 14.

If you are juggling several providers rather than standardizing on one, the same cost logic applies at the gateway layer — see LiteLLM: A Unified Gateway for 100+ AI Language Models.

Advertisement
Kevin Duane

Kevin Duane

Site reliability engineer writing first-person about AI, engineering, and productivity — what actually works in daily practice.