cloudflare / cloudflare/ai

`createXai().responses` causes request to fail unless my own key is set in BYOK

Open
#427 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.2k
Forks
345
Avg merge
13h 31m
Merged PRs (30d)
1

Description

#### Problem

Using `ai@6.0.105` calling `generateText` like below, i receive the error above. Setting a key in the BYOK section of the dashboard fixes this.

#### Error:
```
✘ [ERROR] Uncaught AI_APICallError: No or an invalid authentication header was provided on the request. Please make sure you pass your API key in the corresponding HTTP header. Error
```

#### Code to Reproduce:
```
generateText({
system: composePrompts(systemPrompt),
model: aigateway([createXai().responses("grok-4")]),
})
```

Doing this is necessary for using provider defined tools. I would like to have cloudflares unified system manage the api key and billing instead of having to use my own API keys. Any help with this would be greatly appreciated!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.