Ever struggled with Chinese document processing? Between expensive services and complex SDKs, it's a pain. Let me show you how GoldBean API handles this in 10 lines of Python.
What You'll Need
- A GoldBean API key (free tier: 1000 requests/month)
- Python 3.7+
- An image URL or local file with Chinese text
Step 1: OCR (Extract Chinese Text)
import requests
API_BASE = "https://goldbean-api.xyz/paid"
API_KEY = "your-key-here" # Get yours at https://goldbean-api.xyz
# OCR an image with Chinese text
image_url = "https://example.com/chinese-doc.jpg"
ocr_resp = requests.post(f"{API_BASE}/ocr", json={
"image_url": image_url,
"api_key": API_KEY
}).json()
chinese_text = ocr_resp.get("text", "")
print(f"Extracted: {chinese_text[:200]}...")
Step 2: Translate (Chinese → English)
# Translate the extracted Chinese text
translation = requests.post(f"{API_BASE}/translate", json={
"text": chinese_text,
"source": "zh",
"target": "en",
"api_key": API_KEY
}).json()
english_text = translation.get("translated_text", "")
print(f"Translated: {english_text[:200]}...")
Step 3: TTS (Read It Aloud)
# Convert Chinese text to speech
tts = requests.post(f"{API_BASE}/tts", json={
"text": chinese_text,
"voice": "baidu-zh",
"api_key": API_KEY
}).json()
print(f"Audio URL: {tts.get('audio_url')}")
Full Pipeline in One Script
import requests
def process_chinese_doc(image_url, api_key):
base = "https://goldbean-api.xyz/paid"
headers = {"Content-Type": "application/json"}
# OCR
ocr = requests.post(f"{base}/ocr", json={"image_url": image_url, "api_key": api_key}).json()
text = ocr.get("text", "")
# Translate
trans = requests.post(f"{base}/translate", json={"text": text, "source": "zh", "target": "en", "api_key": api_key}).json()
# Analyze sentiment
sentiment = requests.post(f"{base}/sentiment", json={"text": text, "api_key": api_key}).json()
return {
"original_text": text[:500],
"translation": trans.get("translated_text", ""),
"sentiment": sentiment.get("sentiment", "unknown")
}
# Try it with a sample
result = process_chinese_doc("https://i.imgur.com/sample-chinese-doc.jpg", "YOUR_API_KEY")
print(json.dumps(result, indent=2, ensure_ascii=False))
Why GoldBean?
| Feature | GoldBean | Baidu Direct |
|---|---|---|
| Pricing | $0.01/call | $100 deposit + usage |
| Payment | Pay-as-you-go | Prepaid account |
| Setup | API key only | SDK + auth |
| Free tier | 1000 req/month | None |
Try it: https://goldbean-api.xyz/docs
GoldBean — $0.01 per call, no monthly fees, no deposits. 120+ endpoints in 26 categories.
💡 Have you tried GoldBean? Get 50 free API calls/day at goldbean-api.xyz — no credit card needed. Questions? Drop a comment below!
🫘 GoldBean — Pay-per-Use AI API Marketplace. Wishing You Good Fortune & Prosperity.
Top comments (0)