Build with the Gemini API
Easily integrate Google’s largest and most capable AI model to your apps
Available now
2 million tokens
Explore our longest context window yet in Gemini 1.5 Pro. Build and experiment with the Gemini API in Google AI Studio.
Multiple Gemini sizes
for unmatched versatility
Integrate 1.5 Flash into your app with the Gemini API
It's fast and free to start building with Gemini models in Google AI Studio
import google.generativeai as genai
import PIL.Image
import os
genai.configure(api_key=os.environ["GOOGLE_API_KEY"])
img = PIL.Image.open('path/to/image.png')
model = genai.GenerativeModel(model_name="gemini-1.5-flash")
response = model.generate_content(["What is in this photo?", img])
print(response.text)
const { GoogleGenerativeAI } = require("@google/generative-ai");
const fs = require("fs");
const genAI = new GoogleGenerativeAI(process.env.GOOGLE_API_KEY);
async function run() {
const model = genAI.getGenerativeModel({ model: "gemini-1.5-flash"});
const result = await model.generateContent([
"What is in this photo?",
{inlineData: {data: Buffer.from(fs.readFileSync('path/to/image.png')).toString("base64"),
mimeType: 'image/png'}}]
);
console.log(result.response.text());
}
run();
curl https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=${GOOGLE_API_KEY} \
-H 'Content-Type: application/json' \
-d '{
"contents":[{
"parts":[
{"text": "What is this picture?"},
{"inline_data": {
"mime_type":"image/png",
"data": "'"$(base64 -i 'path/to/image/image.png')"'"
}}
]}
]
}'
import "github.com/google/generative-ai-go/genai"
import "google.golang.org/api/option"
ctx := context.Background()
client, err := genai.NewClient(ctx, option.WithAPIKey(os.Getenv("GOOGLE_API_KEY")))
model := client.GenerativeModel("gemini-1.5-flash")
resp, err := model.GenerateContent(
ctx,
genai.Text("What's in this photo?"),
genai.ImageData("jpeg", imgData))
val model = GenerativeModel("gemini-1.5-flash")
val response = model.generateContent(content {
text("What's in this photo?")
image(ingredientsBitmap)
})
let model = GenerativeModel(name: "gemini-1.5-flash")
let response = try await model.generateContent("What's in this photo?", image)
final model = GenerativeModel(model: "gemini-1.5-flash", apiKey: apiKey);
final response = await model.generateContent([
Content.text("What's in this photo?"),
Content.data("image/png", imageBytes),
]);
Enterprise-ready AI
Create agents grounded with your data
Each Gemini model is built for its own set of use cases, making a versatile model family that runs efficiently on everything from data centers to on-device.
Build enterprise-grade AI
Integrate AI models into your services with Google Cloud's robust security, privacy, and compliance framework.
Gemini developer ecosystem
Google tools
Partners
Gemini Nano
Android AICore enables powerful phones to run Gemini Nano, making it easy for you to build on-device AI experiences that use sensitive info or need to work even when the device is offline.
AVAILABLE ON PIXEL 8 PRO AND SAMSUNG S24 SERIES, WITH MORE COMING SOON
![Android character](/https/ai.google.dev/static/images/droid-full.png)