translate
Write correct Sarvam translation code (sarvam-translate:v1, mayura:v1) — mode/script/numeral options and silent parameter failures. Use this skill when building translation or localization features in Python or JS/TS. For live translate/localize in chat via MCP, use sarvam-mcp instead.
How do I install this agent skill?
npx skills add https://github.com/sarvamai/skills --skill translateIs this agent skill safe to install?
- Gen Agent Trust Hubpass
This skill provides documentation and code examples for using Sarvam AI's translation SDKs. It is a benign educational resource with no security risks detected.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
- Runlayerpass
1/2 files flagged
What does this agent skill do?
Translation — Sarvam AI
Live in-chat translate/localize → sarvam-mcp (
sarvam_tools_translate/_localize). This skill = SDK code.
[!IMPORTANT] Auth:
api-subscription-keyheader — NOTAuthorization: Bearer. Base URL:https://api.sarvam.ai(NOT/v1— that prefix is only for the OpenAI-compatible chat endpoint)
Models
| Model | Max Input | Languages | Features |
|---|---|---|---|
sarvam-translate:v1 | 2,000 chars | 23 (22 Indian + English) | mode (formal only), speaker_gender, numerals_format |
mayura:v1 | 1,000 chars | 11 (10 Indian + English) | All mode values, output_script, speaker_gender, numerals_format, auto source detection |
Quick Start (Python)
from sarvamai import SarvamAI
client = SarvamAI()
response = client.text.translate(
input="Hello, how are you?",
source_language_code="en-IN",
target_language_code="hi-IN",
model="sarvam-translate:v1"
)
print(response.translated_text)
Quick Start (JavaScript/TypeScript)
import { SarvamAIClient } from "sarvamai";
const client = new SarvamAIClient({ apiSubscriptionKey: "YOUR_SARVAM_API_KEY" });
const response = await client.text.translate({
input: "Hello, how are you?",
source_language_code: "en-IN",
target_language_code: "hi-IN",
model: "sarvam-translate:v1"
});
console.log(response.translated_text);
Gotchas
| Gotcha | Detail |
|---|---|
| Method name | Both Python & JS: client.text.translate({...}) — NOT client.translate.translate(). Same text namespace in both SDKs. |
output_script on sarvam-translate | NOT supported — only works with mayura:v1 (roman, fully-native, spoken-form-in-native). Silently ignored on sarvam-translate:v1. |
mode values | sarvam-translate:v1 supports formal only. Colloquial modes (modern-colloquial, classic-colloquial, code-mixed) are mayura:v1 only. speaker_gender works on BOTH models. |
| Auto language detection | source_language_code="auto" only works with mayura:v1. sarvam-translate:v1 requires an explicit source language. |
| Odia language code | od-IN — NOT or-IN. |
| Character limits | Exceeding returns 422. Split long text at sentence boundaries. |
Full Docs
Fetch language codes, mode examples, script options, and numeral formats from:
- https://docs.sarvam.ai/llms.txt — comprehensive docs index
- Translation Guide
- Rate Limits
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/sarvamai/skills/translate">View translate on skillZs</a>