File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed
src/content/docs/ai-gateway Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,34 @@ curl -X POST https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/comp
6464
6565### Universal provider
6666
67- TBD
67+ You can also use this pattern with a [ Universal Endpoint] ( /ai-gateway/universal/ ) .
68+
69+ ``` ts title="index.ts"
70+ export interface Env {
71+ AI: Ai ;
72+ }
73+
74+ export default {
75+ async fetch(request : Request , env : Env ) {
76+ return env .AI .gateway (" default" ).run ({
77+ provider: " compat" ,
78+ endpoint: " chat/completions" ,
79+ headers: {
80+ authorization: " Bearer " ,
81+ },
82+ query: {
83+ model: " google-ai-studio/gemini-2.0-flash" ,
84+ messages: [
85+ {
86+ role: " user" ,
87+ content: " What is Cloudflare?" ,
88+ },
89+ ],
90+ },
91+ });
92+ },
93+ };
94+ ```
6895
6996## Supported Providers
7097
You can’t perform that action at this time.
0 commit comments