Gemini API

Gemini API

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

출처: 원문

본문

Python

from google import genai

client = genai.Client()

response = client.models.generate_content(
    model="gemini-3.8-flash",
    contents="Explain how AI works in a few words",
)

print(response.text)

JavaScript

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

const ai = new GoogleGenAI({});

async function main() {
  const response = await ai.models.generateContent({
    model: "gemini-3.8-flash",
    contents: "Explain how AI works in a few words",
  });
  console.log(response.text);
}

await main();

Go

package main

import (
    "context"
    "fmt"
    "log"
    "google.golang.org/genai"
)

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

    result, err := client.Models.GenerateContent(
        ctx,
        "gemini-3.8-flash",
        genai.Text("Explain how AI works in a few words"),
        nil,
    )
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(result.Text())
}

Java

package com.example;

import com.google.genai.Client;
import com.google.genai.types.GenerateContentResponse;

public class GenerateTextFromTextInput {
  public static void main(String[] args) {
    Client client = new Client();

    GenerateContentResponse response =
        client.models.generateContent(
            "gemini-3.8-flash",
            "Explain how AI works in a few words",
            null);

    System.out.println(response.text());
  }
}

C#

using System.Threading.Tasks;
using Google.GenAI;
using Google.GenAI.Types;

public class GenerateContentSimpleText {
  public static async Task main() {
    var client = new Client();
    var response = await client.Models.GenerateContentAsync(
      model: "gemini-3.8-flash", contents: "Explain how AI works in a few words"
    );
    Console.WriteLine(response.Candidates[0].Content.Parts[0].Text);
  }
}

REST

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash:generateContent" \
  -H "x-goog-api-key: *** \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [
      {
        "parts": [
          {
            "text": "Explain how AI works in a few words"
          }
        ]
      }
    ]
  }'

모델 소개(Meet the models)

  • Gemini 3.1 Pro (New) — 가장 지능적인 모델로, 멀티모달 이해 분야 세계 최고이며 모두 최첨단 추론을 기반으로 구축됐어요.
  • Gemini 3.6 Flash (New) — 속도와 지능의 균형을 이뤄 에이전틱 및 멀티모달 작업에서 강력한 성능을 제공하는 최신 모델이에요.
  • Gemini 3.5 Flash — 더 큰 모델에 맞먹는 프론티어급 성능을 비용은 그 일부만으로 제공해요.
  • Gemini 3.8 Flash TTS (New) — 표현력 있는 연기, 커스텀 Voice 설계, Voice 복제를 갖춘 스튜디오급 텍스트-투-스피치 모델이에요.
  • Gemini 3.5 Flash-Lite (New) — 저지연 고처리량 서브에이전트 작업에 최적화된 대용량·비용 민감 모델이에요.
  • Gemini 3.1 Flash-Lite — Gemini 3 시리즈의 성능과 품질을 갖춘 대용량·비용 민감 모델이에요.
  • Gemini 3 Flash — 더 큰 모델에 맞먹는 프론티어급 성능을 비용은 그 일부만으로 제공해요.
  • Nano Banana 2 및 Nano Banana Pro — 최첨단 이미지 생성·편집 모델이에요.
  • Veo 3.1 — 네이티브 오디오를 갖춘 최첨단 비디오 생성 모델이에요.
  • Gemini Robotics — Gemini의 에이전틱 능력을 로보틱스에 가져오고 물리적 세계에서 고급 추론을 가능하게 하는 비전-언어 모델(VLM)이에요.

기능 살펴보기(Explore Capabilities)

  • 네이티브 이미지 생성 (Nano Banana) — Gemini 2.5 Flash Image로 상황에 매우 잘 맞는 이미지를 네이티브하게 생성·편집해요.
  • 긴 컨텍스트(Long Context) — Gemini 모델에 수백만 토큰을 입력하고 구조화되지 않은 이미지·비디오·문서에서 이해를 도출해요.
  • 구조화 출력(Structured Outputs) — Gemini가 자동 처리에 적합한 구조화 데이터 형식인 JSON으로 응답하도록 제약해요.
  • 함수 호출(Function Calling) — Gemini를 외부 API와 도구에 연결해 에이전틱 워크플로를 구축해요.
  • Veo 3.1 비디오 생성 — 최첨단 모델로 텍스트 또는 이미지 프롬프트에서 고품질 비디오 콘텐츠를 생성해요.
  • Live API 음성 에이전트 — Live API로 실시간 음성 애플리케이션과 에이전트를 구축해요.
  • 도구(Tools) — Google Search, URL Context, Google Maps, 코드 실행, 컴퓨터 사용 같은 내장 도구로 Gemini를 세상에 연결해요.
  • 문서 이해(Document Understanding) — 완전한 멀티모달 이해나 기타 텍스트 기반 파일 유형으로 PDF 최대 1,000페이지를 처리해요.
  • Thinking — thinking 능력이 복잡한 작업과 에이전트의 추론을 어떻게 개선하는지 살펴봐요.
  • Google AI Studio — 프롬프트를 테스트하고, API 키를 관리하고, 사용량을 모니터링하고, 프로토타입을 구축해요.
  • 개발자 커뮤니티 — 다른 개발자와 Google 엔지니어에게 질문하고 해결책을 찾아요.
  • API Reference — 공식 레퍼런스 문서에서 Gemini API에 대한 자세한 정보를 찾아요.
  • Status — Gemini API, Google AI Studio, 모델 서비스의 상태를 확인해요.

더 알아보기 (Learn more)