Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Unable to get example to work #36

Closed Answered by thejamescollins
MastaBaba asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @MastaBaba,

I think these two lines may be the issue:

$api_key = "{{key}}";
getenv($api_key)

Are you storing your API key in an environment variable? The getenv() PHP function loads the value from the environment variable named{{key}}.

I'd encourage you to use an environment variable for your API key.

Please see the docs for more details: https://tectalic.com/apis/openai/docs/php#usage

Or if you aren't using an environment variable and you are hard-coding it in the PHP code itself, then you would need to remove the getenv() call.

I hope that helps,

James

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by MastaBaba
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants