Mi setup de agente barato: OpenCode + DeepSeek por céntimos (feat. IgnicionDev)

Mi setup de agente barato: OpenCode + DeepSeek por céntimos (feat. IgnicionDev)

●1 ●8 ●17
calendar_today • schedule14 min read
<!-- CoderLegion · Article · Post 00 Serie: My cheap Setup feat IgnicionDev Autor: Ignacio Badenes (@yosoyignicion / IgnicionDev) Idioma: bilingüe ES + EN · Read time: ~8 min Tags: ai, aiagents, devtools, mcp · Extra: linux, opensource -->

Mi setup de agente barato: OpenCode + DeepSeek por céntimos (feat. IgnicionDev)

Serie: My cheap Setup feat IgnicionDev — Post 00
Read time: ~8 min · Etiquetas: ai aiagents devtools mcp


Abrí un agente que cuesta céntimos y me devolvió control, no ruido

La mayoría de la conversación sobre agentes de código empieza por la potencia: el modelo más grande, el benchmark más alto, la demo más vistosa. Mi problema era el contrario. Yo no necesitaba más inteligencia: necesitaba algo que costara céntimos, que no inundara la terminal y cuyo resultado pudiera auditar línea a línea. Si no puedo leer y ejecutar lo que el agente produce, no me sirve: trabajo con dinero, facturas y datos que deben cuadrar.

Así que me monté un agente barato —OpenCode + DeepSeek Flash— y lo rodeé de disciplina: memoria persistente, reglas de gasto de tokens, permisos estrictos y verificaciones reales. Este post es el "cómo", con números, y termina con diez cosas concretas que puedes hacer hoy con un setup así. No es magia; es ingeniería honesta.


Quién escribe esto

Soy Ignacio Badenes (IgnicionDev), técnico de sistemas e informática aplicada desde Castellón, España. Vengo del soporte y del control de accesos: protocolos, registros, sangre fría cuando algo falla. Ese hábito lo aplico ahora al software que construyo y publico —Aethernet (auditoría WiFi local, 146 tests), LocalGrant-Finder (subvenciones del BOE con búsqueda híbrida), SystemBridge-AI (facturas a libro contable, dinero en Decimal) y AssetShrink (C++17, imágenes en local)—. Todos con tests, CI y licencia. Si una herramienta no es auditable, no la publico. Con mi agente, igual.


La tesis: la disciplina sustituye a la potencia

Un modelo barato no te obliga a obtener resultados baratos. Te obliga a dejar de improvisar. El truco no está en el modelo: está en gastar pocos tokens sin perder precisión. En DeepSeek Flash el precio se reparte así:

coste = input_fresco × $0,14/M  +  input_cacheado × $0,0028/M  +  output × $0,28/M

El input cacheado cuesta 50 veces menos que el fresco, y el output es la partida más cara. Por eso ataqué los tres frentes:

  1. System prompt y herramientas mínimas (menos tokens fijos por petición).
  2. Máximo reúso de caché (mismo prefijo, sin UUIDs aleatorios que la rompen).
  3. Output controlado (respuestas cortas o JSON, nada de párrafos de relleno).

En mi escenario de trabajo, esto reduce el gasto ~82 %; una vez la caché está caliente, el coste marginal por petición cae a una fracción de céntimo. No es "gratis", pero se acerca. Y lo importante: sigue siendo correcto porque yo pongo la disciplina donde el modelo no llega.


El setup: OpenCode + DeepSeek

Mi modelo es deepseek/deepseek-v4-flash, servido por un proveedor compatible con OpenAI y con la caché activada:

{
  "model": "deepseek/deepseek-v4-flash",
  "provider": {
    "deepseek": {
      "npm": "@ai-sdk/openai-compatible",
      "options": { "setCacheKey": true },
      "models": {
        "deepseek-v4-flash": {
          "reasoning": true,
          "interleaved": { "field": "reasoning_content" }
        }
      }
    }
  }
}

Tres decisiones que marcan la diferencia a lo largo del día:

  • Compactación automática (auto, prune, reserved: 5000): la conversación se poda sola y no arrastro historial gigante.
  • Límite de salida de herramientas (max_lines: 200, max_bytes: 8192): un npm install no me escupe 200 líneas a la cara; si trunca, reejecuto acotado.
  • Permisos estrictos (webfetch: deny, plan en solo lectura): el agente no navega ni escribe donde no debe sin que yo lo apruebe.

