Gemini

API Reference

Complete documentation for integrating with Gemini's multimodal API endpoints, authentication, and usage examples.

Getting Started

Base URL
https://api.gemini.google.com/v1
12+
Supported APIs
0.82s
Avg. Response Time
99.9%
Uptime

Available Endpoints

Endpoints List

Endpoint Method Description
/v1/completion POST Generate text completions based on prompts
/v1/codegen POST Create production-ready code from natural language
/v1/image POST Generate images and edit existing media
/v1/summarize POST Extract key points from text content
/v1/search GET Query structured information from any input

Authentication

Request Headers

{`curl -X POST https://api.gemini.com/v1/completion \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"Write an article about AI in manufacturing"}'`}
        

Bearer Token

All endpoints require a valid Bearer token in the Authorization header. Get your key from the Developer Console

Security

  • Store keys securely - never in Git/GitHub
  • Rotate keys every 30 days

Usage Examples

Text Completion

{`curl -X POST https://api.gemini.com/v1/completion \\
  -H "Authorization: Bearer your_api_key" \\
  -H "Content-Type: application/json" \\
  -d '{ \\
      "prompt": "Explain quantum computing in simple terms", \\
      "temperature": 0.7 \\
    }'`}
          
Copy & Run

Code Generation

{`curl -X POST https://api.gemini.com/v1/codegen \\
  -H "Authorization: Bearer your_api_key" \\
  -H "Content-Type: application/json" \\
  -d '{ \\
      "prompt": "Create a React component for a contact form", \\
      "language": "tsx" \\
    }'`}
          
Try Example

Image Generation

{`curl -X POST https://api.gemini.com/v1/image \\
  -H "Authorization: Bearer your_api_key" \\
  -H "Content-Type: application/json" \\
  -d '{ \\
      "prompt": "Cyberpunk city at night with floating cars", \\
      "resolution": "2048x2048" \\
    }'`}
          
View Results

Content Summarization

{`curl -X POST https://api.gemini.com/v1/summarize \\
  -H "Authorization: Bearer your_api_key" \\
  -H "Content-Type: application/json" \\
  -d '{ \\
      "content": "Paste your long article here...", \\
      "max_length": 200 \\
    }'`}
          
Try Summarizer

Rate Limits

Available Tier

Tier Requests/Minute Cost
Free 50/minute Free
Developer 1000/minute $0.01 per 1000 requests
Enterprise 5000/minute+ Contact sales

429 Handling

When rate limits are exceeded, the API returns a 429 Too Many Requests response with retry-after header

HTTP/1.1 429 Too Many Requests
Retry-After 180 X-RateLimit-Remaining 32 X-RateLimit-Limit 50

Error Codes

Code Description Solution
400 Bad Request Valid JSON formatting issues
401 Unauthorized Invalid or missing API key
404 Not Found Invalid endpoint path
429 Too Many Requests Rate limit exceeded
500 Internal Error General server failure

Integrate Gemini into Your App Now

With secure authentication, low-latency responses, and modern API design - get started for free today.

Get API Key