Cloudflare Model Factory
Builds decision services for the decision models on Cloudflare Workers AI: the CLEF models Cloudflare hosts, and Jev, which it runs as a third-party model. Workers AI serves System One behind its own REST API, so this is a SystemOneModelFactory with Cloudflare's address for the account, its envelope and its limits.
Cloudflare always needs an API key, which is a Cloudflare API token. A missing key fails each call as unavailable before anything is sent, and buildValidated rejects it. Building a service never reads the key.
Parameters
the Cloudflare account that runs the models, 32 hexadecimal characters
supplies the API key (a Cloudflare API token) with Workers AI access for each call
the application's HTTP client builder, or null for the factory's own
records decision and request observations
the model build and buildValidated return
the largest response body that is read
Functions
Returns a service for the default model.
Returns a service for the named model. The endpoint's binding checks the name first, and the endpoint decides whether a model it accepts exists.
Reads the key once, checks it by listing the endpoint's models with it, then returns a service for the default model. A missing key, a rejected listing or an unreachable endpoint all count as an invalid key. A key supplier that throws InvalidApiKeyException itself, as one that insists on a key does for a blank one, counts as a missing key. An already interrupted caller is cancelled before the key is read, including when no key is configured. An interrupted key supplier also throws a CancellationException.
Lists the models the endpoint serves.