Engineering Execution Strategy

Breaking the 5-Hour Wall: Building (and Breaking) an Uncapped, Two-Tier AI Coding Pipeline

When the rate limit hits mid-refactor, it hurts your head. You still have to choose how execution runs.

A developer moves from hitting a subscription rate limit and runaway agent context to a DIY two-tier OpenRouter pipeline, and the hidden costs of context bloat, huge PRs, and overnight wallet drain.

The wall I was trying to get around

I've been doing a stretch of intense backend work with AI-assisted coding, the kind where you finally have the failure mode in view and you're willing to trade sleep for one more deploy. On a fixed-tier subscription, that flow has a hard stop: Codex's five-hour rate limit window runs out, and the tool politely tells you to wait - not realizing or caring that you are human, after all.

The limit isn't about whether you still know what to do next. It's about product packaging. Momentum breaks, it never tapers off.

I didn't like to pause when the machine told me to and refused to cede control. So I tried to replace the cap with a meter: a pay-as-you-go pipeline in VS Code using Cline (v3.0.73) and OpenRouter, with prompt caching enabled and a deliberate split between "think hard" and "execute cheap." In hindsight, that was an execution strategy decision as much as a toolchain tweak. I just hadn't named the tradeoffs yet.

The routing goal was simple on purpose:

Roughly 20% on flagship reasoning models (Codex, GPT-6.1 Sol) for architecture, structural refactors, and root-cause analysis.

Roughly 80% on free or ultra-low-cost models, cohere/north-mini-code:free for Act Mode at first, later poolside/laguna-s-2.1:free, for the tool-heavy loops: terminal commands, boilerplate, test iteration.

On paper, that looked like a reasonable hybrid: frontier judgment where mistakes are expensive, zero marginal token cost where the work is repetitive. Uncapped hours. Same repo. Same agent loop. I was optimizing for flow; I hadn't written down what I was willing to risk when the loop ran unattended.

What I didn't appreciate yet is how many failure modes never appear on a pricing page: context growth, gateway behavior, git diff shape, runtime constraints in production, and the gaps in an execution model you adopt in a hurry.

Seventeen cents before the first real task

I loaded $10.00 into an OpenRouter developer wallet and pointed Cline's Act Mode at the free Cohere coder route. The first hour felt like validation.

Then I noticed the balance move before we'd accomplished much. Workspace indexing and the initial codebase snapshot cost $0.17 in uncached context. The session wasn't free though the execution model I used was! The amount might be miserably small but it matters if you're budgeting "free tier" as "free afternoon.". Not only that, small amounts at large scale make big bucks.

The larger issue showed up in the conversation itself. In a normal chat, a long thread is inconvenient. In an agentic loop: read file, run test, paste stderr, and retry, the history is re-injected every turn. Tool output compounds.

So I watched the session climb through 1.3M tokens (1,042 messages), then 1.7M, and eventually peak at 2.2M tokens (1,565 messages). I only trust those numbers because I captured them when VS Code started behaving badly: UI stalls, extension restarts, and OpenRouter closing the connection with ECONNRESET.

At that point I wasn't advancing the feature. I was doing manual context compaction, repeatedly cutting 2.2M tokens down to 28.2k and 1,565 messages down to 11 so the thread would open again without taking the IDE with it.

Nobody sends an invoice for compaction time. But if you run hot agent loops without a compaction strategy, that work becomes part of your job.

What "free" execution actually looked like

Nominal token charges for the free models stayed at $0.00. Behavior was another story.

When tests failed, Cohere often entered a tight loop: small edits to the same broken approach, no real reset of assumptions. That's expensive in wall-clock time even when tokens are free.

I also hit provider-level failures that weren't subtle. The model occasionally emitted terminal commands that were clearly malformed, [object Object] && mode && : && background and the gateway returned Invalid input. At that point you're choosing between abandoning the thread or rebuilding context from scratch.

There's a separate technical gap between advertised context size and useful context. These models claim very large windows, but instruction-following degraded sharply once active history passed roughly 30k-50k tokens far below the theoretical maximum. For agent work, the useful window is what the loop actually retains, not what the model card says.

Switching Act Mode to poolside/laguna-s-2.1:free got me past a Docker blockage. The wallet stabilized around $7.09 remaining. Different provider slug, similar failure modes: just shifted later in the day.

PR #163 taught me git is part of the observability stack

By evening I merged agent output and ran a Codex review on pull request #163. OpenRouter looked quiet, but Git gave me a jolt.

