Overview
This guide walks you through obtaining and configuring a Google Translate API key for ShahiTranslate Pro.
Why You Need an API Key
Google Translate API allows ShahiTranslate Pro to automatically translate your content. Without an API key, you’ll be limited to manual translations only.
Benefits:
- Instant translation of all content
- Support for 130+ languages
- High-quality neural machine translation
- Scalable for large websites
- $20 per 1 million characters
- Free tier: $300 credit for new Google Cloud accounts
- Pay only for what you use
- Go to Google Cloud Console
- Sign In or Create Account
- Enter Billing Information
- Complete Account Setup
- Access Project Selector
- Create New Project
- Name Your Project
- Create Project
- Select Your Project
- Open API Library
- Search for Translation API
- Enable API
- Verify Enabled
- Open Credentials Page
- Create Credentials
- Copy API Key
- Click “Close”
- Edit API Key
- Application Restrictions
- API Restrictions
- Save Changes
- Go to Billing
- Create Budget Alert
- Configure Budget
- Set Alert Thresholds
- Save Budget
- Access Plugin Settings
- Enter API Key
- Choose API Version
- Configure Additional Settings
- Test API Key
- Save Settings
- Visit Your Site
- Switch Language
- Check Dashboard
- Check API Usage
- View Billing
- Charged per character translated
- $20 USD per 1 million characters
- Excludes spaces, HTML tags, and special characters
- Minimum charge: $0 (no minimum)
- 50 posts
- 500 words per post = 25,000 total words
- ~150,000 characters
- 3 languages
- Total: 450,000 characters
- Cost: ~$9 one-time
- 200 pages
- 1000 words per page = 200,000 words
- ~1,200,000 characters
- 5 languages
- Total: 6,000,000 characters
- Cost: ~$120 one-time
- 1000 pages
- 800 words average = 800,000 words
- ~4,800,000 characters
- 5 languages
- Total: 24,000,000 characters
- Cost: ~$480 one-time
- Enable Aggressive Caching
- Translate Selectively
- Use Manual for Key Pages
- Translation Memory
- Limit Languages
- Key copied incorrectly (extra spaces, incomplete)
- API not enabled in Google Cloud Console
- Restrictions too strict
- Copy API key again carefully
- Verify Cloud Translation API is enabled
- Check API key restrictions (temporarily remove all restrictions to test)
- Create new API key
- Check Google Cloud Console → Quotas
- Enable billing if on free tier
- Increase quota if possible
- Wait for quota reset (usually daily)
- Edit API key in Google Cloud Console
- Add your site URL to HTTP referrer restrictions
- Or temporarily disable restrictions to test
- Wait 5 minutes for restrictions to update
- Go to Google Cloud Console → Billing → Reports
- Filter by Cloud Translation API
- See detailed usage breakdown
- Cache not working (translations repeat)
- Many languages activated
- Dynamic content being translated repeatedly
- No exclusions set (translating everything)
- Enable and verify cache is working
- Set up exclusions for unnecessary content
- Limit active languages
- Use manual translation for frequently changing content
- Never share your API key publicly
- Don’t commit API key to GitHub or version control
- Use environment variables or wp-config.php for storage
- Restrict API key to your domain only
- Rotate API keys periodically (annually)
- Enable caching (reduces API calls by 90%+)
- Use V2 API unless you need V3 features (faster)
- Batch translations when possible
- Monitor usage to catch issues early
- Set budget alerts at $25, $50, $100 or your limits
- Review monthly usage in Google Cloud Console
- Enable cache warming for predictable costs
- Use manual translation for high-traffic pages
- More secure than API keys
- Better for server-to-server communication
- Supports more advanced features
- Create Service Account in Google Cloud
- Download JSON key file
- Grant “Cloud Translation API User” role
- Upload JSON key to plugin settings
- Quick Start Guide
- Translation Methods
- Improving Translation Quality
- Translation Cache
- Google Cloud Support: https://cloud.google.com/support
- Google Cloud Documentation: https://cloud.google.com/translate/docs
- ShahiTranslate Pro Support: Through your account dashboard
Costs:
Step-by-Step Setup
Step 1: Create Google Cloud Account
– Visit: https://console.cloud.google.com/
– Click “Get started for free” or “Sign in”
– Use existing Google account or create new one
– Accept terms of service
– Required even for free tier
– No charges without explicit approval
– You’ll get $300 free credit for 90 days
– Enter your country
– Agree to terms
– Click “Start my free trial” or “Activate”
Step 2: Create a New Project
– Click the project dropdown at top of page
– Next to “Google Cloud Platform” logo
– Click “New Project” button
– Or use existing project if you have one
– Enter name: e.g., “My Website Translation”
– Project ID: auto-generated (can customize)
– Organization: Leave as “No organization” (unless you have one)
– Click “Create” button
– Wait for project creation (10-30 seconds)
– Ensure new project is selected in dropdown
– You’ll see project name at top of page
Step 3: Enable Cloud Translation API
– Click “☰” menu (hamburger icon, top-left)
– Select “APIs & Services” → “Library”
– Or visit: https://console.cloud.google.com/apis/library
– In search box, type “Cloud Translation API”
– Click on “Cloud Translation API” from results
– Click “Enable” button
– Wait for activation (few seconds)
– You’ll see “API enabled” message
– Go to “APIs & Services” → “Dashboard”
– You should see “Cloud Translation API” in the list
Step 4: Create API Key
– Click “☰” menu → “APIs & Services” → “Credentials”
– Or visit: https://console.cloud.google.com/apis/credentials
– Click “+ CREATE CREDENTIALS” at top
– Select “API key” from dropdown
– A popup appears with your new API key
– Click “Copy” button or manually copy the key
– Important: Save this key securely!
– It looks like: AIzaSyABCD1234567890EFGHIJ_KLMNOPqrstuv
– You can always view the key later in Credentials page
Step 5: Restrict API Key (Recommended)
For security, restrict what your API key can do:
– In Credentials page, click on your newly created API key
– Or click the ✏️ edit icon
– Choose “HTTP referrers (web sites)”
– Click “Add an item”
– Enter your website URLs:
– https://yourwebsite.com/*
– https://www.yourwebsite.com/*
– Add staging site if you have one
– Choose “Restrict key”
– Select “Cloud Translation API” from list
– Uncheck everything else
– Click “Save” button at bottom
– Restrictions take a few minutes to apply
Step 6: Set Up Billing Alerts
To avoid unexpected charges:
– Click “☰” menu → “Billing”
– Select your billing account
– Click “Budgets & alerts” in left sidebar
– Click “+ CREATE BUDGET”
– Name: “Translation API Budget”
– Projects: Select your project
– Services: Select “Cloud Translation API”
– Amount: $25 or your preferred limit
– 50% of budget
– 90% of budget
– 100% of budget
– Enter your email for notifications
– Click “Finish”
– You’ll receive email alerts at set thresholds
Step 7: Add API Key to ShahiTranslate Pro
– In WordPress admin, go to “ShahiTranslate Pro” → “Settings”
– Click “API Settings” tab
– Paste your API key in “Google Translate API Key” field
– The key you copied in Step 4
– V2 (Basic): Standard translation, faster, cheaper
– V3 (Advanced): Better quality, more features, slightly more expensive
– Recommended: Start with V2
– Format: HTML (preserves formatting) or Text (plain text)
– Model: Leave as default unless you have specific needs
– Click “Test API Connection” button
– Should see “Connection successful” message
– If error, double-check API key and that API is enabled
– Click “Save Changes” button
– API key is now active
Verifying Setup
Test Translation
– Go to your website’s front end
– Look for the language switcher
– Click switcher and select a language
– Page should reload with translated content
– Go to ShahiTranslate Pro → Dashboard
– Look at “API Usage” section
– Should show recent API calls
Monitor Google Cloud Console
– Go to Google Cloud Console
– APIs & Services → Dashboard
– Click “Cloud Translation API”
– View usage metrics and quotas
– Go to Billing → Transactions
– See charges for API usage
– Remember: $20 per 1 million characters
Understanding Costs
How Charging Works
Example Calculations
Small Blog:
Medium Site:
Large Site:
Note: With caching enabled (recommended), you pay only once for translation. Subsequent visitors see cached translations at no cost.
Reducing Costs
– Cache for 90 days or permanent
– Reduces repeat translation costs to zero
– Only translate published content
– Exclude comments, archives, search results
– Translate important pages manually
– Use automatic for less critical content
– Reuses common phrases automatically
– Included in plugin, no extra cost
– Only activate languages you truly need
– Each language multiplies character count
Troubleshooting
“API Key Invalid” Error
Causes:
Solutions:
“Quota Exceeded” Error
Cause: Reached free tier limit or set quota
Solutions:
“Authentication Failed” Error
Cause: API key restrictions blocking your site
Solutions:
Charges Higher Than Expected
Check:
Common Causes:
Solutions:
Best Practices
Security
Performance
Cost Management
Alternative: Google Cloud Service Account
For advanced users or high-volume sites:
Benefits
Setup (Brief Overview)
Note: Service accounts are more complex. Use API keys unless you have specific needs.
Next Steps
Now that your API key is set up:
Need Help?
Share this article
Still need help?
Our support team is ready to assist you with personalized guidance for your workspace.