Sobre todo esto manda un archivo: mi AGENTS.md. No es una lista de deseos, es un router de trabajo con protocolo (entender → planear → cambio pequeño → verificar → revisar), una Definition of Done honesta (typecheck, tests, lint, diff revisado) y reglas de gasto. El modelo es barato; el criterio no.


Memoria y contexto: que no repita lo que ya sabe

Un agente sin memoria es un becario con amnesia: cada sesión empieza de cero y vuelve a pagar por lo mismo. Yo uso el plugin engram + zerotoken: memoria tipada en SQLite con FTS5, auto-guardado de errores→solución, decisiones de arquitectura y compactaciones, e inyección de solo 2 memorias / 600 tokens en cada arranque. Traducido: en vez de arrastrar 50 000 tokens de historial, inyecto lo justo.

A eso le sumo Context7: cuando pregunto por una API o versión concreta, trae la documentación real y la cacheo como memoria. La próxima vez no vuelvo a consultarla ni el modelo la alucina. Documentación viva, cero repetición.


My.OpenCode.Conf: el proyecto privado que da forma a todo

Aquí está la pieza que mucha gente no ve. Mi configuración no es un opencode.json suelto: es un proyecto de GitHub privado llamado My.OpenCode.Conf, parte de mi aprendizaje y mi forma de trabajar. Es un bundle de tres subproyectos independientes que se hablan por un protocolo abierto (MCP):

Subproyecto Qué aporta Hecho con
skill-matrix +240 skills en formato SKILL.md (técnicas y de diseño) que el agente carga bajo demanda por triggers Markdown
second-termux-v2 Servidor MCP que lanza jobs en background y devuelve una sola línea de estado en vez de inundar la TUI TypeScript (ESM)
engram+zerotoken El plugin de memoria persistente (FTS5) y la política de ahorro de tokens TypeScript (Bun)

Los une un prompt maestro: en vez de mantener un install.sh frágil, el propio agente se autoconfigura (detecta el sistema operativo y adapta los comandos). Y, para mí, lo mejor de su diseño: es reversible. Se desinstala limpio, sin lock-in, sin telemetría y sin tocar lo que ya tenías. El repo es privado por ahora —lo enseño, lo explico y respondo dudas—, pero la lección es pública: una buena config es código que se puede leer, verificar y deshacer.


Las herramientas que lo conectan (MCP y plugins)

  • chrome-devtools (headless) — un navegador real que el agente maneja: navegar, extraer, y hacer auditorías Lighthouse sin abrir una ventana.
  • github — issues, PRs y acciones desde la propia conversación.
  • sqlite — consultas sobre mi base de datos local de trabajo.
  • context7 — documentación de librerías en vivo.
  • human-followup.ts — plugin propio que usa notify-send: cuando el agente pide datos, necesita un permiso o termina una navegación, me salta una notificación de escritorio. Puedo dejar de mirar la terminal.
  • Subagentes (explore, general) — para repartir exploración y trabajo pesado sin contaminar mi contexto.

Crear tu propio MCP para publicar sin salir del agente

El ejemplo más honesto de "herramienta propia" es este mismo post. En vez de copiar y pegar texto en el navegador, escribí un MCP local para Coder Legion en Node ESM sin dependencias (~300 líneas): una conversación JSON-RPC por stdio contra la API REST de la plataforma. El agente lista, busca, comenta y redacta en borrador desde la misma sesión en la que programa.

Lo interesante no es el camino feliz, son los bordes:

  • La API no tiene campo draft. El borrador se implementa con POST /posts seguido de POST /posts/{id}/hide: el post nace invisible salvo para el autor y los mods. Publicar es POST /posts/{id}/reshow.
  • El MCP nunca publica solo. cl_create_post valida y crea siempre oculto; si el hide falla, devuelve el id y avisa de que el post quedó público para corregirlo de inmediato. La publicación real solo ocurre con cl_publish_post, y esa llamada la decido yo.
  • Edición incremental. cl_edit_post hace read-modify-write en servidor: append, prepend, insert_before, insert_after o replace sobre un ancla literal. Añado una sección sin reenviar 19 KB de markdown, con dry_run para previsualizar antes de guardar.

