reading time : 22 minutes

People often ask me how much my AI usage costs. I reply "20 bucks a month" and they stare 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 OpenCode’s SQLite database, the SQL code to query the tables, and an exhaustive comparison with all market providers — Western and Chinese. The result is so asymmetric that I had to double-check my calculations three times.

OCD

[]

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:

@startuml
skinparam backgroundColor #FEFEFE
skinparam defaultFontSize 12

title The Three Actors of My LLM Stack
left to right direction

actor "Me (Developer)" as Dev

package "OpenCode\n(github.com/anomalyco/opencode)" as OC {
  rectangle "Vibe coding CLI\nOpen source, free" as CLI
  note right of CLI
    C'est l'outil que j'utilise
    pour coder avec des agents IA.
    Il ne fournit AUCUN modèle.
    C'est un terminal + un orchestrateur.
  end note
}

package "Ollama (Local Installation)" as OL {
  rectangle "Inference client\nInstalled on my machine" as Client
  note right of Client
    C'est le logiciel qui fait tourner
    les modèles. Il peut les exécuter
    en local OU les déléguer au cloud
    selon le tag (:cloud).
    Il s'authentifie via clé SSH.
  end note
}

package "Ollama Cloud\n(ollama.com)" as OCloud {
  rectangle "Cloud inference service\nPro subscription: €20/month" as Cloud
  note right of Cloud
    C'est le fournisseur d'inférence.
    Mes modèles avec le tag :cloud
    sont exécutés sur LEURS serveurs.
    L'abonnement Pro donne accès
    à des quotas supérieurs.
  end note
}

Dev --> CLI : "I type prompts"
CLI --> Client : "Call this model"
Client --> Cloud : "SSH key + request\n(models: cloud)"
Client --> Client : "Local execution\n(models without :cloud)"

@enduml

OpenCode is NOT a model provider.It’s an open-source CLI (github.com/anomalyco/opencode) that orchestrates AI agents. It does not sell a subscription, it does not provide inference. It is the equivalent of`git`for versioning: a tool, not a service. Ollama Cloud is the inference provider.My local Ollama installation acts as client — it authenticates with the Ollama servers via a unique SSH key (Device Key) and delegates execution of tagged models to them.:cloud. The Pro subscription (20€/month) unlocks higher quotas and allows you to accumulate 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 the cloud models (those with the tag`:cloud`) via the provider`ollama-cloud`. A second subscription followed a month later, on a separate Docker instance with its own account and its own SSH key — the stacking method described in my article on stacking subscriptions.

The question that was bothering me: are these €20 per month justified? Not by guesswork. With numbers.

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 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:

@startuml
skinparam backgroundColor #FEFEFE
skinparam defaultFontSize 12

title Simplified Schema — OpenCode SQLite
entity "session" as S {
  * id : TEXT
  --
  * model : TEXT (JSON)
  * cost : REAL
  * tokens_input : INTEGER
  * tokens_output : INTEGER
  * tokens_reasoning : INTEGER
  * tokens_cache_read : INTEGER
  * tokens_cache_write : INTEGER
  * time_created : INTEGER
  * project_id : TEXT
}

entity "message" as M {
  * id : TEXT
  --
  * session_id : TEXT <<FK>>
  * data : TEXT (JSON)
  * time_created : INTEGER
}

entity "project" as P {
  * id : TEXT
  --
  * worktree : TEXT
  * name : TEXT
}

S ||--o{ M : "session_id"
S }o--|| P : "project_id"

note right of S
  La table session agrège
  tokens + coût + modèle.
  C'est notre point d'entrée
  principal.
end note

note right of M
  Les messages individuels.
  Le champ data contient
  le modèle utilisé (format JSON)
  même si la session change
  de modèle en cours de route.
end note

@enduml

The table`session`is perfect for a global audit: each session has its aggregated token count, its used model, and its cost. The field`model`is raw JSON :

{
  "id": "deepseek-v4-pro:cloud",
  "providerID": "ollama-cloud",
  "variant": "default"
}

The field`cost`The OpenCode database reflects only the external API fees paid per 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 flat-rate (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) which 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 flag`--experimental-sqlite`is required on Node.js 22.x. On Node.js 24+, the module is stable and no longer requires a flag.

The Results: 73 Days of Consumption

Global View

Metric Value Context

Sessions OpenCode

1 022

~14 sessions per day on average

</think>

2.62 billion

Of which 94.5M cache hit

Tokens Output

21 million

(Empty output)

Tokens Reasoning

141 000

negligible — almost no thinking

External API cost

$0.22

Out-of-subscription fees (Gemini + free tiers)

This figure of \$0,22 is crucial: it represents everything I paid in addition to my Ollama Cloud Pro subscription. In other words, virtually nothing. The subscription covers the essentials.

@startuml
skinparam backgroundColor #FEFEFE
skinparam defaultFontSize 12

