Gemini
Using Gemini models.
Get Your API Key
Go to the API Keys page to create your API key.
API Base URL
https://tokenoff.com/apiUsage
Gemini models are accessed via the Gemini API, fully compatible with the Google Generative AI API.
curl
curl https://tokenoff.com/api/v1beta/models/gemini-2.5-pro:generateContent \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{"text": "Hello"}
]
}
]
}'
Python
from google import genai
client = genai.Client(
api_key="your_api_key_here",
http_options=genai.types.HttpOptions(
base_url="https://tokenoff.com/api",
),
)
response = client.models.generate_content(
model="gemini-2.5-pro",
contents="Hello",
)
print(response.text)
TypeScript
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({
apiKey: "your_api_key_here",
httpOptions: {
baseUrl: "https://tokenoff.com/api",
},
});
const response = await ai.models.generateContent({
model: "gemini-2.5-pro",
contents: "Hello",
});
console.log(response.text);