Skip to content

Commit

Permalink
feat: add open ai key
Browse files Browse the repository at this point in the history
  • Loading branch information
rrfaria committed Oct 13, 2024
1 parent db3e97e commit 167addf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ ANTHROPIC_API_KEY=XXX
PROVIDER= gemini | antrophic | openai | ollama
MODEL_NAME=XXX
GOOGLE_GENERATIVE_AI_API_KEY=XXX
OPEN_AI_API_KEY=XXX
```

Optionally, you can set the debug level:
Expand Down
4 changes: 4 additions & 0 deletions app/lib/.server/llm/api-key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ export function getAPIKey(cloudflareEnv: Env) {
return cloudflareEnv.GOOGLE_GENERATIVE_AI_API_KEY || (env.GOOGLE_GENERATIVE_AI_API_KEY as string);
}

if (provider === 'openai') {
return cloudflareEnv.OPEN_AI_API_KEY || (env.OPEN_AI_API_KEY as string);
}

return env.ANTHROPIC_API_KEY || cloudflareEnv.ANTHROPIC_API_KEY;
}
1 change: 1 addition & 0 deletions worker-configuration.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ interface Env {
PROVIDER: string;
MODEL_NAME: string;
GOOGLE_GENERATIVE_AI_API_KEY: string;
OPEN_AI_API_KEY: string;
}

0 comments on commit 167addf

Please sign in to comment.