title Monthly Trend — Input Tokens
rectangle "March 2026\n9 sessions\n37.7M tokens" as MARS #FFE082
rectangle "April 2026\n486 sessions\n1.33B tokens" as AVR #81C784
rectangle "May 2026\n527 sessions\n1.25B tokens" as MAI #64B5F6

MARS -right-> AVR : ×35
AVR -right-> MAI : stable (période en cours)

note bottom of MAI
  Mai comptabilisé jusqu'au 18.
  Projection mois complet : ~2,1 Md tokens
  si la tendance se maintient.
end note
@enduml

The takeoff between March and April is spectacular: ×35 in one month. It’s the transition from 'test' usage to 'production' usage — when I started running OpenCode agents continuously for my Gradle plugins.

Ventilation by Model and Supplier

The field`model`of the table`session`being JSON,`json_extract()`allows proper ventilation:

Model × Provider Sessions </think> 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: * ollama-cloud→ via paid Pro subscription (cloud managed by Ollama) * ollama-b→ second Pro subscription, isolated in a distinct Docker container * ollama→ native locale instance, free (runs directly on my machine) The sum of the three gives 936M input, 8.4M output — that’s my total consumption DeepSeek V4 Pro, all providers combined. Only`ollama-cloud`(220M input) costs a subscription. The remaining 716M are free (local or combined subscriptions).

Intra-Session Models: What the Session Table Does Not See

The table`session`only captures the session’s primary model. But during the same session, an OpenCode agent can switch between multiple models. The table`message`it reveals :

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, nor the other models. They appear in the history because I tested a lot of 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 (cf. my comparison Kimi/GLM/DeepSeek). The 32% of deepseek messages in the history are misleading: today it’s 100%.

Tariff Comparison — Western Suppliers

The thorny question: how much would this same consumption cost with traditional suppliers?

My calculation base for the comparison:220M tokens input + 1.9M tokens output— only the volume passed by`ollama-cloud`(the only one that matches my paid subscription). The remaining 716M are free (local Ollama and Docker B instance)

Supplier Model $/M Output \$/M Cost/month × my subscription

My setup

DeepSeek V4 Pro

0

0

\~20€

1×

Anthropic — Claude

Model $/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' model of Claude, costs 11× my subscription. And it knows nothing of my codebase, does not generate in my style, and hallucinates on the Gradle Kotlin DSL APIs.

OpenAI — GPT

Model \$/M Output $/M Cost/month × my subscription

GPT 5.5

\$5

\$30

\$1 157

58×

GPT 5.4

\$2,50

\$15

\$579

29 times

GPT 5.4 Mini

\$0,75

\$4,50

\$174

9×

Google — Gemini

Model $/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 lightweight dense model, not a 1.6T MoE like DeepSeek V4 Pro. The quality of the generated code is not comparable.

HuggingFace Inference Providers

HuggingFace does not perform inference itself — it aggregates third-party providers (Novita, Together, DeepInfra, Cerebras, SambaNova, Fireworks, Groq…) via a unified API. One chooses the cheapest or fastest provider. Here are the rates observed in May 2026 for DeepSeek V4 Pro:

Provider HF $ per thousand Output $/M Cost/month × my subscription

Novita (the cheapest)

\$1,67

\$3,38

$374

19×

DeepInfra

\$1,74

\$3,48

\$389

19×

Together

\$2,10

\$4,40

$470

23×

Fireworks

non-public rate

[No output]

—

—

Even the cheapest provider on HuggingFace (Novita) charges 19× the price of my subscription. And unlike Ollama Cloud, HuggingFace also charges in addition the platform fees if you don’t have a 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.

Tariff Comparison — Chinese Suppliers

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 $/M $/M Cost per month

Promo -75% (ends May 31)

\$0,435

\$0,87

$98

Full price (from June)

\$1,74

\$3,48

\$390

Even with DeepSeek’s aggressive promotion (extended -75%), the direct API costs5×more expensive. At the normal rate,20×. And it’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)

Only provider that aggregates all Chinese models — but via resale with margin. Prices are loaded dynamically in JavaScript, making scraping impossible.

Summary Table — All Providers

Supplier Model Input \$/M Sortie $/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×

@startuml
skinparam backgroundColor #FEFEFE
skinparam defaultFontSize 11

title Projected Monthly Cost — 220M Input + 1.9M Output
rectangle "Ollama Cloud Pro\n~20€" as OC #4CAF50
rectangle "Gemini Flash\n\$69" as GF #8BC34A
rectangle "DeepSeek promo\n$98" as DSP #FFC107
rectangle "GPT Mini\n$174" as GM #FF9800
rectangle "Claude Haiku\n$230" as CH #FF5722
rectangle "HF/Novita\n$374" as HF #F44336
rectangle "DeepSeek normal\n\$390" as DSN #F44336
rectangle "GPT 5.4\n\$579" as G4 #D32F2F
rectangle "Claude Sonnet\n$689" as CS #D32F2F
rectangle "Claude Opus\n$1,148" as CO #B71C1C
rectangle "GPT 5.5\n$1,157" as G5 #880E4F

