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 own documentation, SDK samples and any Gemini code you already have apply unchanged.
증분 출력은 streamGenerateContent?alt=sse를 사용합니다. 생성 전 무료 input 추정이 필요하면 같은 model path의 countTokens를 호출하세요.
함께 보기: Gemini API 키 구매 방법
공식 Python SDK 사용
- 01Create a free apiToken.sale account and open the dashboard — no approval step or waitlist.
- 02Generate one API key. It looks like sk-pool-… and works for Gemini, Claude, GPT and Kimi alike.
- 03Top up any whole-dollar amount by card or crypto; the prepaid balance does not expire.
- 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만 설정하세요.