Es el patrón que repito en todo: la API hace lo mínimo, el MCP añade la disciplina (draft-first, revisión humana) y el agente se queda con lo mecánico. Si algo no lo puedo auditar o deshacer, no lo automatizo.


De la TUI al Desktop en Linux (ya migrado)

Hasta hace poco corría todo en la TUI (v1.18.34). Acabo de dar el salto a la versión Desktop en Linux Mint 22.3, instalando el .deb de la release oficial. En Linux no hay cask de Homebrew —eso es solo macOS—; lo correcto aquí son los paquetes de la release (.deb, .rpm o .AppImage). El binario de escritorio registra su lanzador en el menú de aplicaciones, así que paso de "abrir una terminal y teclear" a "abrir una app". Misma configuración, misma memoria, mismo agente; solo cambia el envoltorio. Si tienes dudas con la instalación en Linux, te lo cuento con detalle en los comentarios.


Diez cosas que mi agente barato hace hoy

Ejemplos reales, no humo:

  1. Diagnosticar un repo: señalarlo, que reproduzca, minimice y proponga un plan de fallos con la skill diagnose.
  2. Escribir tests primero: ciclo red-green-refactor con tdd, no tests de relleno.
  3. Revisar un diff: auditoría en paralelo de estándares y de especificación con review.
  4. Auditoría web real: levantar el navegador headless y ejecutar un Lighthouse sobre mi página.
  5. Consultar docs actualizadas con Context7 y guardarlas en Engram para no repetir la consulta.
  6. Recordar un fix entre sesiones: "esto ya me falló", y el error→solución está ahí.
  7. Lanzar un build largo en background y recibir una sola línea de estado (done) en vez de 200 líneas.
  8. Refactorizar con plan: request-refactor-plan descompone en commits pequeños y seguros.
  9. Crear una skill propia con write-a-skill cuando repito un patrón.
  10. Delegar exploración de un codebase desconocido a un subagente mientras sigo trabajando.

Lo honesto: qué gano y qué pierdo

Gano: coste de céntimos, memoria que persiste, permisos que respeto, cero telemetría y la tranquilidad de un sistema que puedo auditar y deshacer. Pierdo: techo de razonamiento —un modelo Flash no es un modelo de frontera— y comodidad. Un agente barato no piensa por ti; te obliga a decirle exactamente qué quieres y a verificar el resultado. Para mí, ese intercambio es una ventaja: es la diferencia entre "confío porque lo leí" y "confío porque me lo dijo un modelo caro".


Takeaway

No necesitas el modelo más potente para producir software serio: necesitas economía de tokens, memoria y disciplina. Con un modelo barato bien dirigido, el límite deja de ser el precio y pasa a ser tu criterio.

¿Y tú? ¿Qué modelo barato usas —o usarías— y cómo compensas sus límites? Cuéntamelo en los comentarios; leo y respondo a todo.


English version below · The original is in Spanish. If you're an English speaker, jump to the translation and let me know your setup in the discussion. I reply to everyone.



My cheap Setup: running OpenCode + DeepSeek for cents (feat. IgnicionDev)

Series: My cheap Setup feat IgnicionDev — Post 00
Read time: ~8 min · Tags: ai aiagents devtools mcp


I built an agent that costs cents and gave me control back, not noise

Most talk about coding agents starts with raw power: the biggest model, the highest benchmark, the flashiest demo. My problem was the opposite. I didn't need more intelligence — I needed something that costs cents, doesn't flood my terminal, and produces output I can audit line by line. If I can't read and run what the agent produces, it's useless to me: I work with money, invoices and data that has to add up.

So I built a cheap agent —OpenCode + DeepSeek Flash— and wrapped it in discipline: persistent memory, token-spend rules, strict permissions and real verification. This post is the "how", with numbers, and it ends with ten concrete things you can do today with a setup like this. No magic; just honest engineering.


Who's writing this

I'm Ignacio Badenes (IgnicionDev), an IT technician from Castellón, Spain. I come from support and access control: protocols, logs, staying calm when things break. I now apply that habit to the software I build and publish —Aethernet (local WiFi auditing, 146 tests), LocalGrant-Finder (Spanish official-gazette grants with hybrid search), SystemBridge-AI (invoices into a balanced ledger, money as Decimal) and AssetShrink (C++17, local image processing)—. All with tests, CI and a licence. If a tool isn't auditable, I don't ship it. Same goes for my agent.


