Skip to content

V3: any model, no single AI vendor

V2 freed MuseFlow from the music provider's API. It left another dependency in place: one AI vendor. Every profile, every tag and every suggestion came from Gemini, called directly. V3 removes that dependency: MuseFlow now reaches its models through OpenRouter, a gateway to most of the models on the market, and each LLM step can use any of them.

The switch looks technical. Its motivation is not: it is a product decision, with a financial side.

Why V3 is a product change

No single point of failure. With one vendor, an outage, a price change, a deprecated model or a policy change stops the product. Through the gateway, a step can list fallback models, tried in order when its main one fails, and moving to another vendor is a setting, not a rewrite. It is the same reasoning as the V1 → V2 pivot, applied to the LLM: do not let one company own the rules.

More to explore. Different models read the same history differently. With one vendor, a listener got one portrait. Now the same listening history can give two taste profiles, built by two models, and so two kinds of suggestions. Profiles are named, and each records the models that built it, so they can be compared side by side. Choosing a model on the result that matters, the profile and the playlist it leads to, becomes possible instead of trusting a benchmark.

Control over cost. Each step picks its own model: the cheapest one for high-volume work (tagging thousands of tracks, summarising batches of history), a stronger one for synthesis (merging partial profiles, writing the final portrait, suggesting tracks). The day a cheaper or better model appears, a step moves to it. The cost is spread over steps and vendors instead of following one vendor's price list, and one account pays for all of them.

Measured with museflow llm usage, on a history of about 10,000 tracks:

Operation Default models Cost
Tag the whole library (genres, moods, languages) Gemini 3.1 flash-lite about $0.80, once (read from the gateway's activity page)
Build a taste profile from about 1,000 rated tracks flash-lite, then 3.5 flash, then 3.1 pro $0.22, of which $0.16 for the merge
One discovery playlist (three suggestion rounds) Gemini 3.5 flash about $0.07

The first readings, taken from the gateway's activity page during the QA, said about $1 per build and $0.40 per discovery. They were rough, since that page does not tell one command from the next. Per-call tracking corrected them, and it shows where to look next: the merge step reasons at length and carries three quarters of a build.

What it took

The defaults are still Gemini models: what changed is that nothing depends on it anymore.

  • The ports did not move. The profiler, the advisor and the enricher sit behind ports since V2. The switch replaced their adapters and left the use cases untouched. The hexagonal architecture paid for itself here.
  • One schema for every vendor. A strict response schema is not read the same way by every model. During the QA, Gemini rejected any enum of more than about 100 values (the genre list has 166), and Anthropic rejected a nullable enum written the way OpenAI documents it. The schemas now follow rules that every tested vendor accepts, and a test enforces them.
  • Fail before paying. Before any paid call, each command checks its models against the gateway's public catalogue: an unknown model, a missing parameter, or a model without a Zero Data Retention endpoint fails at once, with a clear message.
  • Clear failures. A rejected request now shows the provider's own reason in one line, a rejection that every batch would hit stops the run at the first one, and a profile build pauses and resumes.

The technical details are in the LLM pipeline.

How it was shipped

The OpenRouter branch was large: a gateway, three adapters, new settings, new error handling. Merging it on the strength of the tests alone would have been a gamble, so it went through a full manual QA first.

  • A written QA plan, from an empty database. I followed the user guide step by step, as a new user would: export my data from the old version, reset, restore, then exercise every command, first with a key holding no credit (failure paths for free), then with a small budget. Every finding, from a crash to an awkward sentence, went into the plan's notes.
  • Small themed PRs, on the branch. Findings were fixed along the way, in small PRs grouped by theme (schema portability, failure handling, polish, era merging), each merged into the OpenRouter branch after my review. main stayed untouched until the QA was green. Claude, the AI agent I develop with, wrote the PRs; I reviewed and merged them. Before, as the only developer, I pushed straight to main, force-pushing when needed. This brought back the workflow I knew in the companies I worked for: a branch, a pull request, a review, then a merge. Even alone, one can work as a team, the way we are used to at work. It also let me follow the subtleties of each change instead of discovering them later.
  • Cheap experiments instead of guesses. When Gemini started rejecting every enrichment request with an opaque error, we did not guess: a few bisections, sending the same request with one part of the schema removed at a time, found the enum size limit for a few cents.
  • The QA tests its own fixes. Each fix was checked again with real calls. One of them, letting the merge rename a period of the listening timeline, made the timeline collapse from 13 periods to 4; the next PR fixed it, and a rebuild brought 11.

The whole QA, two full profile builds and a re-tag of the library included, cost about $5.

Honest status

  • One gateway. The lock-in moved from a model vendor to the gateway. The ports would let a direct vendor adapter come back if the gateway had to go.
  • Costs are tracked, not yet optimized. Every paid command prints what it spent and records it; museflow llm usage sums it by step, model, profile or run. The profile merge is the first step to look at.
  • Discovery leaves suggestions on the table. The QA showed that some suggested tracks are never found in the Spotify catalogue (tracks with several artists, some titles with an apostrophe), so a playlist often ends below its target size. This predates V3 and is the next fix. Since then: fixed at the root, as discovery no longer asks for titles (Discovery: from titles to artists).
  • Model comparison is possible, not done. Building the same profile with several models and comparing the playlists is now a setting away, but I have not run that study yet.