Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

createAI: the ai peer range allows ai@6, which the provider cannot work with

Open Beginner friendly
#2,690 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@akhil9tiet is already working on this.

Since Oct 23, 2026.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
83/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend, devtools

Research direction

Start with the peerDependencies in packages/agents/package.json and compare the declared ai range with the v4 model implementation in packages/agents/src/models/ai-sdk/models/language.ts. The issue reports that ai@6 rejects the v4 model and says @cloudflare/think already pins ai to ^7.0.0. Check for relevant package tests or validation; done when the peer range matches the supported version and installs no longer accept the reported incompatible combination.

Written by the indexing model from the issue text.

Description

bug

Describe the bug

packages/agents/package.json declares:

"peerDependencies": { "ai": "^6.0.0 || ^7.0.0", "@ai-sdk/provider": "^4.0.0" }

ai@6 satisfies that range but cannot drive the provider. createAI builds a
LanguageModelV4, and ai@6 does not accept one, so every call throws. The
install is clean — no peer warning — and the failure only appears at the first
generateText.

The AI SDK page
already says the right thing ("The provider needs ai@^7 and
@ai-sdk/provider@^4"); it is the range that is wrong.

To Reproduce

npm i [email protected] [email protected] @ai-sdk/[email protected]   # no peer warning
import { createAI } from "agents/models/ai-sdk";
import { generateText } from "ai";

const binding = {
  aiGatewayLogId: null,
  async fetch() { return new Response("x", { status: 501 }); },
  async run() {
    return new Response(
      JSON.stringify({
        id: "c1", object: "chat.completion", created: 1, model: "@cf/test",
        choices: [{ index: 0, message: { role: "assistant", content: "ok" }, finish_reason: "stop" }],
        usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 }
      }),
      { headers: { "content-type": "application/json" } }
    );
  }
};

const ai = createAI({ binding: binding as never });
await generateText({ model: ai("@cf/zai-org/glm-4.7-flash"), prompt: "hi", maxRetries: 0 });
UnsupportedModelVersionError [AI_UnsupportedModelVersionError]: Unsupported
model version v4 for provider "cloudflare" and model
"@cf/zai-org/glm-4.7-flash". AI SDK 5 only supports models that implement
specification version "v2".

The binding is a stub, so no account is involved: the throw happens before any
request is sent.

Pinning @ai-sdk/[email protected] instead makes no difference. ai does not
take @ai-sdk/provider as a peer — [email protected] depends on @ai-sdk/[email protected]
directly — so whichever version sits at the top level, ai@6 reads models
through its own copy and rejects a v4 one.

Expected behavior

Either the range matches what works ("ai": "^7.0.0"), or ai@6 is actually
supported and the v4 model is only built when the installed ai can read it.

Root cause

packages/agents/package.json. The provider is a ProviderV4 built against
@ai-sdk/provider@^4 (LanguageModelV4 in
packages/agents/src/models/ai-sdk/models/language.ts), while ai@6 pins
@ai-sdk/provider@3 as a direct dependency. The two halves of the range are not
interchangeable, and the @ai-sdk/provider peer cannot bridge them, so
^6.0.0 || ^7.0.0 admits a combination that cannot work.

@cloudflare/think already pins "ai": "^7.0.0", which is the shape this
needs.

Additional context

Same v6/v7 mix-up as #2647, from the other side: there the docs were behind the
package, here the package range is wider than the code.

Version: [email protected], [email protected], @ai-sdk/[email protected], Node 24.

Dominant language
TypeScript
Stars
5.9k
Forks
788
Avg merge
21h 29m
Merged PRs (30d)
190

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudflare/agents

All issues in cloudflare/agents

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.