The thesis: discipline replaces raw power

A cheap model doesn't force cheap results. It forces you to stop improvising. The trick isn't the model: it's spending few tokens without losing accuracy. With DeepSeek Flash the cost splits like this:

cost = fresh_input × $0.14/M  +  cached_input × $0.0028/M  +  output × $0.28/M

Cached input is 50× cheaper than fresh input, and output is the priciest line. So I attacked all three:

  1. Minimal system prompt and tools (fewer fixed tokens per request).
  2. Maximum cache reuse (same prefix, no random UUIDs to break it).
  3. Controlled output (short answers or JSON, no filler paragraphs).

In my working scenario that cuts spend by ~82%; once the cache is warm, marginal cost per request drops to a fraction of a cent. It's not "free", but it gets close. And it stays correct because I supply the discipline where the model can't.


The setup: OpenCode + DeepSeek

My model is deepseek/deepseek-v4-flash, served through an OpenAI-compatible provider with caching enabled:

{
  "model": "deepseek/deepseek-v4-flash",
  "provider": {
    "deepseek": {
      "npm": "@ai-sdk/openai-compatible",
      "options": { "setCacheKey": true },
      "models": {
        "deepseek-v4-flash": {
          "reasoning": true,
          "interleaved": { "field": "reasoning_content" }
        }
      }
    }
  }
}

Three decisions that matter all day:

  • Automatic compaction (auto, prune, reserved: 5000): the conversation prunes itself; I don't drag a huge history.
  • Tool output limits (max_lines: 200, max_bytes: 8192): an npm install doesn't dump 200 lines in my face; if it truncates, I re-run it scoped.
  • Strict permissions (webfetch: deny, read-only plan mode): the agent can't browse or write outside its lane without my approval.

Above all of this sits one file: my AGENTS.md. It isn't a wish list; it's a work router with a protocol (understand → plan → small change → verify → review), an honest Definition of Done (typecheck, tests, lint, reviewed diff) and spending rules. The model is cheap; the judgement isn't.


Memory and context: stop repeating what it already knows

An agent without memory is an intern with amnesia: every session starts from zero and pays twice. I use the engram + zerotoken plugin: typed memory in SQLite with FTS5, auto-saving error→fix, architecture decisions and compactions, and injecting only 2 memories / 600 tokens at startup. In short: instead of dragging 50,000 tokens of history, I inject just enough.

On top of that I add Context7: when I ask about a specific API or version, it pulls the real documentation and caches it as a memory. Next time I don't re-query it and the model doesn't hallucinate it. Live docs, zero repetition.


My.OpenCode.Conf: the private project that shapes it all

Here's the part most people miss. My config isn't a loose opencode.json: it's a private GitHub project called My.OpenCode.Conf, part of my learning and the way I work. It's a bundle of three independent subprojects that talk to each other through an open protocol (MCP):

Subproject What it brings Built with
skill-matrix 240+ skills in SKILL.md format (technical and design) the agent loads on demand via triggers Markdown
second-termux-v2 An MCP server that runs background jobs and returns a single status line instead of flooding the TUI TypeScript (ESM)
engram+zerotoken The persistent-memory plugin (FTS5) and the token-saving policy TypeScript (Bun)

A master prompt ties them together: instead of maintaining a fragile install.sh, the agent configures itself (detects the OS, adapts commands). And, to me, the best part of its design: it's reversible. It uninstalls cleanly, with no lock-in, no telemetry and without touching what you already had. The repo is private for now —I show it, explain it and answer questions— but the lesson is public: a good config is code you can read, verify and undo.


The tools that wire it together (MCP and plugins)

  • chrome-devtools (headless) — a real browser the agent drives: navigate, extract, and run Lighthouse audits without opening a window.
  • github — issues, PRs and actions from the conversation itself.
  • sqlite — queries against my local work database.
  • context7 — live library documentation.
  • human-followup.ts — my own plugin using notify-send: when the agent asks for input, needs a permission, or finishes a navigation, I get a desktop notification. I can stop staring at the terminal.
  • Subagents (explore, general) — to split exploration and heavy work without polluting my context.

Building your own MCP to publish without leaving the agent

