From e9465c73d46ccc7bc816b366c646f5244236948c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrew=20Beveridge=20=E2=98=84=EF=B8=8F?= Date: Sat, 26 Sep 2026 14:53:04 -0400 Subject: [PATCH] chore: gemini-3.8-flash everywhere + auto-correct on Opus 5.5 (cost) (#1054) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Why GCP credits expired 2026-09-19; Vertex Gemini 3.1 Pro spend had grown $9 → $37 → $105/30d. `gemini-3.8-flash` is $0.75/$3.75 per 1M (vs $2/$12 for 3.1 Pro; rises to $1.50/$7.50 on 2027-01-01). Opus 5.5 is $4/$20 (vs $5/$25 for 4.8). ## Changes - All Gemini defaults → `gemini-3.8-flash`: credit eval, custom lyrics, auto-correct (default + compare leg), match judge, parse titles, tenant bulk analyze, agentic AI router, error-monitor LLM analysis (also `us-central1` → `global`, required for Gemini 3.x), frontend `translate.py`. - Auto-correct Claude leg `claude-opus-4-8` → `claude-opus-5-5` (ci.yml env), with `effort: "high"` pinned (5.5 defaults to medium). Pricing table gains both new models. - Docs updated; version 0.241.1. ## Evidence (12 recent prod jobs, pre-review lyrics scored against the human-reviewed final) | Model | Precision | Word-level recall | $/job | |---|---|---|---| | gemini-3.1-pro-preview | 91% | 74% | $0.067 | | gemini-3.8-flash | 98% | 38–41% | $0.020 | | gemini-3.8-flash @ high thinking | 97% | 60% (4/12 timed out, 504) | $0.041 | | claude-opus-4-8 | 94% | 33% | $0.080 | | claude-opus-5-5 (effort high) | 93% | 58% | $0.048 | Flash for the Gemini leg is a deliberate cost/recall trade-off (Andrew chose it); Opus 5.5 more than compensates. Also verified: `gemini-3.8-flash` works on Vertex `global` (rejects `thinking_level=minimal`; nothing here uses it), match-judge latency median 3.3s / max 6.2s (< 12s timeout), Japanese translation smoke test preserves ICU placeholders. Translation cache is keyed on English text + locale, so no re-translation churn. Tests: auto_correct, credit eval, custom lyrics, parse_titles, error_monitor, agentic router suites pass locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code) ## Summary by CodeRabbit * **New Features** * AI-powered correction, translation, matching, title parsing, and evaluation now use updated models, including Gemini 3.8 Flash and Claude Opus 5.5. * **Updates** * AI service pricing reflects scheduled rate changes, including a Gemini 3.8 Flash rate change beginning January 1, 2027. * Application version updated to 0.241.1. --------- Co-authored-by: Claude Opus 5.5 (1M context) --- .github/workflows/ci.yml | 2 +- CLAUDE.md | 2 +- backend/config.py | 12 ++++---- backend/services/auto_correct/pricing.py | 29 ++++++++++++++++--- backend/services/auto_correct/service.py | 6 +++- backend/services/error_monitor/config.py | 4 +-- backend/services/match_judge/ai.py | 4 +-- backend/services/parse_titles/ai.py | 4 +-- backend/services/tenant_bulk/analyze.py | 4 +-- .../services/auto_correct/test_pricing.py | 12 ++++++++ backend/tests/test_parse_titles.py | 2 +- docs/AI-CREDIT-GATING.md | 4 +-- docs/API.md | 6 ++-- docs/ARCHITECTURE.md | 2 +- frontend/scripts/translate.py | 2 +- .../correction/agentic/router.py | 6 ++-- pyproject.toml | 2 +- scripts/measure_autocorrect_cost.py | 4 +-- 18 files changed, 72 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66ddfdb5..fdc9e76d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2025,7 +2025,7 @@ jobs: --min-instances 2 \ --vpc-connector projects/nomadkaraoke/locations/us-central1/connectors/cloud-run-connector \ --vpc-egress private-ranges-only \ - --set-env-vars "GOOGLE_CLOUD_PROJECT=${{ env.PROJECT_ID }},GCS_BUCKET_NAME=karaoke-gen-storage-${{ env.PROJECT_ID }},FIRESTORE_COLLECTION=jobs,ENVIRONMENT=production,KARAOKE_GEN_VERSION=$VERSION,DEFAULT_DROPBOX_PATH=/MediaUnsynced/Karaoke/Tracks-Organized,DEFAULT_GDRIVE_FOLDER_ID=1laRKAyxo0v817SstfM5XkpbWiNKNAMSX,ENABLE_CLOUD_TASKS=true,CLOUD_RUN_SERVICE_URL=https://api.nomadkaraoke.com,GCP_REGION=us-central1,DEFAULT_ENABLE_YOUTUBE_UPLOAD=true,DEFAULT_BRAND_PREFIX=NOMAD,DEFAULT_PRIVATE_DROPBOX_PATH=/MediaUnsynced/Karaoke/Tracks-NonPublished,DEFAULT_PRIVATE_BRAND_PREFIX=NOMADNP,USE_GCE_ENCODING=true,USE_GCE_PREVIEW_ENCODING=true,ENABLE_PUSH_NOTIFICATIONS=true,USE_CLOUD_RUN_JOBS_FOR_VIDEO=true,USE_CLOUD_RUN_JOBS_FOR_RENDER=true,EMAIL_PROVIDER=postmark,AUTO_CORRECT_MODEL=claude-opus-4-8,AUTO_CORRECT_COMPARE_MODELS=claude-opus-4-8;gemini-3.1-pro-preview,AUTO_CORRECT_PROACTIVE_ENABLED=true,AUTO_APPROVAL_BACKING_KEEP_ENABLED=true,COMMUNITY_DAILY_PICK_ENABLED=true,EDGE_AUTH_MODE=enforce,COMMIT_SHA=${{ steps.build-meta.outputs.sha }},PR_NUMBER=${{ steps.build-meta.outputs.pr_number }},PR_TITLE=${{ steps.build-meta.outputs.pr_title }}" \ + --set-env-vars "GOOGLE_CLOUD_PROJECT=${{ env.PROJECT_ID }},GCS_BUCKET_NAME=karaoke-gen-storage-${{ env.PROJECT_ID }},FIRESTORE_COLLECTION=jobs,ENVIRONMENT=production,KARAOKE_GEN_VERSION=$VERSION,DEFAULT_DROPBOX_PATH=/MediaUnsynced/Karaoke/Tracks-Organized,DEFAULT_GDRIVE_FOLDER_ID=1laRKAyxo0v817SstfM5XkpbWiNKNAMSX,ENABLE_CLOUD_TASKS=true,CLOUD_RUN_SERVICE_URL=https://api.nomadkaraoke.com,GCP_REGION=us-central1,DEFAULT_ENABLE_YOUTUBE_UPLOAD=true,DEFAULT_BRAND_PREFIX=NOMAD,DEFAULT_PRIVATE_DROPBOX_PATH=/MediaUnsynced/Karaoke/Tracks-NonPublished,DEFAULT_PRIVATE_BRAND_PREFIX=NOMADNP,USE_GCE_ENCODING=true,USE_GCE_PREVIEW_ENCODING=true,ENABLE_PUSH_NOTIFICATIONS=true,USE_CLOUD_RUN_JOBS_FOR_VIDEO=true,USE_CLOUD_RUN_JOBS_FOR_RENDER=true,EMAIL_PROVIDER=postmark,AUTO_CORRECT_MODEL=claude-opus-5-5,AUTO_CORRECT_COMPARE_MODELS=claude-opus-5-5;gemini-3.8-flash,AUTO_CORRECT_PROACTIVE_ENABLED=true,AUTO_APPROVAL_BACKING_KEEP_ENABLED=true,COMMUNITY_DAILY_PICK_ENABLED=true,EDGE_AUTH_MODE=enforce,COMMIT_SHA=${{ steps.build-meta.outputs.sha }},PR_NUMBER=${{ steps.build-meta.outputs.pr_number }},PR_TITLE=${{ steps.build-meta.outputs.pr_title }}" \ --set-secrets "ANTHROPIC_API_KEY=anthropic-api-key:latest,AUDIOSHAKE_API_TOKEN=audioshake-api-key:latest,GENIUS_API_TOKEN=genius-api-key:latest,SPOTIFY_COOKIE_SP_DC=spotify-cookie:latest,RAPIDAPI_KEY=rapidapi-key:latest,DEFAULT_DISCORD_WEBHOOK_URL=discord-releases-webhook:latest,ADMIN_TOKENS=admin-tokens:latest,RED_API_KEY=red-api-key:latest,RED_API_URL=red-api-url:latest,OPS_API_KEY=ops-api-key:latest,OPS_API_URL=ops-api-url:latest,FLACFETCH_API_URL=flacfetch-api-url:latest,FLACFETCH_API_KEY=flacfetch-api-key:latest,POSTMARK_SERVER_TOKEN=postmark-server-token:latest,STRIPE_SECRET_KEY=stripe-secret-key:latest,STRIPE_WEBHOOK_SECRET=stripe-webhook-secret:latest,LANGFUSE_PUBLIC_KEY=langfuse-public-key:latest,LANGFUSE_SECRET_KEY=langfuse-secret-key:latest,LANGFUSE_HOST=langfuse-host:latest,ENCODING_WORKER_URL=encoding-worker-url:latest,ENCODING_WORKER_API_KEY=encoding-worker-api-key:latest,ENCODING_WORKER_FALLBACK_VMS=encoding-worker-fallback-vms:latest,VAPID_PUBLIC_KEY=vapid-public-key:latest,VAPID_PRIVATE_KEY=vapid-private-key:latest,E2E_BYPASS_KEY=e2e-bypass-key:latest,GDRIVE_VALIDATOR_URL=gdrive-validator-url:latest,EDGE_ORIGIN_SECRET=edge-origin-secret:latest,KARAOKEHUNT_FORWARDER_SECRET=karaokehunt-forwarder-secret:latest,KJBOX_PARTNER_SECRET=kjbox-partner-secret:latest" # R3/R4 — smoke the tagged candidate revision BEFORE it serves any traffic. diff --git a/CLAUDE.md b/CLAUDE.md index 44a396c6..5772cd80 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -112,7 +112,7 @@ See `docs/TESTING.md` § "Ad-Hoc Production Debugging" for full details. - Only `/admin/*` is English-only — it has no `[locale]/admin` counterpart and inherits `DefaultIntlProvider` from the root layout - Internal links use `Link` from `@/i18n/routing` (locale-aware) - After adding/changing English strings: `python frontend/scripts/translate.py --messages-dir frontend/messages --target all` -- Translation uses Gemini 3.1 Pro via Vertex AI with GCS cache for efficiency +- Translation uses Gemini 3.8 Flash via Vertex AI with GCS cache for efficiency - CI validates all locale files have matching keys — **PR will fail if translations are missing** - Pre-commit hook auto-translates when en.json changes (enable: `git config core.hooksPath .githooks`) - Don't hardcode user-facing strings — add to `messages/en.json` and use `t('key')` diff --git a/backend/config.py b/backend/config.py index 96012e7f..b54b0f95 100644 --- a/backend/config.py +++ b/backend/config.py @@ -84,7 +84,7 @@ class Settings(BaseSettings): # Only used when skip_correction=false # When enabled, uses Gemini via Vertex AI for intelligent lyrics correction use_agentic_ai: bool = os.getenv("USE_AGENTIC_AI", "true").lower() in ("true", "1", "yes") - agentic_ai_model: str = os.getenv("AGENTIC_AI_MODEL", "vertexai/gemini-3-flash-preview") + agentic_ai_model: str = os.getenv("AGENTIC_AI_MODEL", "vertexai/gemini-3.8-flash") # Timeout for agentic correction in seconds. If correction takes longer, abort and # use uncorrected transcription - human review will fix any issues. agentic_correction_timeout_seconds: int = int(os.getenv("AGENTIC_CORRECTION_TIMEOUT_SECONDS", "180")) @@ -105,12 +105,12 @@ class Settings(BaseSettings): # before granting. Fail-CLOSED: if evaluation fails, the decision becomes # "pending_review" (no auto-grant; an admin is notified to decide). credit_eval_enabled: bool = os.getenv("CREDIT_EVAL_ENABLED", "true").lower() in ("true", "1", "yes") - credit_eval_model: str = os.getenv("CREDIT_EVAL_MODEL", "gemini-3.1-pro-preview") + credit_eval_model: str = os.getenv("CREDIT_EVAL_MODEL", "gemini-3.8-flash") # Custom Lyrics (LLM-powered) — used by the Custom Lyrics mode in the # Edit All Lyrics modal. Stateless service: takes operator-provided # custom-lyrics text/file and returns transformed lyric lines. - custom_lyrics_model: str = os.getenv("CUSTOM_LYRICS_MODEL", "gemini-3.1-pro-preview") + custom_lyrics_model: str = os.getenv("CUSTOM_LYRICS_MODEL", "gemini-3.8-flash") custom_lyrics_max_file_mb: int = int(os.getenv("CUSTOM_LYRICS_MAX_FILE_MB", "5")) custom_lyrics_max_input_lines: int = int(os.getenv("CUSTOM_LYRICS_MAX_INPUT_LINES", "500")) custom_lyrics_max_iterations: int = int(os.getenv("CUSTOM_LYRICS_MAX_ITERATIONS", "4")) @@ -120,7 +120,7 @@ class Settings(BaseSettings): # AI auto-correct suggestions — opt-in, user-triggered from the lyrics # review UI. Stateless: one whole-song LLM call returning word-level # suggestions the reviewer accepts/rejects individually. - auto_correct_model: str = os.getenv("AUTO_CORRECT_MODEL", "gemini-3.1-pro-preview") + auto_correct_model: str = os.getenv("AUTO_CORRECT_MODEL", "gemini-3.8-flash") # Models used by the multi-model "compare" mode (semicolon-separated — # Cloud Run --set-env-vars is comma-delimited). Empty = single-model only. auto_correct_compare_models: str = os.getenv("AUTO_CORRECT_COMPARE_MODELS", "") @@ -175,7 +175,7 @@ class Settings(BaseSettings): match_judge_enabled: bool = os.getenv("MATCH_JUDGE_ENABLED", "true").lower() in ( "true", "1", "yes", ) - match_judge_model: str = os.getenv("MATCH_JUDGE_MODEL", "gemini-3.5-flash") + match_judge_model: str = os.getenv("MATCH_JUDGE_MODEL", "gemini-3.8-flash") # Bounds the AI call so a hung model never strands the submission UI. Kept # generous because Vertex returns 504 DEADLINE_EXCEEDED if generation can't # finish within this deadline (3s was too tight for gemini-3.5-flash); the @@ -187,7 +187,7 @@ class Settings(BaseSettings): parse_titles_enabled: bool = os.getenv("PARSE_TITLES_ENABLED", "true").lower() in ( "1", "true", "yes", ) - parse_titles_model: str = os.getenv("PARSE_TITLES_MODEL", "gemini-3.5-flash") + parse_titles_model: str = os.getenv("PARSE_TITLES_MODEL", "gemini-3.8-flash") parse_titles_timeout_ms: int = int(os.getenv("PARSE_TITLES_TIMEOUT_MS", "20000")) parse_titles_max_items: int = int(os.getenv("PARSE_TITLES_MAX_ITEMS", "200")) # Items per Gemini call: large client batches are split into concurrent diff --git a/backend/services/auto_correct/pricing.py b/backend/services/auto_correct/pricing.py index 54f8efdb..1ee2cc17 100644 --- a/backend/services/auto_correct/pricing.py +++ b/backend/services/auto_correct/pricing.py @@ -22,6 +22,7 @@ logged tokens rather than trusting the historical USD value. """ from __future__ import annotations +from datetime import date, datetime, timezone from typing import Optional, TypedDict @@ -49,27 +50,47 @@ class _Rate(TypedDict): MODEL_PRICING: dict[str, _Rate] = { # --- Anthropic (authoritative) --- "claude-fable-5": {"input": 10.0, "output": 50.0, "cache_read": 1.0}, + "claude-opus-5-5": {"input": 4.0, "output": 20.0, "cache_read": 0.2}, "claude-opus-4-8": {"input": 5.0, "output": 25.0, "cache_read": 0.5}, "claude-sonnet-4-6": {"input": 3.0, "output": 15.0, "cache_read": 0.3}, "claude-haiku-4-5": {"input": 1.0, "output": 5.0, "cache_read": 0.1}, # --- Gemini (ESTIMATE — Vertex 3.x Pro preview, <=200K-token context # tier; confirm against current Google pricing before trusting USD) --- "gemini-3.1-pro-preview": {"input": 2.0, "output": 12.0, "cache_read": 0.2}, + # Promo rate through 2026-12-31; see _RATE_CHANGES for the standard rate. + "gemini-3.8-flash": {"input": 0.75, "output": 3.75, "cache_read": 0.075}, +} + +# Scheduled price changes: model -> [(effective_date, rate)], oldest first. +# The latest entry whose date has arrived overrides MODEL_PRICING. +_RATE_CHANGES: dict[str, list[tuple[date, _Rate]]] = { + "gemini-3.8-flash": [ + (date(2027, 1, 1), {"input": 1.5, "output": 7.5, "cache_read": 0.15}), + ], } -def get_rate(model: str) -> Optional[_Rate]: +def _effective(model: str, rate: _Rate, on: Optional[date]) -> _Rate: + on = on or datetime.now(timezone.utc).date() + for effective, changed in _RATE_CHANGES.get(model, []): + if on >= effective: + rate = changed + return rate + + +def get_rate(model: str, on: Optional[date] = None) -> Optional[_Rate]: """Return the rate card for ``model``, or None if we have no pricing. Falls back to a prefix match on the model family (e.g. a dated ``claude-fable-5-2026...`` snapshot still resolves to ``claude-fable-5``) - so a minor model-id change doesn't silently drop cost tracking. + so a minor model-id change doesn't silently drop cost tracking. ``on`` + (default: today, UTC) selects any scheduled price change. """ if model in MODEL_PRICING: - return MODEL_PRICING[model] + return _effective(model, MODEL_PRICING[model], on) for known, rate in MODEL_PRICING.items(): if model.startswith(known): - return rate + return _effective(known, rate, on) return None diff --git a/backend/services/auto_correct/service.py b/backend/services/auto_correct/service.py index dc7ff364..58d79b9d 100644 --- a/backend/services/auto_correct/service.py +++ b/backend/services/auto_correct/service.py @@ -674,7 +674,11 @@ class AutoCorrectService: system=system_prompt, messages=[{"role": "user", "content": user_prompt}], thinking={"type": "adaptive"}, - output_config={"format": {"type": "json_schema", "schema": strict_schema}}, + # Pin effort: Opus 5.5 defaults to "medium" (4.8 defaulted to "high"). + output_config={ + "effort": "high", + "format": {"type": "json_schema", "schema": strict_schema}, + }, ) except Exception as exc: if _is_transient_model_error(exc): diff --git a/backend/services/error_monitor/config.py b/backend/services/error_monitor/config.py index a3e97b2c..eced1196 100644 --- a/backend/services/error_monitor/config.py +++ b/backend/services/error_monitor/config.py @@ -98,8 +98,8 @@ Shared infrastructure: # LLM analysis settings # --------------------------------------------------------------------------- -LLM_ANALYSIS_MODEL: str = os.environ.get("LLM_ANALYSIS_MODEL", "gemini-2.0-flash-001") -LLM_VERTEX_LOCATION: str = os.environ.get("LLM_VERTEX_LOCATION", "us-central1") +LLM_ANALYSIS_MODEL: str = os.environ.get("LLM_ANALYSIS_MODEL", "gemini-3.8-flash") +LLM_VERTEX_LOCATION: str = os.environ.get("LLM_VERTEX_LOCATION", "global") #: Minimum number of active error patterns required before triggering LLM analysis. MIN_PATTERNS_FOR_ANALYSIS: int = 3 diff --git a/backend/services/match_judge/ai.py b/backend/services/match_judge/ai.py index 0a69b6be..5b60d518 100644 --- a/backend/services/match_judge/ai.py +++ b/backend/services/match_judge/ai.py @@ -70,9 +70,9 @@ RESPONSE_SCHEMA = { def _model() -> str: try: from backend.config import settings - return getattr(settings, "match_judge_model", "gemini-3.5-flash") + return getattr(settings, "match_judge_model", "gemini-3.8-flash") except Exception: # pragma: no cover - config import guard - return "gemini-3.5-flash" + return "gemini-3.8-flash" def build_prompts( diff --git a/backend/services/parse_titles/ai.py b/backend/services/parse_titles/ai.py index 7374b058..f00ca4bd 100644 --- a/backend/services/parse_titles/ai.py +++ b/backend/services/parse_titles/ai.py @@ -59,9 +59,9 @@ RESPONSE_SCHEMA = { def _model() -> str: try: from backend.config import settings - return getattr(settings, "parse_titles_model", "gemini-3.5-flash") + return getattr(settings, "parse_titles_model", "gemini-3.8-flash") except Exception: # pragma: no cover - config guard - return "gemini-3.5-flash" + return "gemini-3.8-flash" def build_prompts(items: list[dict]) -> tuple[str, str]: diff --git a/backend/services/tenant_bulk/analyze.py b/backend/services/tenant_bulk/analyze.py index 5c9632c2..bc09fc16 100644 --- a/backend/services/tenant_bulk/analyze.py +++ b/backend/services/tenant_bulk/analyze.py @@ -445,9 +445,9 @@ def _default_model() -> str: try: from backend.config import settings - return getattr(settings, "match_judge_model", "gemini-3.5-flash") + return getattr(settings, "match_judge_model", "gemini-3.8-flash") except Exception: # pragma: no cover - config import guard - return "gemini-3.5-flash" + return "gemini-3.8-flash" def default_generate(system_prompt: str, user_prompt: str) -> dict: diff --git a/backend/tests/services/auto_correct/test_pricing.py b/backend/tests/services/auto_correct/test_pricing.py index 0da00985..8d74fe58 100644 --- a/backend/tests/services/auto_correct/test_pricing.py +++ b/backend/tests/services/auto_correct/test_pricing.py @@ -171,3 +171,15 @@ def test_suggest_logs_unavailable_usage_without_crashing(caplog) -> None: ) assert "auto-correct usage job=job-2 model=claude-fable-5 tokens=unavailable" in caplog.text assert "total_est_cost_usd=unknown" in caplog.text + + +def test_gemini_38_flash_rate_switches_to_standard_on_2027_01_01() -> None: + from datetime import date + + from backend.services.auto_correct.pricing import get_rate + + assert get_rate("gemini-3.8-flash", on=date(2026, 12, 31))["output"] == 3.75 + assert get_rate("gemini-3.8-flash", on=date(2027, 1, 1))["output"] == 7.5 + assert get_rate("gemini-3.8-flash", on=date(2027, 1, 1))["input"] == 1.5 + # Models without scheduled changes are unaffected. + assert get_rate("claude-opus-5-5", on=date(2027, 6, 1))["output"] == 20.0 diff --git a/backend/tests/test_parse_titles.py b/backend/tests/test_parse_titles.py index 6abbb8ac..cb513a1a 100644 --- a/backend/tests/test_parse_titles.py +++ b/backend/tests/test_parse_titles.py @@ -8,7 +8,7 @@ def test_settings_parse_titles_defaults(): from backend.config import Settings s = Settings() assert s.parse_titles_enabled is True - assert s.parse_titles_model == "gemini-3.5-flash" + assert s.parse_titles_model == "gemini-3.8-flash" assert s.parse_titles_timeout_ms == 20000 assert s.parse_titles_max_items == 200 diff --git a/docs/AI-CREDIT-GATING.md b/docs/AI-CREDIT-GATING.md index 4a028567..e7dec57a 100644 --- a/docs/AI-CREDIT-GATING.md +++ b/docs/AI-CREDIT-GATING.md @@ -77,7 +77,7 @@ The verify page (`/auth/verify`) shows these states in sequence: | Environment Variable | Default | Description | |---------------------|---------|-------------| | `CREDIT_EVAL_ENABLED` | `true` | Set to `false` to disable AI evaluation and auto-grant all credits | -| `CREDIT_EVAL_MODEL` | `gemini-3.1-pro-preview` | Gemini model to use for evaluation | +| `CREDIT_EVAL_MODEL` | `gemini-3.8-flash` | Gemini model to use for evaluation | ### Emergency Rollback @@ -96,7 +96,7 @@ Every evaluation is logged to the `credit_evaluations` Firestore collection: "reasoning": "No suspicious correlations found — clean user", "confidence": 1.0, "error": null, - "model": "gemini-3.1-pro-preview", + "model": "gemini-3.8-flash", "signals_snapshot": { "fingerprint_match_count": 0, "ip_match_count": 0, diff --git a/docs/API.md b/docs/API.md index 959594e6..e6ac9134 100644 --- a/docs/API.md +++ b/docs/API.md @@ -689,13 +689,13 @@ Returns: "reason": "All references read 'chlorine' here", "category": "mishearing", "confidence": 0.95, - "models": ["claude-opus-4-8", "gemini-3.1-pro-preview"], + "models": ["claude-opus-5-5", "gemini-3.8-flash"], "consensus": 2, "total_models": 2, "conflict_group": null } ], - "model": "claude-opus-4-8, gemini-3.1-pro-preview", + "model": "claude-opus-5-5, gemini-3.8-flash", "elapsed_seconds": 27.4, "settings_applied": { "suggest_adlib_removal": true, "allow_insertions": true, "min_confidence": 0.0 }, "warnings": [], @@ -932,7 +932,7 @@ Content-Type: application/json Decides the official formatting for a typed artist/title and whether it matches a real song. A deterministic normalizer + the catalog run first; a light Vertex -Gemini model (`MATCH_JUDGE_MODEL`, default `gemini-3.5-flash`) is consulted +Gemini model (`MATCH_JUDGE_MODEL`, default `gemini-3.8-flash`) is consulted **only** when those aren't confident. `audio_confidence_tier` (1=strong..3=weak, optional) lets the judge tell whether weak audio results hint at a typo. The call never blocks job creation — on timeout/error it returns a `none` verdict. Disable diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 1aed9e89..cad44627 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -251,7 +251,7 @@ LyricsTranscriber LyricsTranscriber |---------|---------|----------| | Cloud Run GPU Job (L4, us-east4) | Audio stem separation — `Separator` runs directly in the audio worker Job (no HTTP hop) | Yes | | AudioShake | Lyrics transcription | Yes | -| Vertex AI | Agentic AI correction (Gemini 3 Flash) | Default off (SKIP_CORRECTION=false to enable) | +| Vertex AI | Agentic AI correction (Gemini 3.8 Flash) | Default off (SKIP_CORRECTION=false to enable) | | Genius | Reference lyrics | Yes | | Flacfetch | Audio downloads (YouTube, torrents) | Recommended* | | YouTube API | Video upload | Optional | diff --git a/frontend/scripts/translate.py b/frontend/scripts/translate.py index face53d2..f407577a 100644 --- a/frontend/scripts/translate.py +++ b/frontend/scripts/translate.py @@ -39,7 +39,7 @@ from translation_cache import TranslationCache from google import genai from google.genai import types -MODEL = "gemini-3.1-pro-preview" +MODEL = "gemini-3.8-flash" PROJECT = "nomadkaraoke" LOCATION = "global" diff --git a/karaoke_gen/lyrics_transcriber/correction/agentic/router.py b/karaoke_gen/lyrics_transcriber/correction/agentic/router.py index 2e7087d9..23a73035 100644 --- a/karaoke_gen/lyrics_transcriber/correction/agentic/router.py +++ b/karaoke_gen/lyrics_transcriber/correction/agentic/router.py @@ -7,7 +7,7 @@ from .providers.config import ProviderConfig # Default model for cloud deployments - Gemini 3 Flash via Vertex AI # Note: Gemini 3 models require 'global' location (not regional like us-central1) -DEFAULT_CLOUD_MODEL = "vertexai/gemini-3-flash-preview" +DEFAULT_CLOUD_MODEL = "vertexai/gemini-3.8-flash" class ModelRouter: @@ -20,7 +20,7 @@ class ModelRouter: """Choose appropriate model based on gap characteristics. Returns model identifier in format "provider/model" for LangChain: - - "vertexai/gemini-3-flash-preview" for Gemini via Vertex AI (default) + - "vertexai/gemini-3.8-flash" for Gemini via Vertex AI (default) - "ollama/llama3.2:latest" for local Ollama models - "openai/gpt-4" for OpenAI models - "anthropic/claude-3-sonnet-20240229" for Anthropic models @@ -34,7 +34,7 @@ class ModelRouter: if self._config.privacy_mode: return "ollama/llama3.2:latest" - # Default to Gemini 3 Flash for all cases (fast, cost-effective, latest capabilities) + # Default to Gemini 3.8 Flash for all cases (fast, cost-effective, latest capabilities) return DEFAULT_CLOUD_MODEL diff --git a/pyproject.toml b/pyproject.toml index b1bca0d8..15754483 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "karaoke-gen" -version = "0.241.0" +version = "0.241.1" description = "Generate karaoke videos with synchronized lyrics. Handles the entire process from downloading audio and lyrics to creating the final video with title screens." authors = ["Andrew Beveridge "] license = "MIT" diff --git a/scripts/measure_autocorrect_cost.py b/scripts/measure_autocorrect_cost.py index 83a31559..b8d8fb72 100644 --- a/scripts/measure_autocorrect_cost.py +++ b/scripts/measure_autocorrect_cost.py @@ -19,7 +19,7 @@ Usage: python scripts/measure_autocorrect_cost.py --jobs abc123 def456 # Single-model instead of the multi-model compare config - python scripts/measure_autocorrect_cost.py --limit 3 --models claude-opus-4-8 + python scripts/measure_autocorrect_cost.py --limit 3 --models claude-opus-5-5 Requires: - ANTHROPIC_API_KEY in the environment (for claude-* models) @@ -55,7 +55,7 @@ logger.setLevel(logging.INFO) PROJECT = "nomadkaraoke" GCS_BUCKET = "karaoke-gen-storage-nomadkaraoke" -DEFAULT_MODELS = ["claude-opus-4-8", "gemini-3.1-pro-preview"] +DEFAULT_MODELS = ["claude-opus-5-5", "gemini-3.8-flash"] # ---------------------------------------------------------------------------