I have Pay-as-you-go plan enabled.
I’ve tried new Gemini 2.0 API with multimodal inputs (text and image) and grounding search.
On 13th of December (when it was first released) it worked all fine, I got results with the help of grounding search but now I get 429 quota exhausted responses.
I haven’t used the API extensively as well, I was still experimenting with the API, in total I could’ve made about 10-20 requests max.
Here’s my code:
import PIL.Image
from google import genai
from google.genai.types import Tool, GenerateContentConfig, GoogleSearch
client = genai.Client(api_key=os.environ.get("GEMINI_API_KEY"))
google_search_tool = Tool(google_search=GoogleSearch())
model = "gemini-2.0-flash-exp"
async def get_company_website(image: bytes) -> str:
"""
Searches website URL from given company image
"""
image = PIL.Image.open(io.BytesIO(image))
# If using a single image, place the text prompt after the image.
response = await client.aio.models.generate_content(
model=model,
contents=[ image, PROMPT ],
config=GenerateContentConfig(
# max_output_tokens=200,
tools=[google_search_tool],
response_modalities=["TEXT"]
)
)
return response.text
I’m using google-genai==0.2.2
It all works fine without GoogleSearch
enabled
What am I missing here?