Answers a prompt with the configured model.
The Worker environment.
The prompt to send.
Optionalmodel: string
Model to run. Falls back to the configured model.
The generated text.
Embeds text as a vector.
The Worker environment.
The text to embed.
Embedding model to run.
The embedding.
Reports whether Workers AI is bound to this Worker.
The Worker environment.
true when the binding is present.
Returns the AI Gateway log id of the most recent call.
Useful for correlating a response with its gateway log entry.
The Worker environment.
The log id, or null when the call was not routed through a gateway.
Inference capability, backed by Workers AI.
Remarks
Which model answers a prompt is configuration, not business logic: callers ask for text and get text. Override
ai.modelinconfig/AIConfig.tsto change it everywhere at once, or name a model per call when one task genuinely needs a different one.Author
Bayu Dwiyan Satria
Version
1.0.0
Since
1.0.0