Google Cloud Natural Language API
Google Cloud Natural Language API
Google Cloud's text-understanding API: sentiment, entities, syntax, classification, and moderation across 7 endpoints, billed per Unicode character
Seven endpoints cover the text-understanding stack: analyzeSentiment, analyzeEntities, analyzeEntitySentiment, analyzeSyntax, classifyText, moderateText, and annotateText (returns multiple features in one call but bills as if each were called separately)
Billing rounds up by character: standard endpoints bill per 1,000 Unicode characters (whitespace and HTML markup counted), ModerateText per 100. High-frequency short-text traffic costs more than per-request estimates suggest, a typical gotcha when migrating from per-call pricing
Open cloud.google.com/natural-language, enable the Cloud Natural Language API on your GCP project, and link a billing account. Authenticate locally with `gcloud auth application-default login` (ADC), or drop a service account JSON for CI/CD. Install the google-cloud-language package (same name for Node.js and Python) and call analyzeSentiment first to verify character-based billing behavior under your traffic shape.
Uptime · 30-day window
About this API
Cloud Natural Language API is Google Cloud's text-understanding service, exposing seven endpoints. analyzeSentiment returns document-level and sentence-level scores (score from -1.0 to +1.0 plus magnitude). analyzeEntities identifies ten entity types (PERSON, ORGANIZATION, LOCATION, EVENT, WORK_OF_ART, CONSUMER_GOOD, and more) and resolves Wikipedia links where available. analyzeEntitySentiment combines the two, attaching sentiment to each entity mention. analyzeSyntax returns dependency parses, POS tags, and lemma forms. classifyText assigns one of 700+ content categories (a v2 long-form model is available for documents that exceed the v1 length limit). moderateText flags 16 harm categories such as toxicity, insult, violence, and sexual content for UGC moderation pipelines. annotateText returns multiple features in one request but bills as if each were called separately. Billing is character-based: standard endpoints round to the nearest 1,000 Unicode characters per request (moderateText uses 100), with whitespace and HTML markup counted. The free tier covers the first 5,000 units per month for standard features, 30,000 for classifyText, and 50,000 for moderateText. Volume tiers cut cost notably at scale: sentiment runs $0.0010 per 1,000 chars from 5K to 1M units, then $0.000500 from 1M to 5M, then $0.000250 above 5M. Default project quotas cap at 600 requests per minute and 800,000 per day, with a 1,000,000-byte per-request ceiling. Higher-throughput workloads require a Cloud Quotas adjustment. Authentication uses Google Cloud's standard stack: Application Default Credentials, service account JSON keys, or OAuth bearer tokens. Eight official client libraries are maintained in separate googleapis/{lang} repos: C++, C#, Go, Java, Node.js, PHP, Python, Ruby. The caveat for cost planning is that short-text high-frequency workloads pay the per-1K-char rounding penalty. A 200-char API ping still bills one full unit, so batch where you can.
What you can build
- 1Batch sentiment scoring of user reviews, support tickets, or social posts (returns score -1.0 to +1.0 plus magnitude)
- 2Entity extraction from contracts, news, or email across ten types (PERSON, ORGANIZATION, LOCATION, EVENT, WORK_OF_ART, CONSUMER_GOOD, and more) with Wikipedia / MID metadata resolution
- 3Content classification across 700+ categories for knowledge-base tagging, or ModerateText across 16 harm categories (toxicity, insult, violence, sexual, and others) for UGC pipelines
Strengths & limitations
Strengths
- Seven endpoints cover the text-understanding stack: analyzeSentiment, analyzeEntities, analyzeEntitySentiment, analyzeSyntax, classifyText, moderateText, and annotateText (returns multiple features in one call but bills as if each were called separately)
- Volume pricing drops sharply at scale: sentiment runs $0.0010 per 1,000 chars from 5K to 1M units, then $0.000500 from 1M to 5M, then $0.000250 above 5M
- First-class Google Cloud auth (ADC, service account JSON, OAuth bearer) with eight official client libraries: C++, C#, Go, Java, Node.js, PHP, Python, Ruby
Limitations
- Billing rounds up by character: standard endpoints bill per 1,000 Unicode characters (whitespace and HTML markup counted), ModerateText per 100. High-frequency short-text traffic costs more than per-request estimates suggest, a typical gotcha when migrating from per-call pricing
- Default project quotas cap at 600 requests/minute, 800,000/day, with a 1,000,000-byte per-request ceiling. High-concurrency workloads need a Cloud Quotas adjustment before launch
- No single official GitHub repo. Each SDK lives in its own googleapis/{lang} repository, so issue tracking and version pinning fragment across eight repos
Official quickstart
Read the official quickstart at cloud.google.com.
Getting started
Open cloud.google.com/natural-language, enable the Cloud Natural Language API on your GCP project, and link a billing account. Authenticate locally with `gcloud auth application-default login` (ADC), or drop a service account JSON for CI/CD. Install the google-cloud-language package (same name for Node.js and Python) and call analyzeSentiment first to verify character-based billing behavior under your traffic shape.
FAQ
Does Google Cloud Natural Language API have a free tier?+
Yes. Each feature has its own monthly free quota: analyzeEntities, analyzeSentiment, analyzeEntitySentiment, and analyzeSyntax each get 5,000 units per month; classifyText gets 30,000; moderateText gets 50,000. A unit is 1,000 Unicode characters (100 for moderateText), with whitespace and HTML markup counted. Beyond the free tier, billing follows volume tiers.
How does it relate to Vertex AI / Gemini API?+
Cloud Natural Language API is a classical-ML endpoint for structured text tasks (sentiment, entities, syntax, classification, moderation) with fixed JSON output, stable latency, and character-based billing. Vertex AI and the Gemini API run generative models that accept open-ended instructions but bill by token and produce unstructured output. Pick Natural Language API for predictable schemas and cost; pick Gemini for flexible reasoning.
How does authentication work?+
Application Default Credentials (ADC) is the recommended path. Run `gcloud auth application-default login` locally; drop a service account JSON for CI/CD. All eight official client libraries (C++, C#, Go, Java, Node.js, PHP, Python, Ruby) default to ADC, so no manual OAuth flow is needed.
Technical details
- Auth type
- oauth
- Pricing
- freemium
- Rate limit
- Default project quota: 600 requests/minute, 800,000 requests/day; max 1,000,000 bytes per request
- Free tier quota
- Per-feature monthly free units: 5,000 for AnalyzeEntities / AnalyzeSentiment / AnalyzeEntitySentiment / AnalyzeSyntax; 30,000 for ClassifyText; 50,000 for ModerateText. Unit = 1,000 Unicode chars (100 for ModerateText), whitespace and HTML markup included
- Protocols
- REST, gRPC
- SDKs
- C++, C#, Go, Java, Node.js, PHP, Python, Ruby