> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.aegi.run/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.aegi.run/_mcp/server.

# Translation

## Translating

```
GET /v1/translation/translate?text={text}&to={code}
```

```ts
const result = await aegis.translation.translate({
  text: 'good morning',
  to: 'fr',
})

result.translatedText // 'bonjour'
result.originalText
result.sourceLanguage // 'en'
result.targetLanguage // 'fr'
```

`from` is optional and defaults to `auto`, so Aegis detects the source language
itself. Pass it when you already know it:

```ts
await aegis.translation.translate({ text: 'bonjour', from: 'fr', to: 'en' })
```

An empty `text` or an unknown `to` answers `400`.

## Detecting

```
GET /v1/translation/detect?text={text}
```

```ts
const result = await aegis.translation.detect({ text: 'bonjour' })
result.language // 'fr'
```

When detection cannot settle on a language, it returns `unknown` rather than
failing.

## Listing languages

```
GET /v1/translation/languages
```

```ts
const { languages } = await aegis.translation.languages()
languages // [{ code: 'en', name: 'English' }, ...] — 232 of them
```

Use `code` for `to` and `from`. This is a static list served from the `cheap`
class, so fetching it on startup costs you almost nothing.

## Cost

Translate and detect are in the `fetch` class because they call an upstream
service; the language list is `cheap`. See [rate limits](/rate-limits).