POST /accounts/{account_id}/ai/run

Execute an AI model by specifying the model name in the request body.

This endpoint provides a generic interface for running AI models where the model name is part of the request payload rather than the URL path. It supports all AI Gateway features including caching, custom headers, and request options.

Model-specific inputs available in Cloudflare Docs.

Servers

Path parameters

Name Type Required Description
account_id String Yes

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/json"

Request body fields

Name Type Required Description
input Object Yes

Model-specific input data. Format varies by model type.

options Object No
options.gateway Object No
options.gateway.id String No

AI Gateway ID for caching and logging

options.gateway.cacheTtl Number No

Cache TTL in seconds

options.gateway.skipCache Boolean No

Skip cache lookup for this request

options.extraHeaders Object No

Additional headers to pass to the AI provider

model String Yes

The AI model to execute (e.g., openai/gpt-5.5, anthropic/claude-opus-4.7)

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.