The following code which works using google-genai package, fails when converted to aisuite and gives the following error:
OSError: Missing one or more required Google environment variables: GOOGLE_PROJECT_ID, GOOGLE_REGION, GOOGLE_APPLICATION_CREDENTIALS. Please refer to the setup guide: /guides/google.md.
#------------- Using: Google GenAI Package --------------------
from google import genai
contents = ["How many continents are in the world. Name them."]
client = genai.Client(api_key='xxxxxxxxxx')
response = client.models.generate_content(
model="gemini-3-flash-preview",
contents=contents[0]
)
print(response.text)
Coverted version
#------------- Using: Aisuite Package -------------------
import aisuite as ai
import os
os.environ['GEMINI_API_KEY'] = 'xxxxxxxxxxx'
models = ['google:gemini-3-flash-preview']
messages = [
{"role": "system", "content": "Respond in Pirate English."},
{"role": "user", "content": "Tell me a joke."},
]
client = ai.Client()
response = client.chat.completions.create(
model=models[0],
messages=messages,
temperature=0.75
)
print(response.choices[0].message.content)
The following code which works using google-genai package, fails when converted to aisuite and gives the following error:
OSError: Missing one or more required Google environment variables: GOOGLE_PROJECT_ID, GOOGLE_REGION, GOOGLE_APPLICATION_CREDENTIALS. Please refer to the setup guide: /guides/google.md.
#------------- Using: Google GenAI Package --------------------
from google import genai
contents = ["How many continents are in the world. Name them."]
client = genai.Client(api_key='xxxxxxxxxx')
response = client.models.generate_content(
model="gemini-3-flash-preview",
contents=contents[0]
)
print(response.text)
Coverted version
#------------- Using: Aisuite Package -------------------
import aisuite as ai
import os
os.environ['GEMINI_API_KEY'] = 'xxxxxxxxxxx'
models = ['google:gemini-3-flash-preview']
messages = [
{"role": "system", "content": "Respond in Pirate English."},
{"role": "user", "content": "Tell me a joke."},
]
client = ai.Client()
response = client.chat.completions.create(
model=models[0],
messages=messages,
temperature=0.75
)
print(response.choices[0].message.content)