Devflare Docs
Application example Bindings

Use AI in a real application path

Workers AI lets Workers run Cloudflare-hosted machine-learning models through an env binding.

A real AI application path with config and runtime code kept side by side.

Use this as the application-focused AI example before you add feature-specific abstractions around the binding.

Config focus
Minimal binding declaration
Runtime shape
Call from the worker
Best use
Small inference endpoints and smoke checks

Start by wiring the binding clearly in config

Minimal AI config

Build the application flow around the binding

Treat this as the app-level AI path: the route, event handler, or service module receives a real request and uses the binding to do useful work.

Keep product limits, remote ownership, and fallback behavior visible in the code around the binding instead of hiding everything behind a vague utility too early.

  • Use a cheap, small model in smoke paths unless the point is to verify a specific expensive production model.
  • Keep local app mocks above this worker route if you need offline UI development.

A tiny inference endpoint

Keep production boundaries visible

  • Config focus: Minimal binding declaration.
  • Runtime shape: Call from the worker.
  • Best use: Small inference endpoints and smoke checks.

The Devflare win is the explicit remote gate

A clear skip condition is more trustworthy than a fake local AI emulator that never touched the real platform. That honesty is part of what makes the Devflare AI story usable.

Previous

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.

Next

Vectorize

Devflare makes Vectorize usable by keeping the index name explicit in config, preview naming honest, and the real smoke test explicit instead of buried under mocks.