from openai import OpenAI
client = OpenAI(
base_url="https://api.tokenops.ai/v1",
api_key="<TOKENOPS_API_KEY>",
)
completion = client.chat.completions.create(
extra_headers={
"HTTP-Referer": "<YOUR_SITE_URL>", # Optional. Site URL for rankings on tokenops.ai.
"X-Title": "<YOUR_SITE_NAME>", # Optional. Site title for rankings on tokenops.ai.
},
model="gemini-2.5-flash",
messages=[
{
"role": "user",
"content": "What is the meaning of life?"
}
]
)
print(completion.choices[0].message.content)