AI Router · CLI · MCPCheapest eligible quotes before you create
task · activation

Preflight generation cost with the OfflineCreator CLI

Use model-list credit data and balance checks before starting a paid job.

Set up x402 agent payments
Tool rack

Preflight cost before submitting work

Start with `npx @offlinecreator/mcp models`, then run `npx @offlinecreator/mcp balance`. The first command prints the current `/api/v1/models` response; the second prints the `/api/v1/credits` response. Confirm that the selected model is present, then obtain its published credit amount from the current first-party provider disclosure before comparing that amount with the returned balance. Do not infer a price from an undocumented field in the `models` response.

A preflight is a decision snapshot, not a reservation. Record the package version, selected model entry, separately sourced published credit amount, returned balance, and policy threshold applied at that moment. If another worker can spend from the same account, expire the decision after any accepted generation and read the balance again before the next write.

Credit gauge

Use current catalog data, not a memorized price

The public CLI parser exposes `models` and `balance` as separate commands and serializes both API responses as formatted JSON. Keep the selected model entry from `models` beside the credit amount taken from the cited first-party provider disclosure; the public client types the models payload only as an array of unknown entries, so this page does not claim that the CLI returns cost, economics, or compatibility fields.

Archive the `models` response used for the decision together with the separately sourced pricing evidence. If the selected entry disappears or the first-party provider disclosure changes its published credit amount, invalidate the pending decision and require a fresh balance check instead of carrying an earlier price into `generate`.

Command strip

Set an explicit budget decision

Turn the evidence into a gate: the selected model appears in the current response, its separately published first-party credit amount is acceptable, and the returned balance leaves the reserve your team requires. Do not add a format-compatibility check unless another current cited source documents the relevant field. A script can refuse to continue when any supported condition fails, keeping a policy rejection distinct from an API failure.

Have the budget gate emit a small decision object containing the observed balance, selected catalog entry, required reserve, and a pass or stop result. Only the pass branch may invoke `generate`; a missing field, parse error, or failed `/api/v1/credits` read must end before the write request.

Scope ledger

Handle drift and failed preflight safely

The npm registry and public repository both identified package version 0.1.2 during this research pass, but unattended scripts should still inspect the help and output of the exact version they run. Fail closed if JSON parsing fails, the balance cannot be read, or the chosen model no longer appears. Do not turn a failed preflight into a `generate` attempt, and never print the API key while collecting diagnostics.

Pin the registry version used by unattended scripts and execute that installed version's help command during an upgrade check. Agreement between today's registry metadata and repository documentation is only a dated observation; it does not replace testing the installed parser before an automation starts spending credits.

Related circuit

Store the package version, selected model entry, separately sourced published credit amount, balance observation, and decision result without storing credentials. The public client proves that the CLI reads the Studio credits endpoint; it does not prove that `models` returns cost or compatibility fields. Treat the balance observation as a guardrail rather than assuming it reserves funds, and re-read after concurrent work or before a high-cost run.

For concurrent queues, attach the balance observation to one planned job and expire it when another generation is accepted. Re-read credits before the next submission. The cited client source establishes a balance read, while the cited provider disclosure independently establishes published model-specific credit amounts; neither source establishes a CLI-side reservation during preflight.