Gemini API

Gemini API, Gemini, Veo, Nano Banana वगैरह के साथ प्रॉम्प्ट से प्रोडक्शन तक पहुंचने का सबसे तेज़ तरीका है. इसकी मदद से, इन जनरेटिव मॉडल को अपने ऐप्लिकेशन में इंटिग्रेट किया जा सकता है. इससे टेक्स्ट और इमेज जनरेट करने, मल्टीमॉडल इनपुट का विश्लेषण करने, और बातचीत करने वाले एजेंट बनाने में मदद मिलती है.

Python

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-3.8-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.8-flash",
  input: "Explain how AI works in a few words",
});

console.log(interaction.output_text);

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateModelInteraction params =
    CreateModelInteraction.builder()
        .model(Model.of("gemini-3.7-flash"))
        .input(InteractionsInput.of("Explain how AI works in a few words"))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

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.8-flash",
    "input": "Explain how AI works in a few words"
  }'

मॉडल के बारे में जानकारी

सभी देखें

सुविधाओं के बारे में जानें

एजेंट बनाना

एजेंट बनाने और मैनेज करने की सुविधा, Gemini को एक ऐसा वर्कस्पेस देते हैं जहां वह खुद ही टास्क प्लान कर सकता है और उन्हें पूरा कर सकता है. एक ही अनुरोध में, Gemini कोड लिख सकता है और उसे चला सकता है. साथ ही, वेब पर खोज कर सकता है और होस्ट किए गए सैंडबॉक्स एनवायरमेंट में फ़ाइलें बना सकता है. पहले से तैयार किए गए हमारे Antigravity एजेंट का इस्तेमाल करें या अपने निर्देशों और टूल के हिसाब से इसे पसंद के मुताबिक़ बनाएँ.

Python

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    agent="antigravity-preview-09-2026",
    input=(
        "Research the top 5 sustainable fashion brands, "
        "compare their materials and pricing tiers, and "
        "build an interactive dashboard in analysis.html."
    ),
    environment="remote"
)

print(interaction.output_text)

JavaScript

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

const ai = new GoogleGenAI({});

const interaction = await ai.interactions.create({
  agent: "antigravity-preview-09-2026",
  input:
    "Research the top 5 sustainable fashion brands, " +
    "compare their materials and pricing tiers, and " +
    "build an interactive dashboard in analysis.html.",
  environment: "remote",
});

console.log(interaction.output_text);

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.CreateAgentInteractionEnvironment;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-09-2026"))
        .input(
            InteractionsInput.of(
                "Research the top 5 sustainable fashion brands, "
                    + "compare their materials and pricing tiers, and "
                    + "build an interactive dashboard in analysis.html."))
        .environment(CreateAgentInteractionEnvironment.of("remote"))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params))
        .interaction()
        .get();

System.out.println(interaction.outputText().orElse(""));

REST

curl -X POST \
  "https://generativelanguage.googleapis.com/v1beta/interactions" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "agent": "antigravity-preview-09-2026",
    "input": "Research the top 5 sustainable fashion brands, compare their materials and pricing tiers, and build an interactive dashboard in analysis.html.",
    "environment": "remote"
  }'

Interactions API

Interactions API, जून 2026 से हमारा डिफ़ॉल्ट इंटरफ़ेस बन गया है. आने वाले समय में, Gemini मॉडल और एजेंट के साथ काम करने का यह सबसे अच्छा तरीका है. अगर आपको कोई नया प्रोजेक्ट शुरू करना है, तो आपको Interactions API का इस्तेमाल करना चाहिए. generateContent एपीआई अब भी काम करता है, लेकिन इसे लेगसी माना जाता है.