The Youdao Translate API (Youdao AI Cloud Translation Service) is NetEase Youdao's machine translation interface service for developers, supporting text translation, speech translation, image translation, and document translation. Whether you're an independent developer, startup team, or enterprise client, you can integrate Youdao's translation capabilities into your applications, websites, or workflows through simple HTTP API calls. This guide walks you through the entire process from registration to your first successful API call.
The Youdao Translate API provides HTTP endpoints for machine translation workflows. Supported languages, free quota, pricing, and model details can change, so developers should verify the current API documentation before implementation.
Registration & API Key Setup
Before using the Youdao Translate API, you need to register on the Youdao AI Cloud platform and create an application to obtain your API credentials:
Register an Account
Visit the Youdao AI Cloud website (ai.youdao.com) and register using your phone number or email address. Users with existing NetEase accounts can log in directly.
Create an Application
After logging in, navigate to the console and click "Create Application." Fill in the application name and description, then select the service types you need (text translation, speech translation, etc.).
Obtain API Credentials
Once the application is created, the system automatically generates an App ID and App Key (secret). These credentials are viewable on the application details page. Keep them secure and never expose them publicly.
Make Your First Call
Using your App ID and App Key, construct request parameters following the API documentation's signing rules and start making translation API calls.
Making API Calls
Request Parameters
The core text translation endpoint is https://openapi.youdao.com/api. The key request parameters are:
q— Text content to translate (UTF-8 encoded)from— Source language code (e.g.,zh-CHSfor Simplified Chinese,enfor English,autofor auto-detection)to— Target language codeappKey— Your Application IDsalt— A random string (UUID works well)sign— Request signature (SHA-256 hash of appKey + input + salt + curtime + appSecret)signType— Signature type, alwaysv3curtime— Current UTC timestamp in seconds
Python Example
Here's a complete Python example for calling the Youdao Translate API:
import hashlib
import uuid
import time
import requests
YOUDAO_URL = 'https://openapi.youdao.com/api'
APP_KEY = 'your_app_key'
APP_SECRET = 'your_app_secret'
def translate(text, from_lang='auto', to_lang='my'):
salt = str(uuid.uuid4())
curtime = str(int(time.time()))
sign_str = APP_KEY + truncate(text) + salt + curtime + APP_SECRET
sign = hashlib.sha256(sign_str.encode('utf-8')).hexdigest()
params = {
'q': text,
'from': from_lang,
'to': to_lang,
'appKey': APP_KEY,
'salt': salt,
'sign': sign,
'signType': 'v3',
'curtime': curtime,
}
response = requests.post(YOUDAO_URL, data=params)
return response.json()
def truncate(text):
if len(text) <= 20:
return text
return text[:10] + str(len(text)) + text[-10:]
result = translate('Hello, how are you?', 'en', 'zh-CHS')
print(result['translation']) Node.js Example
const crypto = require('crypto');
const axios = require('axios');
const { v4: uuidv4 } = require('uuid');
const APP_KEY = 'your_app_key';
const APP_SECRET = 'your_app_secret';
const API_URL = 'https://openapi.youdao.com/api';
function truncate(q) {
if (q.length <= 20) return q;
return q.substring(0, 10) + q.length + q.substring(q.length - 10);
}
async function translate(text, from = 'auto', to = 'zh-CHS') {
const salt = uuidv4();
const curtime = Math.round(Date.now() / 1000).toString();
const signStr = APP_KEY + truncate(text) + salt + curtime + APP_SECRET;
const sign = crypto.createHash('sha256').update(signStr).digest('hex');
const { data } = await axios.post(API_URL, null, {
params: { q: text, from, to, appKey: APP_KEY, salt, sign, signType: 'v3', curtime }
});
return data;
}
translate('Hello World').then(res => console.log(res.translation)); Pricing & Plans
The Youdao Translate API offers both pay-as-you-go and prepaid pricing:
- Free Tier: 1 million characters per month at no cost — perfect for individual developers and small projects
- Pay-as-You-Go: Beyond the free tier, text translation costs approximately $6.50 per million characters
- Prepaid Packages: prepaid packages and unit prices vary; check the current API pricing page before estimating cost
- Enterprise Custom: Organizations translating over 50 million characters monthly can contact sales for custom pricing
Speech translation, image translation, and document translation have separate pricing models — refer to the official Youdao AI Cloud documentation for details. The API console provides detailed usage statistics and billing breakdowns, making it easy to monitor and manage your consumption.
Developer Best Practices
- Secure Your Keys: Never hardcode App Key and App Secret in frontend code or public repositories. Use environment variables or a secret management service
- Rate Limiting: The API has per-second request limits (10 QPS on free tier). Implement request queuing and retry logic in your client
- Caching Strategy: Cache translation results locally for repeated content to reduce API calls and costs
- Error Handling: Always handle API error codes (e.g., 101 for missing parameters, 108 for rate limiting) to ensure application stability
- Batch Requests: For large volumes, combine text into single requests (respect the current per-request limit shown in the API documentation) to improve throughput