Gemini API

Bạn nên sử dụng Interactions API cho tất cả các dự án mới. Đây là một thư viện được tối ưu hoá cho quy trình làm việc dựa trên trợ lý AI, quản lý trạng thái và các mô hình mới nhất. Tìm hiểu thêm trong bài viết Tổng quan về Interactions API.

Con đường nhanh nhất từ câu lệnh đến sản phẩm nhờ Gemini, Veo, Nano Banana và nhiều công cụ khác.

Python

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-3.5-flash",
    input="Explain how AI works in a few words"
)

print(interaction.output_text)

JavaScript

import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI({});

const interaction = await ai.interactions.create({
  model: "gemini-3.5-flash",
  input: "Explain how AI works in a few words",
});

console.log(interaction.output_text);

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gemini-3.5-flash",
    "input": "Explain how AI works in a few words"
  }'
Bắt đầu xây dựng

Hãy làm theo hướng dẫn Bắt đầu nhanh của chúng tôi để lấy khoá API và thực hiện lệnh gọi API đầu tiên chỉ trong vài phút.


Làm quen với các mô hình

Xem tất cả

Khám phá các khả năng