메인 콘텐츠로 건너뛰기

Documentation Index

Fetch the complete documentation index at: https://docs.apigo.ai/llms.txt

Use this file to discover all available pages before exploring further.

권장 엔드포인트

최소한의 요청

{
  "model": "gemini-2.5-flash",
  "contents": [
    {
      "role": "user",
      "parts": [
        { "text": "Describe the UI structure in this screenshot." },
        {
          "inlineData": {
            "mimeType": "image/png",
            "data": "<base64>"
          }
        }
      ]
    }
  ]
}

cURL 예

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "role": "user",
        "parts": [
          { "text": "Describe the UI structure in this screenshot." },
          {
            "inlineData": {
              "mimeType": "image/png",
              "data": "<base64>"
            }
          }
        ]
      }
    ]
  }'

파이썬 예제

import requests

response = requests.post(
    "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent",
    headers={
        "x-goog-api-key": "<GEMINI_API_KEY>",
        "Content-Type": "application/json",
    },
    json={
        "contents": [
            {
                "role": "user",
                "parts": [
                    {"text": "Describe the UI structure in this screenshot."},
                    {
                        "inlineData": {
                            "mimeType": "image/png",
                            "data": "<base64>",
                        }
                    },
                ],
            }
        ],
    },
)

print(response.json())

Node.js 예

const response = await fetch(
  "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent",
  {
    method: "POST",
    headers: {
      "x-goog-api-key": process.env.GEMINI_API_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      contents: [
        {
          role: "user",
          parts: [
            { text: "Describe the UI structure in this screenshot." },
            {
              inlineData: {
                mimeType: "image/png",
                data: "<base64>"
              }
            }
          ]
        }
      ]
    }),
  }
);

console.log(await response.json());

모범 사례

  • 작은 자산을 인라인하고 더 큰 재사용 가능한 미디어를 위해 Files API를 사용합니다.
  • parts 내에서 의도한 컨텍스트 순서를 유지합니다.
  • 단일 요청 모델은 텍스트, 이미지 및 파일을 처리할 수 있으므로 Gemini를 쉽게 확장할 수 있습니다.