Issue setting up your call

Hey, I’ve been trying to initialize call with bubble, but i keep getting this message.

I’ve tried with new API key same result. Can you help me, I’m stuck for 2 hours…

Try to perform a basic curl call just to ensure you’ve got a working API key.

curl https://api.openai.com/v1/models \
  -H "Authorization: Bearer $OPENAI_API_KEY"
1 Like

Welcome to the dev forum @evgenidiinev

It looks like a $ sign is being prefixed to the API key. Just remove that and you should be good to go.

Note: this command works if you use the default project key, but fails for other project keys. Not sure why this is?

Fails in what way?

Sorry, my bad. Typo in my sed script prior to calling the curl command. For those curious linux users, this is the fixed bash script

#!/bin/bash
if [ "$OPENAI_API_KEY" == "" ]
then
        # Check python .env file
        if [ ! -e ".env" ]
        then
                echo "Missing environment variable OPENAI_API_KEY"
                exit -1
        fi
        tryList=`grep "OPENAI_API_KEY=" .env | sed -e "/[\b]*[#]/d" | sed -e "s/OPENAI_API_KEY[\b]*=[\b]*//"`
        for tryOne in $tryList
        do
                OPENAI_API_KEY=$tryOne
                break
        done
        if [ "$OPENAI_API_KEY" == "" ]
        then
                echo "Missing environment variable OPENAI_API_KEY"
                exit -1
        else
                echo "Note: using OPENAI_API_KEY in your python '.env' file"
        fi
fi
# echo "Using key [$OPENAI_API_KEY]"

curl https://api.openai.com/v1/models -H "Authorization: Bearer $OPENAI_API_KEY"