I created a paid API, but it returned an invalid response

I just add my card to gooogle cloud then create a paid api key in Ai studio.

...1886
Gemini API
...2xlY
Oct 5, 2024
Paid
Go to billing
View usage data

But python code cannot use this key.

    raise ResumableUploadError(resp, content)
googleapiclient.errors.ResumableUploadError: <HttpError 400 when requesting None returned "API key expired. Please renew the API key.". Details: "[{'@type': 'type.googleapis.com/google.rpc.ErrorInfo', 'reason': 'API_KEY_INVALID', 'domain': 'googleapis.com', 'metadata': {'service': 'generativelanguage.googleapis.com'}}]">

Welcome to the forums!

It is unusual, but occasionally there can be a lag between when an account is added and the key being a valid paid key. Try again.
Also check the billing to make sure there are no problems with the account.