Skip to content

translate: c0mpute first, Anthropic fallback, off the request path - #273

Merged
ralyodio merged 1 commit into
mainfrom
feat/c0mpute-first
Nov 7, 2026
Merged

ralyodio merged 1 commit into
mainfrom
feat/c0mpute-first

Conversation

@ralyodio

@ralyodio ralyodio commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Fleet rollout (ai-providers ROLLOUT.md wave 3: rssamplifier translate needs streaming).

  • packages/translate routes both calls through @profullstack/ai-providers@0.2.0 (pinned exact) with getAi().run: c0mpute first, streamed through provider.stream (the 0.2.0 streaming path); the existing Anthropic claude-haiku-4-5 structured-output calls are kept verbatim as the paid tier. OPENAI, if ever set, gets the c0mpute prompt.
  • c0mpute answers in <title>/<summary>/<source_language>/<body> tags rather than JSON (a 9B model escapes a page of HTML into JSON badly). readTagged parses it; anything unusable falls to the next provider, then to the original as today.
  • Article input to c0mpute is capped at 8,000 chars of HTML (cut at a paragraph boundary, marked truncated). The paid path keeps 60k.
  • Off the request path: a measured c0mpute call took 188 s for one sentence today. ensureTranslation starts the job in the background, waits TRANSLATE_WAIT_MS (default 8 s), else returns pending: true. The read page says the translation is running; /api/translate JSON carries pending. Asking again while it runs is not a second call or charge. Max 24 in flight per process; past that the original shows, uncharged.
  • No paid-key gate any more: with no Anthropic key, c0mpute still translates.
  • Saved model is now c0mpute:<model> for peer answers.
  • Privacy: only public feed posts (and not for publishers who opted out) are sent, as before.

Dead-key behaviour unchanged: Anthropic billing failure -> null -> original shown.

Tests: 5 new (quick answer shown + cached with c0mpute model, background pending + no double charge + later cache hit, untagged answer shows original, tag parser). All workspace suites pass locally against Postgres 17.

🤖 Generated with Claude Code

…uest path

Translations go through @profullstack/ai-providers 0.2.0: c0mpute streams
the answer (provider.stream) in a tagged format a 9B model copies reliably;
the existing Anthropic structured-output call stays as the paid tier.
c0mpute takes minutes under load, so ensureTranslation runs the call in the
background, waits up to TRANSLATE_WAIT_MS (8 s) and otherwise answers
pending; the page says so and the next view is a cache hit. A repeat ask
while running is neither a second call nor a second charge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​profullstack/​ai-providers@​0.2.07610010093100

View full report

@ralyodio
ralyodio merged commit 224531d into main Nov 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant