We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 0e27290 + eae8970 commit 48104e7Copy full SHA for 48104e7
.dev.vars.example
@@ -1 +1,3 @@
1
-OPENAI_API_KEY=sk-proj-1234567890
+OPENAI_API_KEY=sk-proj-1234567890
2
+# Optional - Cloudflare AI Gateway https://developers.cloudflare.com/ai-gateway/
3
+# GATEWAY_BASE_URL=https://gateway.ai.cloudflare.com/v1/..
src/server.ts
@@ -53,6 +53,12 @@ export class Chat extends AIChatAgent<Env> {
53
apiKey: this.env.OPENAI_API_KEY,
54
});
55
56
+ // Cloudflare AI Gateway
57
+ // const openai = createOpenAI({
58
+ // apiKey: this.env.OPENAI_API_KEY,
59
+ // baseURL: this.env.GATEWAY_BASE_URL,
60
+ // });
61
+
62
// Stream the AI response using GPT-4
63
const result = streamText({
64
model: openai("gpt-4o-2024-11-20"),
0 commit comments