Skip to content

Commit

Permalink
Change env from OPENAI_KEY to OPENAI_API_KEY
Browse files Browse the repository at this point in the history
  • Loading branch information
noboruma committed Apr 11, 2023
1 parent 37dcbb7 commit 1be9083
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ Find your key `<API_KEY>` [here](https://platform.openai.com/account/api-keys)
Then run:

```
$ OPENAI_KEY=<API_KEY> prompt-ai
$ OPENAI_API_KEY=<API_KEY> prompt-ai
```
or
```
$ export OPENAI_KEY=<API_KEY>
$ export OPENAI_API_KEY=<API_KEY>
$ prompt-ai
```
8 changes: 6 additions & 2 deletions ais/chatgpt.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ var (
http_timeout = 30 * time.Second
)

const (
API_KEY_ENV = "OPENAI_API_KEY"
)

var apiKey string

func init() {
apiKey = os.Getenv("OPENAI_KEY")
apiKey = os.Getenv(API_KEY_ENV)
if apiKey == "" {
log.Fatal("OPENAI_KEY not set")
log.Fatalf("%s not set\n", API_KEY_ENV)
}
}

Expand Down

0 comments on commit 1be9083

Please sign in to comment.