Repository navigation
按次计费的配音也要预算:MiniMax 按量付费、ElevenLabs、阿里云百炼没写预算就不调 - #236
Merged
Merged
Conversation
…-as-you-go, ElevenLabs, DashScope bin/vh tts and bin/vh voices audition read the film's Budget before the first request and before anything is deleted (the key is checked first), each request is held and settled at what the answer says was billed (ElevenLabs': the estimate, an upper bound), and the run ends with what it spent. Prices from the providers' own pages, read 2026-11-22, in tools/audio/speechcost.py; an unknown model or endpoint needs a Budget line and is recorded as cost not known. Local voices, edge, Gemini and the Token Plan key are used as before. budget.py: two holds in one millisecond no longer share an id.
…temp folder's name could hold L8 and fail the run)
… 'lost' line (the stream's own thread can note it after quit)
… answer within 60 s, or gone before one); a program that is not there is not tried again
… and read spend.jsonl; the older tts checks run with a budget, or the Token Plan key, as a voice billed per use now needs; the fake minimax_tts takes out=
…a key comes from the environment or the one saved in Studio The two sentences the maintainer approved: the baseline bullet's last sentence (bin/vh tts, music and voices on local, subscription or free quota as before; MiniMax pay-as-you-go, ElevenLabs and DashScope under the budget) and hard rule 7 (the environment, or the key Studio's settings page keeps in the system's password store, both through tools/keys.py). AGENTS.md regenerated; playbook/05's line on keys says the same.
…pensive one; the estimate is of the body as sent, every character that is not ASCII as 2 - A model the price table lacks, on an endpoint it has, is priced as that endpoint's most expensive model, with the usual hold and settle, said to be assumed; model names match whatever their case. Only an unknown endpoint (a proxy, a stand-in) is still "cost not known", and each of its requests is still recorded. - The estimate counts the body each request carries (tts.body_of: MiniMax's pause marks as rewritten), and where a Chinese character counts as 2 every non-ASCII character does (〇, full-width punctuation, kana): an upper bound. - Checks: a no-budget refusal from the command line for elevenlabs and dashscope too (nothing deleted, exit 1); --candidates N counted in the run's estimate; the body as sent; the unlisted model, a name in another case, the count. - Docs: LOCAL.md's default counts for an unknown endpoint; minimax.cn as well as minimaxi.com; the refusal exits 1; the gate goes by the key's name.
…r (a start that did not answer is now tried once more)
…was gone (Linux says EPIPE or ECONNRESET where macOS says exit 1), in any order
ZLHad
marked this pull request as ready for review
November 22, 2026 10:40
ZLHad
enabled auto-merge (squash)
November 22, 2026 10:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A voice billed per use now waits for a budget, the way a generated picture or a Lyria track already does. Since #234, a key saved in Studio reaches every command, the agent in Studio's column included, so
bin/vh ttsandbin/vh voices auditioncould spend money with no budget at all. Three flaky checks are fixed too, each in its own commit.Which calls need a budget, and why
tts/voices audition --provider minimaxwith MINIMAX_API_KEY alone--provider elevenlabs--provider dashscopeqwen,sayedgegemini,gemini-lite,--align gemini,voices list / design / deleteHow it works (as image and lyria do)
budget.check:--resumecounts only those left,--candidates NN of each);assets/spend.jsonl, then settled at what the answer says was billed:extra_info.usage_characters, "Number of billable characters used in this synthesis";usage.characters;bin/vh ttsends with how many requests were made, what they cost, and the budget line.*_MODEL, a*_BASE_URLelsewhere) needs a Budget line that is not 0. Each request is then recorded as "cost not known, maybe billed".Prices, each read on the provider's own page on 2026-11-22
The table is in
tools/audio/speechcost.py, with each page's URL beside its numbers;python3 tools/audio/speechcost.pylists it.MINIMAX_BASE_URLon minimaxi.com or minimax.cn): hd 3.50 元/万字符, turbo 2.00 元/万字符, "1 个汉字算 2 个字符". Page: https://platform.minimax.cn/docs/guides/pricing (platform.minimaxi.com redirects there).DASHSCOPE_BASE_URLon dashscope-intl): "$0.1" per 10,000 characters; page https://www.alibabacloud.com/help/en/model-studio/model-pricing.Three flaky checks (one commit each)
words_checks: it looked for "L8" anywhere in the report, and the report prints the temp path. It now matches the line-number column only. Shown failing before and passing after with a temp folder namedwL8L8.tools/textcheck/browser.mjs), seen asreadcheck --exportfailing on GitHub's macOS runner:What the first full run turned up (fixed in 2b51325)
--resumecheck gets a Budget line in yuan;--candidatescheck uses a stand-in Token Plan key. On this machine it had passed only because the shell holds a real Token Plan key, which tts tries first; on GitHub's runner it would have stopped at "no budget".minimax_ttstakes the newout=.del os.environ["MINIMAX_TOKEN_PLAN_KEY"]in the new check. It is now an assignment to "".tools/artifacts.jsonlists tts and voices as writers and readers ofassets/spend.jsonland its lock.Checks run
tools/ci.sh --committed:--committed --changed 5cc6f45at the head: all passed (357 checks in the 14 groups the fix reaches: smoke, assets, artifacts, studio and the others), one known skip; the settings page's checks run directly, all ok.paid_speech_checks, underassets_checks, with stand-ins only: no key, no network,OVH_KEYSTORE=none, a dead proxy as a guard.--resumeasking nothing more.usage_charactersignored, DashScope's usage ignored;Two more for the browser start: no second try, and a missing program retried.
OVH_KEYSTORE=none.Not looked at, or not in this PR
CLAUDE.mdsentences (the baseline's last sentence and hard rule 7) are in c0249cf, the architect's commit, with AGENTS.md regenerated and playbook/05's line on keys.usage.charactersin DashScope's SDK answer (read as a dict or an attribute);bin/vh tts --provider dashscopewith a key and no budget first lets uv fetch thedashscopepackage, then refuses. bin/vh picks the packages before tts.py runs, and the CI checks call tts.py directly.Review round 1 (cef42c4, 7ebcd82)
speech-2.8-HD).speech-2.9-hdunderBudget: $0.0001is refused;Speech-2.8-TURBOis priced as turbo; an older ElevenLabs name is priced at $0.08.--candidates 2on minimax: a budget that fits one take of each block, not two, is refused before anything.tts.body_of, the same function the MiniMax request uses, so<#0.5#>counts as the<#0.50#>that is sent.bin/vh web's last-resort deadline (tools/web/chrome.mjsandweb.py'schrome_budget) allows two starts of each browser:3 * (2 * 70 + tab). The comments say so.Mutations: 7 more (an unlisted model not priced, model names by case, only Han counted as 2, the estimate of the text as written,
--candidatescounted once, no up-front check but MiniMax's, DashScope's usage ignored), each turning the right check red; 20 in all with the earlier ones. The DashScope stand-in now bills 26 characters against an estimate of 30, so ignoring its count shows.Full run:
tools/ci.sh --committedat 7ebcd82: 792 checks passed, one known skip (frames on a HyperFrames composition).GitHub's Linux job on c0249cf: my browser start check failed there. The behaviour was right: started again, the tab came up, a browser that never starts failed after the second try, a missing program not retried. But Linux reports the browser gone as EPIPE or ECONNRESET where macOS says "exit 1", and the check matched the exact text. e031ac2 counts the lines instead, whatever the reason and in any order. GitHub's Linux output passes it; both browser mutations still turn it red. Groups run for it (
--committed --changed 7ebcd82: static, doc, readpath, film): 51 checks, all passed.