TensaHub › Google AI Studio (Gemini)

Google AI Studio (Gemini) · gemini-2.5-flash

API for the model gemini-2.5-flash at Google AI Studio (Gemini), pricing at the provider. curl, Python and JavaScript samples, live testing.

Test and rate in the catalog

Free tier with rate limits.

Type
Model
Provider
Google AI Studio (Gemini)
Model ID
gemini-2.5-flash
Pricing
Free + paid
Keyless access
No
Key variable
GEMINI_API_KEY
Base URL (OpenAI-compatible)
https://generativelanguage.googleapis.com/v1beta/openai
Inputs
Text
Developer rating
Not rated yet
Documentation
https://ai.google.dev/pricing

Code samples

cURL

curl https://generativelanguage.googleapis.com/v1beta/openai/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $GEMINI_API_KEY" \
  -d '{"model":"gemini-2.5-flash","messages":[{"role":"user","content":"Hello, introduce yourself in one sentence."}]}'

Python

# pip install openai
import os
from openai import OpenAI

client = OpenAI(base_url="https://generativelanguage.googleapis.com/v1beta/openai", api_key=os.environ["GEMINI_API_KEY"])
r = client.chat.completions.create(
    model="gemini-2.5-flash",
    messages=[{"role": "user", "content": "Hello, introduce yourself in one sentence."}],
)
print(r.choices[0].message.content)

JavaScript

// npm install openai
import OpenAI from 'openai'

const client = new OpenAI({ baseURL: 'https://generativelanguage.googleapis.com/v1beta/openai', apiKey: process.env.GEMINI_API_KEY })
const r = await client.chat.completions.create({
  model: 'gemini-2.5-flash',
  messages: [{ role: 'user', content: 'Hello, introduce yourself in one sentence.' }],
})
console.log(r.choices[0].message.content)

Generate the integration code →

Popular searches

Frequently asked questions

Is the Google AI Studio (Gemini) · gemini-2.5-flash API free?

Google AI Studio (Gemini) · gemini-2.5-flash offers a limited free tier; beyond it, usage is paid.

How do I call Google AI Studio (Gemini) · gemini-2.5-flash from my code?

Google AI Studio (Gemini) · gemini-2.5-flash exposes an OpenAI-compatible API at https://generativelanguage.googleapis.com/v1beta/openai: use any OpenAI SDK (Python, JavaScript…) with this base URL. Model identifier: gemini-2.5-flash. Ready-to-use code (streaming, JSON, retries) is available in the developer toolkit.