@any-model/cloudflare
v0.1.0
Published
Cloudflare AI Gateway provider for any-model.
Readme
@any-model/cloudflare
Cloudflare Unified AI Gateway provider for any-model.
bun add @any-model/cloudflare @any-model/coreCreate a Cloudflare API token with Workers AI: Read permission (and the relevant AI Gateway permissions for gateway management), then register the provider:
import { createRegistry } from "@any-model/core";
import { cloudflare } from "@any-model/cloudflare";
const ai = createRegistry().use(cloudflare({
accountId: process.env.CLOUDFLARE_ACCOUNT_ID!,
apiToken: process.env.CLOUDFLARE_API_TOKEN!,
}));
const workersAI = ai.languageModel("cloudflare:@cf/meta/llama-3.3-70b-instruct-fp8-fast");
const thirdParty = ai.languageModel("cloudflare:openai/gpt-4.1-mini");Requests use Cloudflare's OpenAI-compatible
/accounts/{accountId}/ai/v1/chat/completions endpoint. gatewayId defaults to "default";
override it in the provider config or on an individual request with the
cf-aig-gateway-id header. The provider has no listModels() implementation because this
endpoint does not expose a documented OpenAI-compatible model-list API.