The PR surfaced 724 changed files. The feature wasn't that large. 371 files were duplicated framework trees including .codex/, .agents/ pulled in through stale branch ancestry, along with local artifacts like .vscode/settings.json that shouldn't travel with application changes.

Reviewing that diff isn't a style problem; it's a signal. Agent workflows optimize for finishing the immediate task. Repositories optimize for maintainability over months. Without merge gates, those goals diverge quickly.

We also had explicit clean-domain naming rules in the project. The agent had still introduced shorthand unit labels u1, u2, u3, u4 into folder names and AIDLC documentation. Readable to the model at the moment; but costly for me to do a review later without immense cognitive load.

File count and diff ancestry really captured review load.

The regression that didn't show up in token spend

The most painful mistake wasn't billed by OpenRouter.

A cheaper execution pass refactored code in an AWS Lambda to invoke a new Java helper, essentially shelling out to a JVM from a function with my one-second execution budget.

From the agent's local perspective, calling a helper was a reasonable reuse story. From Lambda's runtime perspective, it added JVM cold start inside an ephemeral container. Production invocations exceeded the threshold and failed.

Rolling that back took more than an hour, longer than the agent session that introduced it.

What stayed with me from that incident wasn't the dollar amount on the wallet. It was the unit of cost. Token price is a line item; runtime and structural choices are incidents. A $0.00 loop that changes language, process model, or cold-start behavior in a latency-sensitive path can be the most expensive automation you never meant to approve.

I ran the hybrid pipeline overnight

After fixing the Lambda regression and cleaning up #163, I tried the workflow I'd actually wanted: plan with Codex, execute with Cline overnight on poolside/laguna-s-2.1:free, letting the agent iterate on tests while I slept.

In the morning, three things were wrong.

My OpenRouter balance was $0.00, down from $7.09. The free route had hit usage limits, which I expected might happen but something had continued calling the API anyway.

The local Cline task history had grown so large the extension could no longer open the thread. For practical purposes, that session was lost.

When I opened OpenRouter's usage view, most of the spend was on a model I hadn't configured:

OpenRouter Activity overview for the week: about $9.70 total spend, 177M tokens, with spend concentrated on Qwen3.8 27B on October 20.

Roughly 98% of spend, or about $9.70 on the session, went to Qwen3.8 27B. That model wasn't in Act Mode, Plan Mode, or any fallback list I had set. My configuration still said free execution on Laguna/Cohere and paid planning on GPT-6.1 Sol when I needed deeper reasoning.

OpenRouter usage charts: spend spike on October 20, request volume split across free models and Qwen, and prompt-heavy token volume with caching.

I can't see OpenRouter's internal routing tables, so I treat the following as a reconstruction assumption rather than a confirmed root cause: the overnight loop exhausted free-tier capacity; the gateway encountered 429 rate limits or connection resets on the free route; instead of failing closed to the client, the platform appears to have substituted a paid model and kept serving requests. Cline's agent loop, still running on an uncompacted multi-thousand-message context, retried aggressively, each cycle shipping tens of thousands of input tokens at commercial rates.

There was no explicit "switching to Qwen" moment in my UI. There was a usage spike and an empty wallet.

The same context growth that had been crashing VS Code became a financial multiplier when routing failed open. Compaction isn't just an IDE hygiene issue. Under the wrong gateway behavior, it's spend control.

What I'd do differently, and what I'm trying next

I'm not dismissing the two-tier idea. Cheap models can carry real execution load. But a DIY stack needs the same operational instincts you'd apply to any production dependency: budgets, fail-closed behavior, and review gates that match the blast radius of autonomous merges.

Before I leave an agent loop unattended again, I'd set a hard daily spend cap at the gateway, something small enough to hurt before it hurts badly. I'd treat context size as a managed resource, not a badge of progress. I'd keep structural/runtime decisions on stronger models or human review, especially in environments with non-negotiable latency limits. I'd treat abnormal file counts and duplicated framework trees in a PR the way I'd treat a deploy anomaly stop and ask why.

I'm sunsetting this OpenRouter + Cline setup for now and moving the same backend workload to Cursor Super, partly to stop being my own SRE for model routing, and partly to see whether managed multi-model orchestration and native compaction handle the edge cases I hit: silent fallback, runaway context, and rate limits that break flow without breaking safety.

The question I'm carrying forward isn't whether I can route eighty percent of tokens to :free slugs. It's whether I can stay in productive flow without paying for it in production regressions, unreviewable diffs, or overnight wallet drains.

For now, this is the post-mortem from an experiment that solved the five-hour wall and introduced a few others I hadn't put on the diagram.