Nixtla / nixtla

TimeGPT-1: production ready pre-trained Time Series Foundation Model for forecasting and anomaly detection. Generative pretrained transformer for time series trained on over 100B data points. It's capable of accurately predicting various domains such as retail, electricity, finance, and IoT with just a few lines of code 🚀.
https://docs.nixtla.io
Other
1.91k stars 151 forks source link

API Key Validation Issue with Active Account and Sufficient Credits #396

Closed adham closed 1 week ago

adham commented 3 weeks ago

Hi

I recently signed up for the Early Adopter Special trial of TimeGPT and have an active account with sufficient credits. I've also created an API key and followed the provided instructions to set up the NixtaClient object.

However, I'm encountering an issue where the NixtaClient object does not validate the API key, despite the account being active and having enough credits.

Here's a screenshot of my active account for reference:

Active Account Screenshot

Active API key

and here is the code

code

I've double-checked the API key and the setup instructions, and everything seems to be in order. I'm unsure what could be causing this issue.

And as the result, client.forecast() doesn't work. image

Could you please assist me in resolving this problem? Any guidance would be greatly appreciated.

Thank you, Adham

jmoralez commented 2 weeks ago

Hey.

adham commented 2 weeks ago

Hey @jmoralez

  1. Yes, the env var is injected and available
  2. I'm on Mac. Tried a linux with no firewall too, no luck
jmoralez commented 2 weeks ago

Can you try running the following on your terminal?

export NIXTLA_API_KEY="your_api_key"
curl -XPOST -H "Authorization: Bearer $NIXTLA_API_KEY" https://dashboard.nixtla.io/api/validate_token

That may give us more information.

adham commented 2 weeks ago

@jmoralez

200! Interesting!

{"status":200,"data":{"detail":"Happy Forecasting! :)"},"message":"success","details":"request successful","code":"B10","support":"If you have questions or need support, please email ops@nixtla.io sharing this response and ID: ZZ6R3VUFKM","requestID":"ZZ6R3VUFKM"}%

jmoralez commented 2 weeks ago

But running

from nixtla import NixtlaClient

NixtlaClient().validate_api_key()

returns False?

If it does, can you try manually setting your api key in the constructor? e.g.

client = NixtlaClient(api_key="your_api_key")
client.validate_api_key()
adham commented 2 weeks ago

Yes you are right.

No matter how I pass the API key, it returns False.


I just checked on a google Colab notebook and everything works fine which means there's a problem with my local dev env. Apologies for raising the issue and taking your time. You can close the issue now.

Cheers

jmoralez commented 2 weeks ago

Another possible source would be the base url, do you have the NIXTLA_BASE_URL env variable set?

adham commented 2 weeks ago

do you have the NIXTLA_BASE_URL env variable set?

No I don't. What should I set it to?

jmoralez commented 2 weeks ago

It's ok not setting it, if it isn't set it defaults to the url I sent in the curl command, so it's very strange that it works on the terminal but not on the python client.

jmoralez commented 1 week ago

Closing since you were able to run it somewhere else, feel free to reopen if you're unable to fix it locally.