Gemini API

Gemini API

Gemini API는 Gemini, Veo, Nano Banana 등을 프롬프트에서 프로덕션까지 가장 빠르게 이어주는 경로예요. 이런 생성형 모델을 애플리케이션에 통합해 텍스트·이미지를 생성하고, 멀티모달 입력을 분석하고, 대화형 에이전트를 만들 수 있어요.

출처: 원문

본문

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(""));

Go

package main

import (
    "context"
    "fmt"
    "log"

    "google.golang.org/genai"
    "google.golang.org/genai/interactions/models/interactions"
    "google.golang.org/genai/interactions/models/operations"
)

func main() {
    ctx := context.Background()
    client, err := genai.NewClient(ctx, nil)
    if err != nil {
        log.Fatal(err)
    }

    res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
        Body: operations.NewCreateInteractionRequestBody(interactions.CreateModelInteraction{
            Model: interactions.Model("gemini-3.8-flash"),
            Input: interactions.NewInteractionsInput("Explain how AI works in a few words"),
        }),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Interaction.OutputText != nil {
        fmt.Println(*res.Interaction.OutputText)
    }
}

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
  -H "x-goog-api-key: *** \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gemini-3.8-flash",
    "input": "Explain how AI works in a few words"
  }'

시작하기 · API 키 만들기


모델 만나기

전체 보기

  • Gemini 3.8 Flash (New) — 장기 소프트웨어 엔지니어링, 자율 에이전트, 복잡한 엔터프라이즈 워크플로를 위해 설계된 가장 지능적인 Flash 모델.
  • Gemini 3.8 Flash TTS (New) — 표현력 있는 연기, 커스텀 Voice design, 음성 복제를 갖춘 스튜디오급 텍스트-음성 변환 모델.
  • Gemini 3.5 Flash-Lite — 저지연 고처리량 서브에이전트 작업에 최적화된 대량·비용 민감 모델.
  • Gemini 3.1 Pro — 최첨단 추론을 기반으로 한 멀티모달 이해 분야 세계 최고의 가장 지능적인 모델.
  • Nano Banana 2와 Nano Banana Pro 🍌 — 최첨단 이미지 생성·편집 모델.
  • Gemini Omni Flash — 최첨단 비디오 생성·편집 모델.
  • Gemini 3.5 Transcribe (New) — 발화 기반 언어 감지, 화자 분리, 단어 타임스탬프를 갖춘 저지연 음성-텍스트 모델.
  • Gemini Robotics — Gemini의 에이전트 능력을 로보틱스에 적용하고 물리적 세계에서 고급 추론을 가능하게 하는 비전-언어 모델(VLM).

기능 살펴보기

  • 이미지 생성 (Image Generation) — Nano Banana로 고도로 컨텍스트적인 이미지를 네이티브하게 생성·편집.
  • 긴 컨텍스트 (Long Context) — 수백만 토큰을 Gemini 모델에 입력하고 구조화되지 않은 이미지·비디오·문서에서 이해를 도출.
  • 구조화 출력 (Structured Outputs) — 자동화된 처리에 적합한 구조화 데이터 형식인 JSON으로 응답하도록 Gemini 제한.
  • 함수 호출 (Function Calling) — Gemini를 외부 API·도구에 연결해 에이전트 워크플로 구축.
  • Veo 3.1 비디오 생성 (Video Generation with Veo 3.1) — 최첨단 모델로 텍스트나 이미지 프롬프트에서 고품질 비디오 콘텐츠 생성.
  • Live API 음성 에이전트 (Voice Agents with Live API) — Live API로 실시간 음성 애플리케이션·에이전트 구축.
  • 도구 (Tools) — Google 검색, URL 컨텍스트, Google Maps, 코드 실행, 컴퓨터 사용 같은 내장 도구로 Gemini를 세상에 연결.
  • 문서 이해 (Document Understanding) — 전체 멀티모달 이해로 PDF 최대 1000페이지 또는 기타 텍스트 기반 파일 처리.
  • Thinking — thinking 기능이 복잡한 작업·에이전트의 추론을 어떻게 개선하는지 살펴보기.

에이전트 만들기

Managed Agents는 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(""));

Go

package main

import (
    "context"
    "fmt"
    "log"

    "google.golang.org/genai"
    "google.golang.org/genai/interactions/models/interactions"
    "google.golang.org/genai/interactions/models/operations"
)

func main() {
    ctx := context.Background()
    client, err := genai.NewClient(ctx, nil)
    if err != nil {
        log.Fatal(err)
    }

    res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
        Body: operations.NewCreateInteractionRequestBody(interactions.CreateAgentInteraction{
            Agent: interactions.AgentOption("antigravity-preview-09-2026"),
            Input: interactions.NewInteractionsInput(
                "Research the top 5 sustainable fashion brands, " +
                    "compare their materials and pricing tiers, and " +
                    "build an interactive dashboard in analysis.html.",
            ),
            Environment: genai.Ptr(interactions.NewCreateAgentInteractionEnvironment("remote")),
        }),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Interaction.OutputText != nil {
        fmt.Println(*res.Interaction.OutputText)
    }
}

REST

curl -X POST \
  "https://generativelanguage.googleapis.com/v1beta/interactions" \
  -H "x-goog-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"
  }'

에이전트 퀵스타트 · AI Studio에서 사용해 보기

Interactions API

Interactions API는 2026년 6월부터 기본 인터페이스가 되었으며, 향후 Gemini 모델·에이전트로 빌드하는 가장 좋은 방법이에요. 새 프로젝트를 시작한다면 Interactions API를 사용해야 해요. 계속 지원되지만 generateContent API는 이제 레거시로 간주돼요.

  • Interactions 개요 — Interactions API가 대화 상태, 메시지, 출력 형식을 관리하는 방법 배우기.
  • 마이그레이션 가이드 — generateContent에서 Interactions API로 코드를 전환하는 단계별 가이드.
  • 스트리밍 — 실시간 토큰, 점진적 생각, 도구 호출 이벤트 스트리밍.

또한 다음 리소스도 유용해요:

  • Google AI Studio — 프롬프트 테스트, API 키 관리, 사용량 모니터링, 프로토타입 빌드.
  • 개발자 커뮤니티 — 다른 개발자와 Google 엔지니어에게 질문하고 해결책 찾기.
  • API 레퍼런스 — 공식 레퍼런스 문서에서 Gemini API에 대한 상세 정보.
  • 상태 — Gemini API, Google AI Studio, 모델 서비스 상태 확인.

더 알아보기 (Learn more)