Groq
openai/gpt-oss-20bPublished free plan: 30 requests per minute, 1000 per day, and 8000 tokens per minute. Limits are shared within your organization.
Free-account call pending verification
Create a key in the provider’s console and call a text model from your own Python environment. The script sends your key directly to the provider.
import os
from openai import APIStatusError, OpenAI
client = OpenAI(
api_key=os.environ["GEMINI_API_KEY"],
base_url="https://generativelanguage.googleapis.com/v1beta/openai/",
max_retries=0,
timeout=30,
)Compare the documented free tiers and pick an endpoint for your first request.
openai/gpt-oss-20bPublished free plan: 30 requests per minute, 1000 per day, and 8000 tokens per minute. Limits are shared within your organization.
Free-account call pending verification
gemini-3.5-flash-liteText input and output are listed as free on the free tier. Limits vary by project and model. Daily request quotas reset at midnight Pacific time.
Free-account call pending verification
You’ll need Python 3 and a key from the selected provider. Run both commands in the same terminal session.
py -m venv .venv
.\.venv\Scripts\python.exe -m pip install openai
$secret = Read-Host 'Paste your Gemini key' -AsSecureString
$env:GEMINI_API_KEY = [System.Net.NetworkCredential]::new('', $secret).Password
Remove-Variable secretimport os
from openai import APIStatusError, OpenAI
client = OpenAI(
api_key=os.environ["GEMINI_API_KEY"],
base_url="https://generativelanguage.googleapis.com/v1beta/openai/",
max_retries=0,
timeout=30,
)
try:
reply = client.chat.completions.create(
model="gemini-3.5-flash-lite",
messages=[{"role": "user", "content": "Reply with OK."}],
)
print(reply.choices[0].message.content)
except APIStatusError as error:
raise SystemExit(f"HTTP {error.status_code}: {error.message}") from None.\.venv\Scripts\python.exe quickstart.pyA successful request prints the model’s reply. If it fails with an HTTP status, use the guide below.
401Make sure you set the selected provider’s key in this terminal. If it was revoked or copied incorrectly, create a new one in the official console.
403Read the provider’s error for the account, region, or model restriction. Check that the selected project can call this model.
429Read the provider’s error and honor Retry-After when it is present. If the free quota is exhausted, wait for the next reset or switch to a provider where you still have quota.
Switch to GroqThe provider sets which models qualify, what your account can use, and when your quota resets. Check the official limits for your account before running the snippet.
Billing requirements depend on the provider, plan, and account. Check your Groq plan or AI Studio project in the official console before enabling billing.
Your key stays in your terminal environment. The Python script reads it and sends it directly to the selected provider when you run it.
Groq and Gemini each have their own OpenAI-compatible Base URL. Selecting a provider updates the URL, model name, and environment variable in the snippet.