# The cost model

Same credit rates in the app and over MCP. What differs between plans is the
monthly grant, not the price of anything.

## Know what this connection can do, first

**`get_connection_info`** is free, read-only, and worth one call at the start of
every session. It returns the account plan, the scopes this credential was
granted, **how much of today's spend ceiling is left**, and the NAMES of tools
you cannot call with the reason for each — a scope the user withheld, a group
they set to read-only, a tool they excluded, or one the plan does not include. It
includes the links where your user changes those things. Settings can only
narrow a token or a connection; to add access, your user creates a new token or
reconnects you.

Reading it first is the difference between "I cannot do that" and "your token was
not granted the render scope; a new token or a reconnect adds it".

**`hyviral_help`** answers product questions — how a HYVIRAL feature works, what
the platform can and cannot do. Ground product answers in that lookup rather than
inferring them from the tool list.

## Quote, then confirm

Every tool that costs credits answers its first call with a price and charges
nothing:

```
_meta: {
  "hyviral/requiresConfirmation": true,
  "hyviral/quotedCredits": 50,
  "hyviral/quotedCreditsCovers": "tool_price_and_ai_processing",
  "hyviral/confirmationToken": "cft_...",
  "hyviral/expiresAt": "..."
}
```

The token is single-use, bound to the exact arguments you sent, and lives about
ten minutes. Change the arguments and you get a fresh quote rather than an error:
changing your mind is not a mistake. Send the SAME arguments again and you get
the SAME token back, so you cannot accumulate several approvals for one piece of
work.

The quote is a **ceiling on the whole charge**. If the real price comes out
above it, the call is refused before anything is reserved; if the work costs
less than the quote, you pay the lower figure. **The server never charges more
than the number you were shown.**

Never confirm on the user's behalf. "It'll cost up to 50 credits, shall I go
ahead?" is the whole interaction, and skipping it is spending someone else's
money without asking.

## What the quote covers

`quotedCredits` covers everything the call bills: the tool's own price, and an
allowance for the AI pass the tool runs internally — a quality critic on image,
thumbnail and carousel calls, a review watcher on `video_review`. That pass used
to be billed on top, which meant the total could land above the number you had
shown your user; it no longer can.

Two consequences worth saying out loud:

- **The charge is often lower than the quote.** Whatever the call does not spend
  is released rather than charged, so the allowance is headroom, not a fee.
- **Say "up to", not "exactly".** The quote is the most it can cost, and an
  agent that presents it as the price will keep over-stating small calls.

**Report the actual charge afterwards**, read off the response rather than
repeated from the quote. Quoting the real number back is what makes the next
confirmation quick.

## What "no credit cost" means

Read tools are free. Every tool listed at no credit cost charges nothing: none of
them returns token usage and none of them bills.

What adds a charge is a generation tool, and everything such a tool bills — the
model call it makes for you and the internal AI pass it runs to check the result
— is inside the quote you were shown. There is no second charge to warn a user
about, and no reason to pad an estimate for one.

A cached research hit is free — `search_research_cache` costs nothing whether it
finds something or not.

Linking a profile is free on every plan, and so is its first sync (on the
free trial it starts once the user subscribes). `preview_profile`,
`link_profile` and `list_linked_profiles` charge nothing (linking is one call, with no bio code), and
the back-catalogue ingest that follows a successful link is included in the plan
rather than billed against credits. Worth saying out loud when a user hesitates:
the step that makes every intel tool able to answer is the one step that costs
them nothing.

## Two kinds of cancel

They are not the same thing, and telling a user the wrong one is expensive.

- **Declining a quote** — you simply do not send the confirmation. Nothing was
  reserved and nothing is charged. Let the token expire.
- **`cancel_job`** — the work has already started. It requests cancellation, and
  **work already delivered is still charged.** Stop polling on `cancelled`.

## Ceilings

Each credential has its own daily ceiling: the larger of 50,000 credits or a fifth
of the plan's monthly grant. It is a runaway brake, not an entitlement: the
account balance is still the real limit, and `get_connection_info` tells you how
much of today's is left. Every charge counts toward it, including one from a
tool quoted at zero that then charged for its work.

If you hit it, say so plainly and stop. It resets at midnight UTC, and other
credentials on the account are unaffected.

## On a free trial