The most honest example of a "tool of my own" is this very post. Instead of copy-pasting into a browser, I wrote a local MCP for Coder Legion in dependency-free Node ESM (~300 lines): a JSON-RPC conversation over stdio against the platform's REST API. The agent lists, searches, comments and drafts from the same session where it codes.

What's interesting isn't the happy path, it's the edges:

  • The API has no draft field. The draft is implemented with POST /posts followed by POST /posts/{id}/hide: the post is born invisible to everyone but the author and mods. Publishing is POST /posts/{id}/reshow.
  • The MCP never publishes on its own. cl_create_post validates and creates always hidden; if the hide fails it returns the id and warns that the post went public so I fix it immediately. The real publish only happens through cl_publish_post, and that call is mine.
  • Incremental editing. cl_edit_post does a server-side read-modify-write: append, prepend, insert_before, insert_after or replace against a literal anchor. I add a section without resending 19 KB of markdown, with dry_run to preview before saving.

It's the pattern I keep repeating: the API does the bare minimum, the MCP adds the discipline (draft-first, human review) and the agent keeps the mechanical part. If I can't audit or undo it, I don't automate it.


From TUI to Desktop on Linux (already migrated)

Until recently I ran everything in the TUI (v1.18.34). I've just moved to the Desktop version on Linux Mint 22.3, installing the official release .deb. There's no Homebrew cask on Linux —that's macOS only—; here the right choice is the release packages (.deb, .rpm or .AppImage). The desktop binary registers its launcher in the application menu, so I go from "open a terminal and type" to "open an app". Same config, same memory, same agent; only the wrapper changes. If you're stuck installing it on Linux, I'll walk you through it in the comments.


Ten things my cheap agent does today

Real examples, no hype:

  1. Diagnose a repo: point at it, and it reproduces, minimises and proposes a fix plan using the diagnose skill.
  2. Write tests first: red-green-refactor with tdd, not filler tests.
  3. Review a diff: a parallel audit of standards and spec with review.
  4. Real web audit: spin up the headless browser and run Lighthouse on my site.
  5. Pull up-to-date docs with Context7 and store them in Engram so the query isn't repeated.
  6. Remember a fix across sessions: "this broke before", and the error→fix is there.
  7. Run a long build in the background and get a single done status line instead of 200.
  8. Refactor with a plan: request-refactor-plan breaks it into small, safe commits.
  9. Create its own skill with write-a-skill when I repeat a pattern.
  10. Delegate exploration of an unknown codebase to a subagent while I keep working.

The honest part: what I gain and what I lose

I gain: cents-level cost, memory that persists, permissions I respect, zero telemetry, and the peace of mind of a system I can audit and undo. I lose: a reasoning ceiling —a Flash model isn't a frontier model— and convenience. A cheap agent doesn't think for you; it forces you to say exactly what you want and to verify the result. To me, that trade is an advantage: it's the difference between "I trust it because I read it" and "I trust it because an expensive model said so".


Takeaway

You don't need the most powerful model to produce serious software: you need token economy, memory and discipline. With a cheap model well directed, the limit stops being the price and becomes your judgement.

So what about you? Which cheap model do you use —or would you use— and how do you compensate for its limits? Tell me in the comments; I read and reply to everyone.


Licencia de los proyectos mencionados: MIT · Sin secretos ni claves en este post. · Proyectos: github.com/yosoyignicion

Want more #ai & #aiagents deep dives?

Join 6,175+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

4 Comments

2 votes
1
1 vote
1

More Posts

AAIF Hits 10 Projects. Its CTO on What to Adopt Now and the Security Gaps Left Open

Tom Smithverified - Oct 23

The Sovereign Vault — A Comprehensive Guide to Protocol-Driven AI

Ken W. Algerverified - Jun 4

CData's New AI Gateway Puts Context at the Center — Fixes the Three Reasons Enterprise AI Stalls

Tom Smithverified - Sep 28

What Security Teams Want From AI Agents Before They Let Them Act Alone

Tom Smithverified - Nov 18

When One Python Process Fails, You Need to See All of Them

Tom Smithverified - Nov 23
chevron_left
580 Points • 26 Badges
5Posts
13Comments
IgnicionDev - Siempre en Desarrollo! - Always Under Development!

Contact me here! - https://x.com/Y... Show more

Related Jobs

View all jobs →

Commenters (This Week)

18 comments
2 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!