How to connect to Genimi (Google AI Studio)?
Author: phyAISdierCreated Mar 18, 2025Updated Sep 14, 2026
Labelsinactive
Google AI Studio offers API, however seems that it has it's own setting by it's own package, I can not find the "base_url" for "config.toml". I get a url "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash" from the following test code, but it failed.
The test connection used in the terminal is:
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=AIzaSyDIBBSzHwE0R3G9m5KtKEvoiwj60CqX3PQ" -H 'Content-Type: application/json' -X POST -d '{
"contents": [{
"parts":[{"text": "Explain how AI works"}]
}]
}'
The test connection (use python) is:
from google import genai
client = genai.Client(api_key="YOUR_API_KEY")
response = client.models.generate_content(
model="gemini-2.0-flash",
contents="Explain how AI works",
)
print(response.text)
Source: FoundationAgents/OpenManus