Which model is the beta for structured outpu? Lllama 4 is 😵💫🥴
Which model is the beta for structured outpu? Lllama 4 is 




-N (nobuffer) flag"stream": true?/chat/completion to the end, so your URL shouldn't have that in it with the SDKhttps://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/compat/chat/completions which is what is in the docs. But I'll try it without /chat/completions!


https://*.openai.azure.com/openai/v1/* Azure OpenAI endpoint? I can't seem to get it working with AI Gateway; I'm guessing something is being mutated on the AI Gateway side incorrectly?cf-aig-authorization.${AI_GATEWAY_TOKEN}cf-aig-authorization headererror: 500 [{"code":2002,"message":"Internal server error"}]
status: 500,
headers: Headers {
"date": "Wed, 04 Jun 2025 00:17:33 GMT",
"content-type": "application/json",
"content-length": "101",
"connection": "keep-alive",
"vary": "Accept-Encoding",
"set-cookie": [ "__cf_bm=lxBSjxIyTfBLOugJfEcUnFQKJkr6p7.457_228mHwaY-1748996253-1.0.1.1-X7FS2Pm_wVKIaxeYigqVUhnTxNN9iz.UjHnzyc1mlSb.XVfZET4Qu.h1ipuCSntWPgT3rlOGusU1gjNJAKHq_SKTPaueVJM6jp6n4pkt.kU; path=/; expires=Wed, 04-Jun-25 00:47:33 GMT; domain=.gateway.ai.cloudflare.com; HttpOnly; Secure; SameSite=None" ],
"server": "cloudflare",
"cf-ray": "94a33f75f8e2000e-ORD",
},
requestID: null,
error: [
[Object ...]
],-N"stream": true/chat/completionhttps://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/compat/chat/completions/chat/completionshttps://*.openai.azure.com/openai/v1/*cf-aig-authorization.${AI_GATEWAY_TOKEN}cf-aig-authorizationimport OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.GEMINI_API_KEY,
baseURL: "<my gateway url>"
});
const response = await client.chat.completions.create({
model: "google-ai-studio/gemini-2.0-flash",
messages: [{ role: "user", content: "What is Cloudflare?" }],
});
console.log(response.choices[0]?.message.content);curl -X POST "<my gateway url>" \
--header "Authorization: Bearer $GEMINI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "google-ai-studio/gemini-2.0-flash",
"messages": [
{
"role": "user",
"content": "What is Cloudflare?"
}
]
}'# seems google-ai-studio streaming api not work, anybody know how to fix it?
curl "https://gateway.ai.cloudflare.com/v1/7{account_id}/{gateway_id}/google-ai-studio/v1beta/models/gemini-2.5-flash-preview-05-20:streamGenerateContent?alt=sse" \
--header 'content-type: application/json' \
--header 'x-goog-api-key: '(pass GEMINI_API_KEY) \
--data '{
"contents": [
{
"role":"user",
"parts": [
{"text":"What is Cloudflare?"}
]
}
]
}'createOpenAI({
baseURL: `https://gateway.ai.cloudflare.com/v1/${env.CLOUDFLARE_ACCOUNT_ID}/${customer.gatewayId}/openai`,
apiKey: env.OPENAI_API_KEY,
headers: {
'cf-aig-authorization': env.CLOUDFLARE_API_KEY,
},
});