Skip to main content

Module ai

Module ai 

Source
Expand description

The Workers AI binding (env.AI) as a decision backend.

AiBackend calls env.AI.run(model, input) with the SystemOne request yoagent builds and parses the result with parse_systemone_response, so answers are validated and spend is recorded as for the REST preset (DecisionModel::clef). clef and clef_flash are the ready-made models; they are priced at the rate the price table holds when they are built.

Structs§

AiBackend
A SystemOne decision model run through a Worker’s AI binding.

Constants§

CLEF
Clef (27B) in the Workers AI catalog.
CLEF_FLASH
Clef Flash (9B, faster) in the Workers AI catalog.

Functions§

clef
Clef through the Worker’s AI binding: model clef, priced at the cloudflare/clef rate yoagent’s process-wide price table holds when this is called — unpriced unless the Worker opted in to prices first (enable_bundled: $0.24 per million input tokens). A later opt-in or install_override does not reprice the returned model; with prices enabled but no rate in the table it is unpriced (logged).
clef_flash
Clef Flash through the Worker’s AI binding: model clef-flash, priced like clef at the cloudflare/clef-flash rate ($0.09 per million input tokens in the bundled snapshot; unpriced without an opt-in).