note bottom of OC
  DeepSeek V4 Pro 1.6T MoE
  + accès à tout le catalogue
  Ollama Cloud (Qwen, GLM, Kimi...)
  Inclus dans l'abonnement
end note
@enduml

The Hidden Cost: Prompt Engineering and Iterations

The 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: the context is injected automatically

  • 90%+ first-shot correct: the code compiles on the first try

  • Zero hallucination DeepSeek over 8 consecutive sessions(documented in the Kimi/GLM/DeepSeek comparison)

With Claude or GPT without fine-tune nor governance :

  • 2-3 iterations per task on average

  • Systematic prompt engineering

  • Hallucinations on Kotlin/Gradle APIs as soon as the context exceeds 30K tokens

The monthly effective 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 about token price. A Claude Opus at 57× the price that requires 3× more iterations is an effective cost ~170× higher. To put it bluntly: paying an intern a McKinsey partner’s salary. _

Combine Ollama Cloud Pro Subscriptions: The Docker Method

If a single subscription isn’t enough, we stack them. The principle is to isolate each subscription in its own Ollama installation, with its own SSH authentication key. Docker makes it trivial.

The complete method is detailed in the article on Docker accumulation, here is the principle:

@startuml
skinparam backgroundColor #FEFEFE
skinparam defaultFontSize 12

title Architecture — Two Ollama Cloud Pro Subscriptions on One Machine
left to right direction

node "My Physical Machine" {
  frame "Ollama Instance A (native)\nport: 11434" as Native {
    database "Identity A\n/usr/share/ollama/.ollama/id_ed25519"
  }
  frame "Ollama Instance B (Docker)\nport: 11435" as Docker {
    database "Identity B\n~/ollama-b-data/id_ed25519"
  }
}

cloud "Ollama Cloud" {
  actor "Pro Account A\n(email 1)" as A
  actor "Pro Account B\n(email 2)" as B
}

Native --> A : "Device Key A"
Docker --> B : "Device Key B"

note bottom of Docker
  Conteneur Docker isolé :
  - Clé SSH distincte
  - Port réseau distinct (11435)
  - Volume persistant (~/ollama-b-data)
  - restart: always
end note
@enduml

The pattern is simple:

  1. Create a volume`~/ollama-b-data`

  2. Run a Docker container`ollama/ollama:0.20.2`mapped onto`11435:11434`

  3. Retrieve the SSH key from the container → save it on ollama.com

  4. Do`ollama signin`with a second email

  5. Configure OpenCode with two providers (`ollama`on :11434,`ollama-b`on :11435)

Two accounts, one blue card, zero conflict.

What the Audit Does Not Measure

Blind spot Impact

Quality of the produced code

2.6 billion tokens do not say whether the code compiles. My 8 DeepSeek V4 Pro sessions have a first-shot rate >90%.

OpenCode ecosystem

CLI is free, but its value (agents, sandboxes, history, prompt caching) is immense. It is not included in the subscription price — it is a separate tool.

Opportunity cost

Spending 2 hours a day debugging hallucinations of an inferior model costs more than €20/month.

Peace of mind

Flat rate = no surprise. With per‑token pricing, an activity spike can really hurt.

The quoted prices are those of May 2026. In six months, everything will have decreased. But the structural balance of power — fixed subscription vs pay‑per‑use — will remain favorable to subscription for heavy consumers.

Conclusion: The Verdict of Numbers

After 73 days, 1,022 OpenCode sessions, and 2.6 billion tokens:

Metric Verdict

Cumulative external API cost

\$0.22(almost null)

Ollama Cloud Pro subscription cost

~20€/month

Equivalent Claude Opus

$1,148/month— 57× more expensive

Equivalent GPT 5.5

\$1 157/month— 58× more expensive

Equivalent HuggingFace/Novita

$374/month— 19× more expensive

Direct DeepSeek API equivalent

$390/month— 20× more expensive

Cheapest equivalent (Gemini Flash)

$69/month— 3.5× more expensive, lower model

Best offer on the market

Ollama Cloud Pro at 20€/month— unbeatable

__ At €20 per month to access DeepSeek V4 Pro (1.6T params, MoE, CSA+HCA, 1M context) via Ollama Cloud, I have the best value for money on the global market. Even Chinese providers directly are 5× to 20× more expensive. Even HuggingFace, with its aggregation of low-cost providers, is 19× more expensive. The Western market (Claude, GPT) is at 50-60× — another planet.

This ratio is so imbalanced that it cannot last forever. Enjoy it while it exists. __

Well yes, my 20 bucks a month is the best technical investment of my life as a developer. And now you have the numbers to prove it.


Related articles