Skip to main content

Migrate from Google Translate API to Langbly

Langbly is a drop-in replacement for Google Translate v2. Same request format, same response format. Migration typically takes under 10 minutes.

Why Migrate?

Google TranslateLangbly
Price/1M chars$20$3.80–$1.99
QualityNMT (2020)Context-aware
Context-awareNoYes
CachingNo7-day built-in
Auth securityAPI key in URLBearer token
Free tier$300 credit (expires)500K/mo (forever)

Migration Steps

Step 1: Get a Langbly API Key

  1. Sign up at langbly.com/signup (free, no credit card)
  2. Create an API key in your dashboard
  3. Test it works:
curl -X POST https://api.langbly.com/language/translate/v2 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"q": "Hello world", "target": "nl"}'

Step 2: Update the URL

Change the API endpoint in your code:

- POST https://translation.googleapis.com/language/translate/v2?key=GOOGLE_KEY
+ POST https://api.langbly.com/language/translate/v2

Step 3: Update Authentication

Google uses the API key as a URL parameter. Langbly uses a Bearer token in the Authorization header:

- GET /language/translate/v2?key=GOOGLE_API_KEY&q=Hello&target=nl
+ POST /language/translate/v2
+ Authorization: Bearer LANGBLY_API_KEY
+ Content-Type: application/json
+ {"q": "Hello", "target": "nl"}

Step 4: That's It!

The request body and response format are identical:

Request body (same):

{
"q": "Hello world",
"target": "nl",
"source": "en",
"format": "text"
}

Response (same):

{
"data": {
"translations": [
{
"translatedText": "Hallo wereld",
"detectedSourceLanguage": "en"
}
]
}
}

Language-Specific Migration

Python

# Before (Google)
from google.cloud import translate_v2 as translate
client = translate.Client()
result = client.translate("Hello", target_language="nl")
print(result["translatedText"])

# After (Langbly)
from langbly import Langbly
client = Langbly(api_key="your-key")
result = client.translate(q="Hello", target="nl")
print(result.translated_text)

Node.js / TypeScript

// Before (Google)
import { v2 } from '@google-cloud/translate';
const client = new v2.Translate({ key: 'GOOGLE_KEY' });
const [translation] = await client.translate('Hello', 'nl');

// After (Langbly)
import { Langbly } from 'langbly';
const client = new Langbly({ apiKey: 'your-key' });
const result = await client.translate({ q: 'Hello', target: 'nl' });

cURL / Raw HTTP

# Before (Google)
curl "https://translation.googleapis.com/language/translate/v2?key=GOOGLE_KEY" \
-d "q=Hello&target=nl&source=en"

# After (Langbly)
curl -X POST "https://api.langbly.com/language/translate/v2" \
-H "Authorization: Bearer LANGBLY_KEY" \
-H "Content-Type: application/json" \
-d '{"q": "Hello", "target": "nl", "source": "en"}'

PHP

// Before (Google)
$url = "https://translation.googleapis.com/language/translate/v2?key=" . GOOGLE_KEY;
$response = wp_remote_post($url, ['body' => ['q' => 'Hello', 'target' => 'nl']]);

// After (Langbly)
$response = wp_remote_post("https://api.langbly.com/language/translate/v2", [
'headers' => ['Authorization' => 'Bearer ' . LANGBLY_KEY, 'Content-Type' => 'application/json'],
'body' => json_encode(['q' => 'Hello', 'target' => 'nl']),
]);

What's the Same

  • q parameter (string or array of strings)
  • target parameter (ISO 639-1 language code)
  • source parameter (optional, auto-detect if omitted)
  • format parameter (text or html)
  • Response structure: data.translations[].translatedText
  • Batch requests (multiple q values)
  • HTML tag preservation

What's Different

FeatureGoogleLangbly
Auth?key= in URLAuthorization: Bearer header
MethodGET or POSTPOST only
Content-Typeform-urlencodedJSON
CachingNone7-day built-in
FormalityNot supportedformality parameter
Rate limitsPer projectPer key + plan

Testing Your Migration

1. Side-by-Side Comparison

Run both APIs with the same input and compare output:

# Google
curl -s "https://translation.googleapis.com/language/translate/v2?key=$GOOGLE_KEY" \
-d "q=The meeting is at 3:30 PM on 12/25/2026&target=nl" | jq .

# Langbly
curl -s -X POST "https://api.langbly.com/language/translate/v2" \
-H "Authorization: Bearer $LANGBLY_KEY" \
-H "Content-Type: application/json" \
-d '{"q": "The meeting is at 3:30 PM on 12/25/2026", "target": "nl"}' | jq .

2. Verify HTML Preservation

curl -s -X POST "https://api.langbly.com/language/translate/v2" \
-H "Authorization: Bearer $LANGBLY_KEY" \
-H "Content-Type: application/json" \
-d '{"q": "<p>Click <a href=\"/shop\">here</a> to continue</p>", "target": "nl", "format": "html"}' | jq .

3. Test Error Handling

# Invalid key - should return 401
curl -s -X POST "https://api.langbly.com/language/translate/v2" \
-H "Authorization: Bearer invalid-key" \
-H "Content-Type: application/json" \
-d '{"q": "Hello", "target": "nl"}' | jq .

Rollback Plan

Since Langbly is a drop-in replacement, rolling back is just as easy: change the URL back to Google's endpoint and switch to the API key auth. We recommend running both in parallel for a week before fully switching.

FAQ

Will the translation quality be the same?

Langbly typically produces better quality, especially for European languages. It uses context-aware translation with custom locale rules for Dutch and formality control.

Are all Google Translate language codes supported?

Langbly supports 100+ languages using the same ISO 639-1 codes. All common languages are supported. Some rare languages may not be available, so check the supported languages endpoint.

What about the model parameter?

Google Translate's model parameter (nmt/base) is accepted but ignored. Langbly always uses its best translation model.

Next Steps