import os
from google.colab import userdata
os.environ["GOOGLE_API_KEY"] = userdata.get('GEMINI_API_KEY_2')
from google import genai
client = genai.Client()
client.models.generate_content(model = 'Gemini-3.8-flash',contents='O que é a inteligencia artificial?')
ClientError Traceback (most recent call last)
/tmp/ipykernel_788/1584687263.py in <cell line: 0>()
----> 1 client.models.generate_content(model = 'gemini-3.8-flash',contents='O que é a inteligencia artificial?')
13 frames/usr/local/lib/python3.13/dist-packages/google/genai/models.py in generate_content(self, model, contents, config)
6556 )
6557 i += 1
-> 6558 response = self._generate_content(
6559 model=model, contents=contents, config=parsed_config_to_call
6560 )
/usr/local/lib/python3.13/dist-packages/google/genai/models.py in _generate_content(self, model, contents, config)
4984 request_dict = _common.encode_unserializable_types(request_dict)
4985
-> 4986 response = self._api_client.request(
4987 'post', path, request_dict, http_options
4988 )
/usr/local/lib/python3.13/dist-packages/google/genai/_api_client.py in request(self, http_method, path, request_dict, http_options)
1648 http_method, path, request_dict, http_options
1649 )
-> 1650 response = self._request(http_request, http_options, stream=False)
1651 response_body = (
1652 response.response_stream[0] if response.response_stream else ''
/usr/local/lib/python3.13/dist-packages/google/genai/_api_client.py in _request(self, http_request, http_options, stream)
1441 return retry(self._request_once, http_request, stream) # type: ignore[no-any-return]
1442
-> 1443 return self._retry(self._request_once, http_request, stream) # type: ignore[no-any-return]
1444
1445 async def _async_request_once(
/usr/local/lib/python3.13/dist-packages/tenacity/init.py in call(self, fn, *args, **kwargs)
468 retry_state = RetryCallState(retry_object=self, fn=fn, args=args, kwargs=kwargs)
469 while True:
--> 470 do = self.iter(retry_state=retry_state)
471 if isinstance(do, DoAttempt):
472 try:
/usr/local/lib/python3.13/dist-packages/tenacity/init.py in iter(self, retry_state)
369 result = None
370 for action in self.iter_state.actions:
--> 371 result = action(retry_state)
372 return result
373
/usr/local/lib/python3.13/dist-packages/tenacity/init.py in exc_check(rs)
411 retry_exc = self.retry_error_cls(fut)
412 if self.reraise:
--> 413 raise retry_exc.reraise()
414 raise retry_exc from fut.exception()
415
/usr/local/lib/python3.13/dist-packages/tenacity/init.py in reraise(self)
182 def reraise(self) -> t.NoReturn:
183 if self.last_attempt.failed:
--> 184 raise self.last_attempt.result()
185 raise self
186
/usr/lib/python3.13/concurrent/futures/_base.py in result(self, timeout)
451 raise CancelledError()
452 elif self._state == FINISHED:
--> 453 return self.__get_result()
454
455 self._condition.wait(timeout)
/usr/lib/python3.13/concurrent/futures/_base.py in __get_result(self)
400 if self._exception is not None:
401 try:
--> 402 raise self._exception
403 finally:
404 # Break a reference cycle with the exception in self._exception
/usr/local/lib/python3.13/dist-packages/tenacity/init.py in call(self, fn, *args, **kwargs)
471 if isinstance(do, DoAttempt):
472 try:
--> 473 result = fn(*args, **kwargs)
474 except BaseException: # noqa: B902
475 retry_state.set_exception(sys.exc_info()) # type: ignore[arg-type]
/usr/local/lib/python3.13/dist-packages/google/genai/_api_client.py in _request_once(self, http_request, stream)
1418 )
1419 response = self._httpx_client.send(httpx_request, stream=stream) # type: ignore[union-attr]
-> 1420 errors.APIError.raise_for_response(response)
1421 return HttpResponse(
1422 response.headers, response if stream else [response.text]
ClientError: 403 PERMISSION_DENIED. {'error': {'code': 403, 'message': 'Your project has been denied access. Please contact support.', 'status': 'PERMISSION_DENIED'}}
Creio que esse seja o motivo, deve ser pago?