Devflare Docs
Under the hood Bindings

How Devflare wires AI from config to runtime

AI has a smaller compiler story than storage bindings, but a more explicit auth and remote-runtime story.

Devflare does not invent a fake local AI runtime. It compiles the binding, checks remote requirements when needed, and exposes remote helpers for tests that intentionally opt in.

Normalization
The authored shape is small, so the important complexity lives in auth and remote enablement rather than config normalization
Compile target
Wrangler binding
Preview note
AI is remote-oriented; preview is less about provisioning and more about whether the worker path may call the model

Devflare normalizes the authored shape before it does anything louder

AI does not need the same name-versus-id resolution dance as KV or D1. The authored shape is basically “which env binding name should exist.”

The heavier implementation work lives in auth checks and remote-test setup, because the value of the binding only appears once the worker can reach real Cloudflare AI services.

AI from authored config to generated output

Keep the binding readable in source, then inspect only the Wrangler-facing slice Devflare emits when the config is compiled.

Local runtime support depends on what Devflare can model directly

  • treats AI as a binding that requires remote account context.
  • can inject a remote AI helper when remote mode is enabled and an account can be resolved.
  • is not supported by the current remote AI test helper, so gateway-specific flows need a higher-level integration path.
  • exists so tests can say clearly when remote inference is unavailable instead of failing opaquely.

Compile, preview, and cleanup behavior

  • Compile emits the AI binding shape directly into generated Wrangler output.
  • Because the runtime behavior is remote-oriented, the major operational risk is not syntax — it is auth, availability, and cost control.
  • Preview behavior is mostly about whether that worker path should call real models, not about separate preview-managed AI resources.

Honest tooling beats fake local magic

Devflare makes AI explicit and testable on purpose, but it does not pretend local emulation is equivalent to real inference.

Previous

AI

AI is a supported binding in Devflare, but it is intentionally treated as remote-oriented because real model inference lives on Cloudflare infrastructure.

Next

Testing AI

The right AI test strategy is selective: use remote mode when you mean to test inference, and skip cleanly when the environment is not allowed to do that.