The runtime parameters that govern the Translation Engine, and what each one actually decides — token and duration estimation, operational controls, customer pricing, refund rules and the glossary limits. Learn these and you can reprice or retune the whole service without touching a line of code.
Translation parameters control the pricing and operational behaviour of the Translation Engine (TBTS). They are stored in the translation_parameters Aurora table — the authoritative source — and cached in Valkey as the tx:params hash for fast reads by ECS containers and Lambda workers.
translation_parameters, not application_parameters. This prevents a bad translation config change from affecting the LPO server, and vice versa.tx:params from Valkey on startup. Lambda workers load it on cold start.POST /admin/translate/params/reload flushes Valkey and reloads from Aurora immediately. All containers pick up changes on their next read.Important: The older app:config translation keys are superseded by tx:params and are retained for backward compatibility only.
-- Aurora: authoritative source
SELECT key, value, description, category, updated_at, updated_by
FROM translation_parameters
ORDER BY category, key;
-- Valkey: fast cache (tx:params hash, 27-hour TTL)
HGETALL tx:params
-- Update a parameter (applies immediately to Aurora + Valkey + in-memory)
POST /admin/translate/params
{"key": "pricing.minimum_per_pair_usd", "value": "3.00", "updated_by": "cory"}
-- Force all containers to reload from Aurora
POST /admin/translate/params/reload
-- View parameters in the TBI Administration dashboard
Translation tab → Translation Parameters section
Every parameter accessor follows a three-level fallback to ensure the system never returns zero for a value:
tx:params hash — fast path, ~0.1ms, refreshed nightly by sync job (27-hour TTL)translation_parameters table — authoritative source, ~5ms, used when Valkey is unavailableCustomers pay a flat 3.00 USD per document-language pair on every agent
except Claude Opus 4.8, which is priced "From 3.00 USD" per pair.
Nine documents into three languages is 27 pairs, so 81.00 USD, and a customer can work that out
without a quote call. POST /translate/quote returns the exact price
before anyone pays.
Two price rows exist rather than one.
pricing.minimum_per_pair_usd scales with the work — it is 3.00 USD
multiplied by the pair count. pricing.minimum_quote_usd is the
smallest possible quote, also 3.00 USD: one document into one language.
Internal cost parameters are not published.
These parameters let the engine estimate a job's size and duration before it runs. Since November 6, 2026 the estimate itself comes from history: every quote and every job reads the record of pairs already translated (Aurora translation_pair_runs) and takes each figure from the median of similar pairs, adding the 3% buffer below to every time and token figure. The fixed ratios here are the last resort, used only when no group of similar pairs holds estimation.history_min_samples pairs, and the other three estimation.history_* rows decide how much history is read and when a group is big enough to trust. The method is described step by step in TBI Translation Engine §19.2.
| Key | Default | Unit | Description |
|---|---|---|---|
estimation.tokens_per_byte | 0.64 | tokens / byte | Input tokens per translatable byte, and one of the more satisfying numbers in this system: it holds at 0.63–0.66 across every document type we have measured. That stability is what lets a byte count become a reliable token estimate. Refresh it from the translation:actuals:{model}:{execution_mode} Valkey keys the nightly sync job writes. It is now the last resort: the estimator uses it only when no history group has estimation.history_min_samples pairs. |
estimation.output_input_ratio | 0.76 | ratio | Output tokens divided by input tokens. Varies by document type: code-heavy docs ~0.46 (code passes through untranslated), prose-heavy docs ~1.01. The 0.76 average is a reasonable middle ground for mixed technical documentation. It is now the last resort: the estimator uses it only when no history group has estimation.history_min_samples pairs. |
estimation.history_buffer_pct | 3 | percent | The one buffer applied over historical actuals, to both the delivery-time estimate and the cost estimate. Every time and token figure of the estimate, whether taken from past pairs or from a last resort, is multiplied by 1 + 3/100. |
estimation.history_min_samples | 9 | pairs | Pairs a history group needs before the estimator uses its median. With fewer, the estimator moves to the next, wider group; when no group has this many, it uses the last-resort parameters in this table. |
estimation.history_window_rows | 2700 | pairs | The most recent succeeded pairs the estimator reads for each estimate. A model with fewer than estimation.history_group_rows pairs in that window also gets its own most recent pairs. |
estimation.history_group_rows | 90 | pairs | The most recent pairs of a group whose median the estimator uses, so each group follows recent behaviour rather than all of history. |
estimation.cache_hit_rate | 0.30 | fraction (0–1) | Expected fraction of input tokens served from the prompt cache. The system prompt plus the protected-terms list accounts for roughly 30% of total input tokens. Refresh from the actual cache_hit_rate values in the translation:actuals:* Valkey keys. |
estimation.cached_system_tokens | 1200 | tokens | Approximate token count of the cacheable system prompt block (system instructions + protected terms list). This is the fixed overhead per request — identical for every doc/lang pair. Must be a multiple of 3 per Trinity Beast convention. |
How to keep these honest. The nightly sync job writes observed token ratios to Valkey keys such as translation:actuals:qwen3-235b:realtime. Review them in the TBI Administration dashboard under Translation → Token Usage and update the estimation parameters when the actuals have drifted. Use 5% as normal noise and 15% as the point where an update is warranted. Since November 6, 2026 these values are only the last resort: the estimator reads the record of real pairs on every estimate, so quotes follow the corpus and the agent roster without anyone editing this table.
Operational limits that keep the engine within safe bounds. Internal cost parameters are not published. For a customer, the daily token limit and the kill switch are checked before the charge: accept answers 503 tbts_service_paused and nothing is charged or queued. The customer limits themselves (12 languages, 42 documents, 300 KB per document, 9 quotes per batch) are code constants in internal/txlimits, not parameters, so no row here can loosen them.
| Key | Default | Unit | Description |
|---|---|---|---|
controls.daily_token_limit | 51,000,000 | tokens | Daily combined token limit (input + output), stored but not read (51M = 17M×3). The limit that runs is a fixed 50,000,000 in the server code, checked when a job is submitted or a quote is accepted. It is model-agnostic: once the day's tokens in the Valkey keys autoops:bedrock:tokens:input:daily and autoops:bedrock:tokens:output:daily reach it, new work is refused until the nightly sync job resets those keys at 1:00 AM Eastern. |
controls.max_docs_per_request | 42 | documents | A mirror of txlimits.MaxDocsPerQuote, set to '42' by the October 2026 migration and not read for enforcement. The enforced limit is the code constant: 42 documents for a customer quote and for POST /admin/translate alike. |
controls.max_active_jobs | 12 | jobs | Warning threshold for concurrent active translation jobs. Multiple of 3. At 12 or more the LPO adds a tx:warnings entry and still queues the job: it is advisory, not a hard stop. |
controls.max_queue_depth | 12 | jobs | Declared but not enforced: nothing reads this value, and accepted jobs queue without a cap. Kept for reference only. |
controls.customer_cancel_enabled | true | switch | Launch switch for POST /translate/cancel/{quote_id}. true lets customers cancel; anything else answers 404. |
These parameters set what customers pay for TBTS translations: a flat 3.00 USD per document-language pair on every agent, and "From 3.00 USD" per pair on Claude Opus 4.8. Changing these takes effect immediately — no deploy needed.
| Key | Default | Unit | Description |
|---|---|---|---|
pricing.minimum_per_pair_usd | 3.00 | USD / pair | The number that sets the price. Multiplied by the total pair count: 3.00 USD per pair on every agent, and "From 3.00 USD" per pair on Claude Opus 4.8. Change this one value and you have repriced the entire service. |
pricing.minimum_quote_usd | 3.00 | USD | The smallest possible quote — one document into one language. It exists so no quote is ever worth less than the Stripe fee, email, and support it costs to fulfil. |
Three parameters that used to live in this table are gone, and it is worth
knowing why rather than wondering where they went.
pricing.standard_tier_discount_pct and
pricing.express_tier_premium_pct priced the two delivery tiers,
and a third adjusted the batch pipeline's rolling averages. All three depended on Bedrock batch mode, which was permanently
removed on June 20, 2026. One delivery mode means nothing left to discount or add a premium
against, so keeping the levers would have meant three knobs that turn and change nothing —
the most expensive kind of documentation, because a reader trusts it.
These six rows decide how a pair that could not be delivered becomes money back in the customer's account. The design keeps the customer in charge: a failed pair first gets one free retry, and only what is still undelivered is refunded, either when the customer chooses "Refund instead" or automatically once the window closes. The whole machine shipped switched off and was turned on on 2026-10-11, in one statement that also set refund.failed_pair_since, so no quote accepted before that moment is ever refunded by surprise. The free retry and the refund for a paid job that never started work from deploy, whatever these rows say.
| Key | Default | Unit | Description |
|---|---|---|---|
refund.failed_pair_enabled | false | switch | The launch switch for the automatic failed-pair refund, the "Refund instead" button and its API. The code default is false; the live row has been true since 2026-10-11. |
refund.failed_pair_window_hours | 72 | hours | How long a failed pair waits for the customer's free retry before it is refunded automatically. |
refund.failed_pair_max_attempts | 3 | attempts | Stripe attempts per quote before the refund is marked error for an operator. |
refund.sweep_interval_minutes | 15 | minutes | How often the refund sweeper ticks. A multiple of 3, clamped to 3–60, and re-read on every tick, so a change needs no restart. |
refund.failed_pair_since | "" | RFC 3339 UTC | Only quotes accepted after this moment enter the machine. Empty means off. Set in the same statement that turns the flag on. |
refund.start_failure_since | "" | RFC 3339 UTC | The start-failure catch-up covers quotes accepted after this moment. Stamped once by migration 03b at deploy, after every LPO task runs the new code. |
These four rows govern the translation glossary: a preferred translation of a source term per target language, kept for our own documents and by each customer account (TBI Translation Engine §10.4). The server checks the three limits on every glossary write, by an admin or a customer, and reads the switch when a job is submitted. They were added on 2026-11-08; the code defaults are the same values and are used only when a row is missing.
| Key | Default | Unit | Description |
|---|---|---|---|
glossary.enabled | true | switch | Only true (any case) attaches glossary entries to a job's queue messages, and a missing row counts as true. Any other value, an empty one included, turns the glossary off for every new job after a params reload, without deleting an entry; the glossary endpoints keep working. |
glossary.max_entries_per_lang | 200 | entries | Most entries per glossary (ours, or one customer account) and target language. |
glossary.max_term_chars | 100 | characters | Most characters, not bytes, in a source term, a target term or an accepted form, so the limit is the same in every script. |
glossary.max_also_accept | 3 | forms | Most other accepted forms of the target per entry. |
The worker's own cap, limits.glossary_prompt_max_entries (40 entries listed per model call), lives in translation-config.json, not in this table.
The easiest way to manage translation parameters is through the TBI Administration dashboard. Navigate to the Translation tab and scroll to the Translation Parameters section (admin only).
tx:params Valkey cache and reloads from Aurora. All ECS containers pick up changes on their next 5-minute poll cycle.-- List all parameters
GET /admin/translate/params
-- Filter by category
GET /admin/translate/params?category=customer_pricing
-- Update a parameter (applies immediately to Aurora + Valkey + in-memory)
POST /admin/translate/params
{"key": "pricing.minimum_per_pair_usd", "value": "3.00", "updated_by": "cory"}
-- Force all containers to reload from Aurora
POST /admin/translate/params/reload
-- View all parameters SELECT key, value, category, updated_at, updated_by FROM translation_parameters ORDER BY category, key; -- Update a parameter UPDATE translation_parameters SET value = '72', updated_at = NOW(), updated_by = 'cory' WHERE key = 'refund.failed_pair_window_hours'; -- After a direct SQL update, reload Valkey via the API: POST /admin/translate/params/reload
Important: Direct SQL updates to Aurora do NOT automatically update Valkey or in-memory values on running containers. Always follow a direct SQL update with a POST /admin/translate/params/reload call to ensure all containers pick up the change within their next 5-minute poll cycle.
The nightly sync job (trinity-beast-sync-job, BeastReconciler, runs at 1 AM EDT) performs two translation-related tasks:
Reads all rows from the translation_parameters Aurora table and writes them to the tx:params Valkey hash with a 27-hour TTL, so the hash always outlives the next run. This ensures all containers have fresh parameter values, even if the Valkey cache expired overnight.
Writes actual token ratios from real jobs to Valkey for operator review:
-- Key pattern: translation:actuals:{model}:{execution_mode} (48-hour TTL)
-- Example: translation:actuals:qwen3-235b:realtime
Fields:
avg_input_tokens — average input tokens per pair
avg_output_tokens — average output tokens per pair
avg_cached_tokens — average cached tokens per pair
output_input_ratio — derived: avg_output / avg_input
cache_hit_rate — derived: avg_cached / avg_input
pair_count — number of pairs in the 7-day window
updated_at — when this was last calculated
Review these periodically and update estimation.output_input_ratio and estimation.cache_hit_rate in translation_parameters when the actuals have drifted from the stored defaults. The estimator's own feedback loop is the pair record it reads on every estimate (Token Estimation, above), which keeps every quote grounded in what the engine really did. estimation.output_input_ratio is now the last resort: the estimator uses it only when no history group has estimation.history_min_samples pairs.
The parameters read from the live translation_parameters table on 2026-10-10, plus the six refund rows and the controls.max_docs_per_request update of the October 2026 migration, the four estimation.history_* rows added on 2026-11-06 (when estimation.quote_padding_pct was removed) and the four glossary.* rows added on 2026-11-08, sorted by category and key. Internal cost parameters are not published. Read the live table with GET /admin/translate/params for today's exact values and count.
| Key | Category | Default | Description |
|---|---|---|---|
estimation.cache_hit_rate | token_estimation | 0.30 | Expected fraction of input tokens served from cache |
estimation.cached_system_tokens | token_estimation | 1200 | Tokens in the cacheable system prompt block |
estimation.history_buffer_pct | token_estimation | 3 | The one buffer % over historical actuals, for delivery time and cost |
estimation.history_group_rows | token_estimation | 90 | Most recent pairs per history group whose median is used |
estimation.history_min_samples | token_estimation | 9 | Pairs a history group needs before its median is used |
estimation.history_window_rows | token_estimation | 2700 | Most recent succeeded pairs read for each estimate |
estimation.output_input_ratio | token_estimation | 0.76 | Output tokens divided by input tokens; last resort, used only when no history group has estimation.history_min_samples pairs |
estimation.seconds_per_byte | token_estimation | 0.0014 | Seconds of processing per translatable byte, kept for internal accounting only. Delivery estimates come from the pair record and never read it. |
estimation.speed_factor.claude-sonnet-4.6 | token_estimation | 1.0 | Stored but not read: no estimate or price uses it (the delivery estimate takes each agent's speed from its recorded pairs) |
estimation.speed_factor.deepseek-v3 | token_estimation | 0.7 | Stored but not read, as above |
estimation.speed_factor.mistral-large | token_estimation | 0.6 | Stored but not read, as above |
estimation.speed_factor.qwen3-235b | token_estimation | 0.6 | Stored but not read, as above |
estimation.startup_seconds | token_estimation | 10 | Fixed job startup time before the first pair moves; last resort, used only when no history group has estimation.history_min_samples pairs |
estimation.tokens_per_byte | token_estimation | 0.64 | Input tokens per translatable byte; last resort, used only when no history group has estimation.history_min_samples pairs |
controls.daily_token_limit | cost_controls | 51000000 | Stored but not read: the daily token guard that runs is a fixed 50,000,000 combined tokens in the server code, checked when a job is submitted or a quote is accepted (TBI Translation Engine §8.2) |
controls.max_active_jobs | cost_controls | 12 | Warning threshold for jobs running concurrently (advisory; jobs still queue) |
controls.max_docs_per_request | cost_controls | 42 | Mirror of txlimits.MaxDocsPerQuote; not read for enforcement |
controls.max_queue_depth | cost_controls | 12 | Declared, not enforced: accepted jobs queue without a cap |
controls.customer_cancel_enabled | controls | true | Launch switch for customer cancel (POST /translate/cancel/{quote_id}) |
pricing.minimum_per_pair_usd | customer_pricing | 3.00 | The flat per-pair price customers actually pay (USD) |
pricing.minimum_quote_usd | customer_pricing | 3.00 | Absolute floor on the whole quote (USD) |
refund.failed_pair_enabled | refund | false | Launch switch for the automatic failed-pair refund |
refund.failed_pair_max_attempts | refund | 3 | Stripe attempts before the refund is marked error |
refund.failed_pair_since | refund | "" | Only quotes accepted after it enter the machine; empty = off |
refund.failed_pair_window_hours | refund | 72 | Hours a failed pair waits for the free retry |
refund.start_failure_since | refund | "" | Start-failure catch-up horizon; stamped by migration 03b |
refund.sweep_interval_minutes | refund | 15 | Refund sweeper tick (multiple of 3, clamped 3–60) |
glossary.enabled | glossary | true | Glossary switch: only true (any case) attaches entries to new jobs; a missing row counts as true |
glossary.max_also_accept | glossary | 3 | Most other accepted forms of the target per entry |
glossary.max_entries_per_lang | glossary | 200 | Most entries per glossary and target language |
glossary.max_term_chars | glossary | 100 | Most characters (not bytes) per term or accepted form |