AI translate

Background AI translation via Vercel AI Gateway. Cooldowns, scoping, and origin tracking.

AI translate fills missing/empty targets via the Vercel AI Gateway. Manual translations are never overwritten.

Behaviour

  • Targets filled only when missing or empty, or when source changed after a prior AI run.
  • Targets with no aiSourceHash (manual) are always left alone.
  • Each saved value stamps aiSourceHash + origin=ai.
  • 60-second cooldown between runs per (project, language).

API

POST /api/ai/translate
Content-Type: application/json
{ "projectId": "…", "languageCode": "de" }

Response includes translated, remainingDirty, and the next cooldownUntil. Set AI_GATEWAY_API_KEY in your environment to enable the AI translate feature.