> ## Documentation Index
> Fetch the complete documentation index at: https://runcrate.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Translation API

> Translate text between languages using Qwen3 and DeepSeek-V3 via the Runcrate API. Single-text and batch translation examples.

export const RuncrateStyles = () => {
  if (typeof document !== 'undefined' && !document.getElementById('runcrate-overrides')) {
    const s = document.createElement('style');
    s.id = 'runcrate-overrides';
    s.textContent = `
      /* Match Runcrate's rounding scale (--radius: 0.75rem) */
      .rounded-sm { border-radius: 0.5rem !important; }   /* 8px */
      .rounded-md { border-radius: 0.625rem !important; } /* 10px */
      .rounded-lg { border-radius: 0.75rem !important; }  /* 12px */
      .rounded-l-sm { border-top-left-radius: 0.5rem !important; border-bottom-left-radius: 0.5rem !important; }
      .rounded-r-sm { border-top-right-radius: 0.5rem !important; border-bottom-right-radius: 0.5rem !important; }
      .rounded-l-md { border-top-left-radius: 0.625rem !important; border-bottom-left-radius: 0.625rem !important; }
      .rounded-r-md { border-top-right-radius: 0.625rem !important; border-bottom-right-radius: 0.625rem !important; }
      .rounded-l-lg { border-top-left-radius: 0.75rem !important; border-bottom-left-radius: 0.75rem !important; }
      .rounded-r-lg { border-top-right-radius: 0.75rem !important; border-bottom-right-radius: 0.75rem !important; }

      /* Cards: never pure white in light mode */
      .card { background-color: #fcfcfc !important; border-radius: 0.75rem !important; }
      html.dark .card { background-color: #141414 !important; }

      /* Docs hero box */
      .rc-hero { background-color: #fcfcfc; border: 1px solid #e0e0e0; }
      html.dark .rc-hero { background-color: #141414; border-color: #242424; }
      html.dark .rc-hero h1 { color: #f5f5f5; }

      /* Runcrate scrollbar — thin, transparent track, hide-until-hover thumb */
      ::-webkit-scrollbar { width: 6px; height: 6px; background-color: transparent; }
      ::-webkit-scrollbar-track { background-color: transparent; }
      ::-webkit-scrollbar-thumb { background-color: rgba(155, 155, 155, 0.5); border-radius: 10px; transition: opacity 0.3s ease; opacity: 0; }
      ::-webkit-scrollbar-thumb:hover { background-color: rgba(155, 155, 155, 0.7); }
      *:hover::-webkit-scrollbar-thumb,
      *:focus::-webkit-scrollbar-thumb,
      *:active::-webkit-scrollbar-thumb { opacity: 1; }
      * { scrollbar-width: thin; scrollbar-color: rgba(155, 155, 155, 0.5) transparent; }
    `;
    document.head.appendChild(s);
  }
  return null;
};

<RuncrateStyles />

Translate text between languages using multilingual LLMs. Context-aware translations that outperform traditional MT on nuanced content.

## Recommended models

| Model           | Strengths                                                    |
| --------------- | ------------------------------------------------------------ |
| **Qwen3-Max**   | Best for CJK (Chinese, Japanese, Korean), strong European    |
| **DeepSeek-V3** | Strong across all major languages, cost-effective for volume |

***

## Basic translation

<CodeGroup>
  ```python Python theme={"theme":"github-dark"}
  from runcrate import Runcrate

  client = Runcrate(api_key="rc_live_YOUR_API_KEY")
  response = client.models.chat_completion(
      model="Qwen/Qwen3-Max",
      messages=[
          {"role": "system", "content": "Translate to Japanese. Output only the translation."},
          {"role": "user", "content": "Our new API reduces integration time from weeks to hours."}
      ],
  )
  print(response.choices[0].message.content)
  ```

  ```typescript TypeScript theme={"theme":"github-dark"}
  import Runcrate from '@runcrate/sdk';

  const rc = new Runcrate({ apiKey: 'rc_live_YOUR_API_KEY' });
  const response = await rc.models.chatCompletion({
    model: 'Qwen/Qwen3-Max',
    messages: [
      { role: 'system', content: 'Translate to Japanese. Output only the translation.' },
      { role: 'user', content: 'Our new API reduces integration time from weeks to hours.' },
    ],
  });
  console.log(response.choices[0].message.content);
  ```

  ```bash curl theme={"theme":"github-dark"}
  curl https://api.runcrate.ai/v1/chat/completions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer rc_live_YOUR_API_KEY" \
    -d '{"model": "Qwen/Qwen3-Max", "messages": [{"role": "system", "content": "Translate to Japanese. Output only the translation."}, {"role": "user", "content": "Our API reduces integration time from weeks to hours."}]}'
  ```
</CodeGroup>

***

## Multi-language

```python theme={"theme":"github-dark"}
source = "Your account has been upgraded. You now have access to all premium features."
for lang in ["Japanese", "Spanish", "German", "Korean"]:
    response = client.models.chat_completion(
        model="Qwen/Qwen3-Max",
        messages=[
            {"role": "system", "content": f"Translate to {lang}. Output only the translation."},
            {"role": "user", "content": source}
        ],
    )
    print(f"{lang}: {response.choices[0].message.content}")
```

***

## Batch — localization file

```python theme={"theme":"github-dark"}
import json
strings = {"welcome": "Welcome back", "upgrade": "Upgrade your plan", "settings.save": "Save changes"}

def translate_batch(strings, target):
    r = client.models.chat_completion(
        model="deepseek-ai/DeepSeek-V3",
        messages=[
            {"role": "system", "content": "Translate UI strings. Keep JSON keys unchanged. Valid JSON only."},
            {"role": "user", "content": f"Translate values to {target}:\n\n{json.dumps(strings, indent=2)}"}
        ],
        response_format={"type": "json_object"},
    )
    return json.loads(r.choices[0].message.content)

for code, name in [("ja", "Japanese"), ("es", "Spanish"), ("de", "German")]:
    with open(f"locales/{code}.json", "w") as f:
        json.dump(translate_batch(strings, name), f, indent=2, ensure_ascii=False)
```

***

## Context-aware translation

```python theme={"theme":"github-dark"}
response = client.models.chat_completion(
    model="Qwen/Qwen3-Max",
    messages=[
        {"role": "system", "content": "Cloud computing translator. Translate to German. Keep API, SDK in English. Formal Sie."},
        {"role": "user", "content": "Deploy your model to a GPU instance in seconds."}
    ],
)
```

***

## Tips

* **Qwen3 for CJK.** More natural Chinese, Japanese, Korean output.
* **DeepSeek-V3 for volume.** Cheaper per token, strong European languages.
