The Trinity Beast — Translation Parameters

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.

Categories: 5 Storage: Aurora translation_parameters Cache: Valkey tx:params (27-hour TTL) Updated: November 8, 2026 Version: v24

Table of Contents

  1. Overview
  2. How Parameters Work
  3. Customer Price
  4. Parameter Categories
    1. Token Estimation
    2. Cost Controls
    3. Customer Pricing
    4. Refund Rules
    5. Glossary
  5. Managing Parameters
  6. Nightly Sync Job
  7. Complete Parameter Reference

Overview

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.

  • Separate from application parameters: Translation is a standalone service with its own configuration. These parameters live in translation_parameters, not application_parameters. This prevents a bad translation config change from affecting the LPO server, and vice versa.
  • Startup: ECS containers load tx:params from Valkey on startup. Lambda workers load it on cold start.
  • Polling: Containers read from Valkey on demand. The sync job refreshes the cache nightly with a 27-hour TTL — always available between sync runs.
  • Write-through: Any update via the admin API writes to Aurora and Valkey simultaneously. In-memory values on the responding container update immediately.
  • Nightly sync: The sync job re-syncs all parameters from Aurora to Valkey each night, ensuring consistency after any direct Aurora edits.
  • Force reload: 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.

How Parameters Work

-- 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

Fallback Chain

Every parameter accessor follows a three-level fallback to ensure the system never returns zero for a value:

  1. Valkey tx:params hash — fast path, ~0.1ms, refreshed nightly by sync job (27-hour TTL)
  2. Aurora translation_parameters table — authoritative source, ~5ms, used when Valkey is unavailable
  3. Hardcoded defaults — safe floor values matching the seed data, used only if both Aurora and Valkey are unreachable

Customer Price

Customers 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.

Parameter Categories

Internal cost parameters are not published.

Token Estimation History-based — read from Aurora on every estimate

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.

KeyDefaultUnitDescription
estimation.tokens_per_byte0.64tokens / byteInput 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_ratio0.76ratioOutput 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_pct3percentThe 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_samples9pairsPairs 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_rows2700pairsThe 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_rows90pairsThe 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_rate0.30fraction (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_tokens1200tokensApproximate 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.

Cost Controls Safety guardrails — operational limits

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.

KeyDefaultUnitDescription
controls.daily_token_limit51,000,000tokensDaily 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_request42documentsA 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_jobs12jobsWarning 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_depth12jobsDeclared but not enforced: nothing reads this value, and accepted jobs queue without a cap. Kept for reference only.
controls.customer_cancel_enabledtrueswitchLaunch switch for POST /translate/cancel/{quote_id}. true lets customers cancel; anything else answers 404.

Customer Pricing What we charge

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.

KeyDefaultUnitDescription
pricing.minimum_per_pair_usd3.00USD / pairThe 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_usd3.00USDThe 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.

Refund Rules New in October 2026 — the failed-pair refund machine

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.

KeyDefaultUnitDescription
refund.failed_pair_enabledfalseswitchThe 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_hours72hoursHow long a failed pair waits for the customer's free retry before it is refunded automatically.
refund.failed_pair_max_attempts3attemptsStripe attempts per quote before the refund is marked error for an operator.
refund.sweep_interval_minutes15minutesHow 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 UTCOnly 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 UTCThe 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.

Glossary New in November 2026 — the translation glossary's limits and switch

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.

KeyDefaultUnitDescription
glossary.enabledtrueswitchOnly 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_lang200entriesMost entries per glossary (ours, or one customer account) and target language.
glossary.max_term_chars100charactersMost 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_accept3formsMost 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.

Managing Parameters

Via the TBI Administration Dashboard

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).

Via the Admin API

-- 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

Via Aurora SQL (direct)

-- 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.

Nightly Sync Job

The nightly sync job (trinity-beast-sync-job, BeastReconciler, runs at 1 AM EDT) performs two translation-related tasks:

1. Sync translation_parameters → tx:params

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.

2. Actual token ratio data

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.

Complete Parameter Reference

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.

KeyCategoryDefaultDescription
estimation.cache_hit_ratetoken_estimation0.30Expected fraction of input tokens served from cache
estimation.cached_system_tokenstoken_estimation1200Tokens in the cacheable system prompt block
estimation.history_buffer_pcttoken_estimation3The one buffer % over historical actuals, for delivery time and cost
estimation.history_group_rowstoken_estimation90Most recent pairs per history group whose median is used
estimation.history_min_samplestoken_estimation9Pairs a history group needs before its median is used
estimation.history_window_rowstoken_estimation2700Most recent succeeded pairs read for each estimate
estimation.output_input_ratiotoken_estimation0.76Output tokens divided by input tokens; last resort, used only when no history group has estimation.history_min_samples pairs
estimation.seconds_per_bytetoken_estimation0.0014Seconds 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.6token_estimation1.0Stored 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-v3token_estimation0.7Stored but not read, as above
estimation.speed_factor.mistral-largetoken_estimation0.6Stored but not read, as above
estimation.speed_factor.qwen3-235btoken_estimation0.6Stored but not read, as above
estimation.startup_secondstoken_estimation10Fixed 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_bytetoken_estimation0.64Input tokens per translatable byte; last resort, used only when no history group has estimation.history_min_samples pairs
controls.daily_token_limitcost_controls51000000Stored 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_jobscost_controls12Warning threshold for jobs running concurrently (advisory; jobs still queue)
controls.max_docs_per_requestcost_controls42Mirror of txlimits.MaxDocsPerQuote; not read for enforcement
controls.max_queue_depthcost_controls12Declared, not enforced: accepted jobs queue without a cap
controls.customer_cancel_enabledcontrolstrueLaunch switch for customer cancel (POST /translate/cancel/{quote_id})
pricing.minimum_per_pair_usdcustomer_pricing3.00The flat per-pair price customers actually pay (USD)
pricing.minimum_quote_usdcustomer_pricing3.00Absolute floor on the whole quote (USD)
refund.failed_pair_enabledrefundfalseLaunch switch for the automatic failed-pair refund
refund.failed_pair_max_attemptsrefund3Stripe attempts before the refund is marked error
refund.failed_pair_sincerefund""Only quotes accepted after it enter the machine; empty = off
refund.failed_pair_window_hoursrefund72Hours a failed pair waits for the free retry
refund.start_failure_sincerefund""Start-failure catch-up horizon; stamped by migration 03b
refund.sweep_interval_minutesrefund15Refund sweeper tick (multiple of 3, clamped 3–60)
glossary.enabledglossarytrueGlossary switch: only true (any case) attaches entries to new jobs; a missing row counts as true
glossary.max_also_acceptglossary3Most other accepted forms of the target per entry
glossary.max_entries_per_langglossary200Most entries per glossary and target language
glossary.max_term_charsglossary100Most characters (not bytes) per term or accepted form