A free-trial account has a card on file, and its trial is the same whichever plan
it picked: the plan's own credits and limits start when the trial ends. It has
2,000 credits that lapse when the trial ends, and one call may quote at most 1,000 of them: a larger
quote is refused with `TRIAL_LIMIT` before anything is reserved, so split the
work or let your user subscribe. Linking and reading social profiles
start with a subscription too. `get_connection_info` says whether this account is
on a trial and when it ends.

## Priced per minute of video

Two research tools price by length, the same as the app does:

| Tool | Price | Cap | Ceiling |
|---|---|---|---|
| `generate_post_reports` | 15 + 5 per started minute of the post | 12 hours | 3,615 |
| `analyze_url` | 50 + 5 per started minute of the video | 60 minutes | 350 |

The confirmation card shows the real price: the post's length is stored, and
the video's is read from the platform when the quote is made. When the platform
does not answer in time, `analyze_url` quotes its ceiling and charges the real
price. A video or post over the cap is refused before the quote with
`VIDEO_TOO_LONG`. A job that fails charges nothing, and the read that follows
(`get_report`, `get_url_analysis`) is free.

## Priced by the footage it carries

`video_handoff` without `layers` renders nothing, so it has no render price. A `relink` package
is 0 credits: it carries only what HYVIRAL made. A `proxy` or `original`
package charges the download of the user's uploaded files it includes at
storage cost: about 60 per GiB, rounded up in steps of
five below a hundred and of twenty-five above, so a short clip still costs the
smallest step. The largest package,
50 GiB with the most rendered layers one call takes, is 4,525 credits. The quote measures the real files; the charge is the
bytes actually included, never above the quote. Each footage call is charged,
so hand the user the link you already have rather than calling again.

`layers` adds each second it renders, at the export's render rate, and the
download of the clips, in every `media` mode, `relink` included. The quote is an
upper bound; the charge is what rendered and shipped, never above it. The same
package asked for again renders nothing and charges only the download. The LUTs,
the vignette still and a transparent overlay's conversion are free.

## Retries

Any spending tool accepts an optional `idempotencyKey`. Same key + same arguments
replays the original response instead of charging again. Same key + DIFFERENT
arguments is refused, because that is a bug in the caller rather than a retry.

**Never retry a spending call after a timeout without checking
`list_active_jobs` first.** A re-call is not a retry: it starts and bills a
second job.

## Where the money actually goes

If a run is costing more than it should, it is almost always one of these:

1. **Regenerating instead of editing.** `edit_carousel` re-renders only the
   slides that changed; `edit_thumbnail` changes wording for free. Generating
   fresh is the expensive path.
2. **Not checking what the user already owns.** `list_broll_assets` before
   `generate_b_roll` costs nothing and often ends the task.
3. **Naming an `engine` without pricing it.** A named video model can cost more
   than five times the default. `list_media_models` first.
4. **Exporting more than once.** Every edit op is free; `video_export` is the one
   paid render. Preview, converge, then export once.
5. **Re-ingesting a source.** An already-transcribed source returns its words for
   nothing, so a defensive re-call is free — but a re-upload is not.

## Reporting what a deliverable cost

<!-- budget: 250 -->
Close each deliverable, every short and every full edit, with its real cost
and the time it took.

- **Credits charged, not quoted.** Add up the receipts of the calls that made
  it: `hyviral/creditsCost` in the `_meta` of a call that ran, and
  `chargedCredits` from `get_job_status` for a job. Count each `jobId` once:
  polling the same job again is not a second charge. `hyviral/quotedCredits`
  is a ceiling and `hyviral/reservedCredits` a hold; neither is the cost.
  `hyviral/estimatedWallClockMs`, when present, is the expected run time.
- **Original work and revisions apart**, so a remake shows its own cost.
- **A shared cost once.** When several deliverables share a step, such as
  ingesting the one source three shorts are cut from, list that cost once and
  name it as shared; do not divide it or repeat it under each.
- **Elapsed time** from the first edit to the delivered file, on your own
  clock, since the responses carry no timestamps. Say that it includes waiting
  in the queue; do not present it as working time.
- **Graphics checked.** For a video with motion graphics, say that each graphic
  with parts was checked at the start, the middle and the end of its time on
  screen (`references/graphics.md`, *A graphic moves for its whole time on
  screen*).
