도구 설정

Gemini API 빠른 시작: curl과 Google GenAI SDK

gateway는 native Google Gemini protocol을 유지합니다. base URL과 API key만 바꾸고 generateContent와 공식 SDK 형식을 그대로 사용하되 모델을 항상 명시하세요.

·

curl로 첫 요청

To make your first Gemini API call through apiToken.sale, keep the Google protocol exactly as documented and change only two values: the base URL becomes https://router.apitoken.sale and the key is your apiToken.sale key, sent as the x-goog-api-key header. Every request and response keeps the native generateContent shape, so Google's documentation and SDK samples apply to the models and fields this endpoint supports. A few Google features are not available here: cachedContent and external file URIs are rejected (send files as inlineData), and the model list is limited to the published catalogue — the error table below lists each case.

증분 출력은 streamGenerateContent?alt=sse를 사용합니다. 생성 전 무료 input 추정이 필요하면 같은 model path의 countTokens를 호출하세요.

함께 보기: Gemini API 키 구매 방법

공식 Python SDK 사용

  1. 01Create a free apiToken.sale account and open the dashboard — no approval step or waitlist.
  2. 02Generate one API key. It looks like sk-pool-… and works for Gemini, Claude and GPT alike.
  3. 03Top up any whole-dollar amount by card or crypto; the prepaid balance does not expire.
  4. 04Export the key as APITOKEN_API_KEY, then list the models your key can actually call:
  • SDK 설정에는 /v1beta 없이 bare base URL만 전달합니다.
  • 구체적인 model ID를 지정하세요. 클라이언트의 auto default는 gateway catalog에 없을 수 있습니다.
  • APITOKEN_API_KEY를 source code가 아닌 환경 변수에 보관합니다.

자주 묻는 질문

공식 Google GenAI SDK가 작동하나요?

네. HttpOptions(base_url)을 https://router.apitoken.sale로 설정하고 apiToken.sale 키를 제공하면 request와 response 형식은 native 그대로입니다.

Gemini output을 streaming하려면?

/v1beta/models/{model}:streamGenerateContent?alt=sse와 x-goog-api-key 또는 SDK의 대응 streaming method를 사용합니다.

중복 /v1beta가 왜 404를 만드나요?

Google SDK가 API version을 자동으로 추가합니다. 최종 URL에 /v1beta가 한 번만 오도록 bare host만 설정하세요.

계정을 만들고 잔액을 충전한 다음 API 키를 생성하여 지원되는 Claude, GPT, Gemini 모델을 사용하세요.