Auditing my LLM Consumption: SQLite, OpenCode, Ollama Cloud, and Why My Pro Subscription Blows the Global Market Away
Published on 18 May 2026
- Understanding the Stack: Who Does What?
- Introduction: Why an Audit?
- The OpenCode Database: A Gold Mine
- The Results: 73 Days of Consumption
- Pricing Comparison — Western Providers
- Pricing Comparison — Chinese Providers
- Summary Table — All Providers
- The Hidden Cost: Prompt Engineering and Iterations
- Combining Ollama Cloud Pro Subscriptions: The Docker Method
- What the Audit Doesn’t Measure
- Conclusion: The Verdict of the Numbers
- References
I’m often asked how much my AI consumption costs. I answer "20 bucks a month" and people look at me with wide eyes. So today, I’m opening the black box for you. This article is the full audit of my 73 days of vibe coding: the methodology for extracting data from the OpenCode SQLite database, the SQL code to query the tables, and the exhaustive comparison with all market providers — Western and Chinese. The result is so asymmetrical that I had to check my calculations three times.
- toc
-
[]
Understanding the Stack: Who Does What?
Before diving into the numbers, let’s clarify the architecture. There are three distinct actors in my setup, and it’s important not to confuse them:
|
OpenCode is NOT a model provider.It is an open-source CLI (github.com/anomalyco/opencode) that orchestrates AI agents. It doesn’t sell subscriptions; it doesn’t provide inference. It’s the equivalent of`git`for versioning: a tool, not a service. Ollama Cloud is the inference provider.My local Ollama installation acts as a client — it authenticates with Ollama servers via a unique SSH key (Device Key) and delegates the execution of models tagged`:cloud`to them. The Pro subscription (€20/month) unlocks higher quotas and allows combining multiple accounts on the same machine via Docker. |
Introduction: Why an Audit?
Two months ago, I was using models for free on my local Ollama installation. Then I subscribed to a first Ollama Cloud Pro subscription at €20/month, which allows me to use cloud models (those with the`:cloud`tag) via the`ollama-cloud`provider. A second subscription followed a month later, on a separate Docker instance with its own account and its own SSH key — the combining method described in my article on combining subscriptions.
The question that haunted me: are these €20 per month justified? Not by guesswork. With figures.
To answer, I needed precise data. Not estimates. Not averages. My actual consumption, token by token, model by model, session by session.
And OpenCode — the CLI — stores all of that in a SQLite database.
The OpenCode Database: A Gold Mine
OpenCode persists the entire history of its sessions in a SQLite file located at`~/.local/share/opencode/opencode.db`. La mienne pèse 660 Mo pour 73 jours d’utilisation — une base de données de production tout à fait respectable.
$ ls -lh ~/.local/share/opencode/opencode.db
-rw-r--r-- 1 cheroliv cheroliv 660M mai 18 12:25 opencode.db
The Schema
The database contains about twenty tables, but three of them are crucial for our audit:
The`session`table is perfect for a global audit: each session has its aggregated token count, its used model, and its cost. The`model`field is raw JSON:
{
"id": "deepseek-v4-pro:cloud",
"providerID": "ollama-cloud",
"variant": "default"
}
|
The`cost`field in the OpenCode database only reflects external API fees paid on consumption via API key (Google Gemini, OpenAI, etc.). Calls via Ollama — whether local or via Ollama Cloud Pro — are marked`cost=0`because the cost is a flat fee (subscription), not per-token. The real cost of these calls is the monthly subscription. |
The Extraction Code
No need to install anything. Node.js 22+ includes an experimental SQLite module (node:sqlite) that works perfectly. Here is the script that gave me everything:
const { DatabaseSync } = require('node:sqlite');
const db = new DatabaseSync(
`${process.env.HOME}/.local/share/opencode/opencode.db`,
{ readonly: true }
);
// 1. Statistiques globales
const global = db.prepare(`
SELECT
COUNT(*) as sessions,
SUM(tokens_input) as total_input,
SUM(tokens_output) as total_output,
SUM(tokens_reasoning) as total_reasoning,
SUM(tokens_cache_read) as total_cache_read,
SUM(cost) as total_cost
FROM session
`).get();
// 2. Ventilation par modèle et fournisseur
const byModel = db.prepare(`
SELECT
json_extract(model, '$.id') as model_id,
json_extract(model, '$.providerID') as provider,
COUNT(*) as sessions,
SUM(tokens_input) as total_input,
SUM(tokens_output) as total_output,
SUM(cost) as total_cost
FROM session
WHERE model IS NOT NULL
GROUP BY model_id, provider
ORDER BY SUM(tokens_input) DESC
`).all();
// 3. Par mois
const monthly = db.prepare(`
SELECT
strftime('%Y-%m', datetime(time_created/1000, 'unixepoch')) as month,
COUNT(*) as sessions,
SUM(tokens_input) as total_input,
SUM(tokens_output) as total_output,
SUM(cost) as total_cost
FROM session
WHERE time_created IS NOT NULL
GROUP BY month
ORDER BY month
`).all();
// 4. Messages par modèle (détection des changements intra-session)
const msgByModel = db.prepare(`
SELECT
json_extract(m.data, '$.model.providerID') as provider,
json_extract(m.data, '$.model.modelID') as model_id,
COUNT(*) as messages
FROM message m
WHERE json_extract(m.data, '$.model') IS NOT NULL
GROUP BY provider, model_id
ORDER BY COUNT(*) DESC
`).all();
console.log({ global, byModel, monthly, msgByModel });
db.close();
|
The`--experimental-sqlite`flag is required on Node.js 22.x. On Node.js 24+, the module is stable and no longer requires the flag. |
The Results: 73 Days of Consumption
Global View
| Metric | Value | Context |
|---|---|---|
OpenCode Sessions |
1 022 |
~14 sessions/day on average |
Input Tokens |
2.62 billion |
Including 94.5M in cache hits |
Output Tokens |
21 million |
Input/output ratio ~125:1 |
Reasoning Tokens |
141 000 |
Negligible — almost no thinking |
External API Cost |
\$0.22 |
Non-subscription fees (Gemini + free tiers) |
This figure of \$0.22 is crucial: it represents everything I paid on top of my Ollama Cloud Pro subscription. Which is to say, almost nothing. The subscription covers the essentials.
The takeoff between March and April is spectacular: ×35 in one month. This is the transition from "test" usage to "production" usage — when I started running OpenCode agents continuously for my Gradle plugins.
Breakdown by Model and Provider
Since the`model`field of the`session`table is JSON,`json_extract()`allows for a clean breakdown:
| Model × Provider | Sessions | Input | Output | Cost |
|---|---|---|---|---|
deepseek-v4-pro @ ollama-cloud |
63 |
220 M |
1,94 M |
\$0 |
deepseek-v4-pro @ ollama-b |
124 |
463 M |
4,15 M |
\$0 |
deepseek-v4-pro @ ollama |
100 |
252 M |
2,25 M |
\$0 |
deepseek-v4-flash-free @ opencode |
16 |
1,3 M |
279 K |
\$0 |
qwen3.6-plus-free @ opencode |
1 |
369 K |
25 K |
\$0 |
gemini-2.5-flash @ google |
1 |
211 K |
19 K |
\$0,04 |
|
Three different providers for exactly the same DeepSeek V4 Pro model:
* |
Intra-Session Models: What the Session Table Doesn’t See
The`session`table only captures the primary model of the session. But during a single session, an OpenCode agent can switch between several models. The`message`table reveals it:
Modèles utilisés dans les messages (ollama-cloud provider) :
├─ deepseek-v4-pro 1 441 msgs (32%)
├─ qwen3.5:397b 1 217 msgs (27%)
├─ glm-5.1 712 msgs (16%)
├─ kimi-k2.6:cloud 634 msgs (14%)
├─ qwen3-coder:480b 414 msgs (9%)
├─ gpt-oss:20b 34 msgs (0,8%)
├─ qwen3-coder-next 27 msgs (0,6%)
└─ gemma4:31b 7 msgs (0,2%)
|
I no longer use Qwen, GLM, Kimi, or other models. They appear in the history because I tested quite a few things in April. Since mid-May, I’ve been locked onto DeepSeek V4 Pro — it’s the only one that handles the load on long context with agent governance (see my Kimi/GLM/DeepSeek comparison). The 32% of deepseek messages in the history are misleading: today it’s 100%. |
Pricing Comparison — Western Providers
The awkward question: how much would this same consumption cost with traditional providers?
My calculation base for the comparison:220M input tokens + 1.9M output tokens— only the volume passed through`ollama-cloud`(the only one corresponding to my paid subscription). The remaining 716M are free (local Ollama and Docker instance B).
| Provider | Model | Input \$/M | Output \$/M | Cost/month | × my subscription |
|---|---|---|---|---|---|
My setup |
DeepSeek V4 Pro |
0 |
0 |
\~20€ |
1× |
Anthropic — Claude
| Model | Input \$/M | Output \$/M | Cost/month | × my subscription |
|---|---|---|---|---|
Opus 4.7 |
\$5 |
\$25 |
\$1 148 |
57× |
Sonnet 4.6 |
\$3 |
\$15 |
\$689 |
34× |
Haiku 4.5 |
\$1 |
\$5 |
\$230 |
11× |
Even Haiku 4.5, the most "economical" Claude model, costs 11× my subscription. And it knows nothing of my codebase, doesn’t generate in my style, and hallucinates on Gradle Kotlin DSL APIs.
OpenAI — GPT
| Model | Input \$/M | Output \$/M | Cost/month | × my subscription |
|---|---|---|---|---|
GPT 5.5 |
\$5 |
\$30 |
\$1 157 |
58× |
GPT 5.4 |
\$2,50 |
\$15 |
\$579 |
29× |
GPT 5.4 Mini |
\$0,75 |
\$4,50 |
\$174 |
9× |
Google — Gemini
| Model | Input \$/M | Output \$/M | Cost/month | × my subscription |
|---|---|---|---|---|
Gemini 3.1 Pro |
\$2,00 |
\$10 |
\$459 |
23× |
Gemini 3 Flash |
\$0,30 |
\$1,50 |
\$69 |
3,5× |
Gemini 3 Flash at €69 is the only "close" competitor in pure price — but it’s a light dense model, not a 1.6T MoE like DeepSeek V4 Pro. The quality of generated code is not comparable.
HuggingFace Inference Providers
HuggingFace doesn’t perform inference itself — it aggregates third-party providers (Novita, Together, DeepInfra, Cerebras, SambaNova, Fireworks, Groq…) via a unified API. You choose the cheapest or fastest provider. Here are the rates found in May 2026 for DeepSeek V4 Pro:
| HF Provider | Input \$/M | Output \$/M | Cost/month | × my subscription |
|---|---|---|---|---|
Novita (cheapest) |
\$1,67 |
\$3,38 |
\$374 |
19× |
DeepInfra |
\$1,74 |
\$3,48 |
\$389 |
19× |
Together |
\$2,10 |
\$4,40 |
\$470 |
23× |
Fireworks |
non-public pricing |
— |
— |
— |
Even the cheapest provider on HuggingFace (Novita) charges 19× the price of my subscription. And unlike Ollama Cloud, HuggingFace charges additional platform fees if you don’t have an HF PRO subscription (\$9/month).
Groq
Groq has none of the models I use — their catalog is limited to GPT-OSS, Llama, and Qwen 32B. Impossible to compare.
Pricing Comparison — Chinese Providers
The real test is the Chinese market. If DeepSeek is a Chinese model, its native API should be cheaper, right?
DeepSeek API Direct (platform.deepseek.com)
| Period | Input \$/M | Output \$/M | Cost/month |
|---|---|---|---|
-75% Promo (ends May 31) |
\$0,435 |
\$0,87 |
\$98 |
Full price (starting June) |
\$1,74 |
\$3,48 |
\$390 |
Even with DeepSeek’s aggressive promo (-75% extended), the direct API costs5×more. At the normal rate,20×. And that’s only DeepSeek — no access to other models.
Kimi Moonshot (platform.kimi.com)
Kimi only offers its own models. No DeepSeek.
Alibaba Bailian (bailian.aliyun.com)
The only provider aggregating all Chinese models — but via resale with a margin. Prices are loaded dynamically in JavaScript, making scraping impossible.
Summary Table — All Providers
| Provider | Model | Input \$/M | Output \$/M | Cost/month | × my subscription |
|---|---|---|---|---|---|
Ollama Cloud Pro |
DeepSeek V4 Pro |
0 |
0 |
~€20 |
1× |
Gemini 3 Flash |
Gemini 3 Flash |
\$0,30 |
\$1,50 |
\$69 |
3,5× |
DeepSeek API (promo) |
DeepSeek V4 Pro |
\$0,44 |
\$0,87 |
\$98 |
5× |
GPT 5.4 Mini |
GPT 5.4 Mini |
\$0,75 |
\$4,50 |
\$174 |
9× |
Claude Haiku 4.5 |
Claude Haiku 4.5 |
\$1 |
\$5 |
\$230 |
11× |
HuggingFace/Novita |
DeepSeek V4 Pro |
\$1,67 |
\$3,38 |
\$374 |
19× |
DeepSeek API (normal) |
DeepSeek V4 Pro |
\$1,74 |
\$3,48 |
\$390 |
20× |
Together AI |
DeepSeek V4 Pro |
\$2,10 |
\$4,40 |
\$470 |
23× |
GPT 5.4 |
GPT 5.4 |
\$2,50 |
\$15 |
\$579 |
29× |
Claude Sonnet 4.6 |
Claude Sonnet 4.6 |
\$3 |
\$15 |
\$689 |
34× |
Claude Opus 4.7 |
Claude Opus 4.7 |
\$5 |
\$25 |
\$1 148 |
57× |
GPT 5.5 |
GPT 5.5 |
\$5 |
\$30 |
\$1 157 |
58× |
The Hidden Cost: Prompt Engineering and Iterations
Token cost is only part of the equation. The real cost is developer time.
With OpenCode + Ollama Cloud Pro + my agent governance (EAGER/LAZY/Hot/Warm/Cold, described in the article on governance), I get:
-
0 repetitive prompt engineering: context is injected automatically
-
90%+ first-shot correct: code compiles the first time
-
Zero deepseek hallucinations over 8 consecutive sessions(documented in the Kimi/GLM/DeepSeek comparison)
With Claude or GPT without fine-tuning or governance:
-
2-3 iterations per task on average
-
Systematic prompt engineering
-
Hallucinations on Kotlin/Gradle APIs as soon as context exceeds 30K tokens
The "effective" monthly cost — tokens × iterations × correction time — is 27× to 54× that of my solution, as I demonstrated in the article on the efficiency ratio.
_ It’s not just a story of price per token. A Claude Opus at 57× the price requiring 3× more iterations is an effective cost ~170× higher. To put it bluntly: paying an intern a McKinsey partner’s salary. _
Combining Ollama Cloud Pro Subscriptions: The Docker Method
If a single subscription isn’t enough, you combine them. The principle is to isolate each subscription in its own Ollama installation, with its own SSH authentication key. Docker makes this trivial.
The complete method is detailed in the Docker combining article, here is the principle:
The pattern is simple:
-
Create a volume`~/ollama-b-data`
-
Launch a Docker container`ollama/ollama:0.20.2`mapped to`11435:11434`
-
Retrieve the container’s SSH key → register it on ollama.com
-
Do`ollama signin`with a second email
-
Configure OpenCode with two providers (`ollama`on :11434,`ollama-b`on :11435)
Two accounts, one credit card, zero conflicts.
What the Audit Doesn’t Measure
| Blind spot | Impact |
|---|---|
Quality of produced code |
2.6 billion tokens don’t say if the code compiles. My 8 DeepSeek V4 Pro sessions have a first-shot rate >90%. |
OpenCode Ecosystem |
The CLI is free, but its value (agents, sandboxes, history, prompt caching) is immense. It’s not included in the subscription price — it’s a separate tool. |
Opportunity cost |
Spending 2h/day debugging hallucinations from an inferior model costs more than €20/month. |
Peace of mind |
Fixed flat rate = no surprises. With per-token, an activity spike can hurt badly. |
|
The prices cited are those of May 2026. In six months, everything will have dropped. But the structural power balance — fixed subscription vs. pay-as-you-go — will remain favorable to the subscription for heavy consumers. |
Conclusion: The Verdict of the Numbers
After 73 days, 1,022 OpenCode sessions, and 2.6 billion tokens:
| Metric | Verdict |
|---|---|
Cumulative external API cost |
\$0.22(nearly zero) |
Ollama Cloud Pro subscription cost |
~€20/month |
Claude Opus equivalent |
\$1,148/month— 57× more expensive |
GPT 5.5 equivalent |
\$1,157/month— 58× more expensive |
HuggingFace/Novita equivalent |
\$374/month— 19× more expensive |
DeepSeek direct API equivalent |
\$390/month— 20× more expensive |
Cheapest equivalent (Gemini Flash) |
\$69/month— 3.5× more expensive, inferior model |
Best market offer |
Ollama Cloud Pro at €20/month— unbeatable |
__ At €20 per month for access to DeepSeek V4 Pro (1.6T params, MoE, CSA+HCA, 1M context) via Ollama Cloud, I have the best quality/price ratio on the global market. Even direct Chinese providers are 5× to 20× more expensive. Even HuggingFace, with its low-cost provider aggregation, is 19× more expensive. The Western market (Claude, GPT) is at 50-60× — another planet.
This ratio is so unbalanced that it cannot last forever. Take advantage of it while it exists. __
So yes, my 20 bucks a month is the best technical investment of my developer life. And now you have the numbers to prove it.