请求头信息:
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Accept: application/json
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
text | string | 是 | 待翻译文本 |
source_lang | string | 是 | 源语言代码 |
target_lang | string | 是 | 目标语言代码(en-zh) |
domain | string | 否 | 领域(ecommerce/tech/general) |
curl -X POST "https://cross.cybermagi.space/api/v1/translate" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Hello, welcome to our store!", "target_lang": "en"}'
# Python 예제 코드
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://cross.cybermagi.space"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
data = {
"target": "en-zh"
}
response = requests.post(
f"{BASE_URL}/api/v1/translate",
json=data,
headers=headers
)
result = response.json()
print(result)
{
"success": true,
"data": {
"translated_text": "Translated text content here...",
"source_lang": "auto",
"target_lang": "en",
"confidence": 0.97,
"processing_time_ms": 320
},
"request_id": "req_translate_en-zh_ko_1"
}
点击返回主页,获取API密钥并在线测试