Cloudflare AI Inference API

Execute AI models for text generation, embeddings, image classification, and other machine learning tasks.

Operations 1

POST /accounts/{account_id}/ai/run/{model} Cloudflare Execute Ai Model #

Documentation

📖
Documentation
https://developers.cloudflare.com/api/
📖
GettingStarted
https://developers.cloudflare.com/fundamentals/api/get-started/
📖
Authentication
https://developers.cloudflare.com/fundamentals/api/get-started/create-token/
📖
RateLimits
https://developers.cloudflare.com/fundamentals/api/reference/limits/
📖
Documentation
https://developers.cloudflare.com/api/operations/accounts-list-accounts
📖
APIReference
https://developers.cloudflare.com/api/resources/accounts/
📖
APIReference
https://developers.cloudflare.com/ssl/
📖
Documentation
https://developers.cloudflare.com/api/operations/ip-access-rules-for-a-user-list-ip-access-rules
📖
Documentation
https://developers.cloudflare.com/api/operations/user'-s-account-memberships-list-memberships
📖
Documentation
https://developers.cloudflare.com/api/operations/radar-get-search-global
📖
APIReference
https://developers.cloudflare.com/radar/
📖
GettingStarted
https://developers.cloudflare.com/radar/get-started/
📖
Documentation
https://developers.cloudflare.com/api/operations/user-user-details
📖
APIReference
https://developers.cloudflare.com/api/resources/user/
📖
Documentation
https://developers.cloudflare.com/api/operations/zones-get
📖
APIReference
https://developers.cloudflare.com/api/resources/zones/
📖
Documentation
https://developers.cloudflare.com/dns/
📖
APIReference
https://developers.cloudflare.com/api/resources/dns/
📖
Documentation
https://developers.cloudflare.com/workers/
📖
APIReference
https://developers.cloudflare.com/api/resources/workers/
📖
GettingStarted
https://developers.cloudflare.com/workers/get-started/
📖
Documentation
https://developers.cloudflare.com/workers-ai/
📖
GettingStarted
https://developers.cloudflare.com/workers-ai/get-started/rest-api/
📖
APIReference
https://developers.cloudflare.com/workers-ai/configuration/open-ai-compatibility/
📖
APIReference
https://developers.cloudflare.com/workers-ai/models/
📖
Documentation
https://developers.cloudflare.com/ai-gateway/
📖
APIReference
https://developers.cloudflare.com/ai-gateway/usage/providers/
📖
GettingStarted
https://developers.cloudflare.com/ai-gateway/get-started/
📖
Documentation
https://developers.cloudflare.com/r2/
📖
APIReference
https://developers.cloudflare.com/r2/api/s3/api/
📖
GettingStarted
https://developers.cloudflare.com/r2/get-started/
📖
Documentation
https://developers.cloudflare.com/d1/
📖
APIReference
https://developers.cloudflare.com/api/resources/d1/
📖
GettingStarted
https://developers.cloudflare.com/d1/get-started/
📖
Documentation
https://developers.cloudflare.com/kv/
📖
APIReference
https://developers.cloudflare.com/api/resources/kv/
📖
GettingStarted
https://developers.cloudflare.com/kv/get-started/
📖
Documentation
https://developers.cloudflare.com/queues/
📖
APIReference
https://developers.cloudflare.com/api/resources/queues/
📖
GettingStarted
https://developers.cloudflare.com/queues/get-started/
📖
Documentation
https://developers.cloudflare.com/durable-objects/
📖
GettingStarted
https://developers.cloudflare.com/durable-objects/get-started/
📖
APIReference
https://developers.cloudflare.com/durable-objects/api/
📖
Documentation
https://developers.cloudflare.com/vectorize/
📖
GettingStarted
https://developers.cloudflare.com/vectorize/get-started/intro/
📖
APIReference
https://developers.cloudflare.com/vectorize/reference/client-api/
📖
Documentation
https://developers.cloudflare.com/pages/
📖
APIReference
https://developers.cloudflare.com/pages/configuration/api/
📖
GettingStarted
https://developers.cloudflare.com/pages/get-started/
📖
Documentation
https://developers.cloudflare.com/stream/
📖
GettingStarted
https://developers.cloudflare.com/stream/get-started/
📖
APIReference
https://developers.cloudflare.com/api/resources/stream/
📖
Documentation
https://developers.cloudflare.com/images/
📖
GettingStarted
https://developers.cloudflare.com/images/get-started/
📖
APIReference
https://developers.cloudflare.com/api/resources/images/
📖
Documentation
https://developers.cloudflare.com/turnstile/
📖
GettingStarted
https://developers.cloudflare.com/turnstile/get-started/
📖
APIReference
https://developers.cloudflare.com/api/resources/turnstile/
📖
Documentation
https://developers.cloudflare.com/logs/
📖
APIReference
https://developers.cloudflare.com/api/resources/logpush/
📖
GettingStarted
https://developers.cloudflare.com/logs/get-started/
📖
Documentation
https://developers.cloudflare.com/hyperdrive/
📖
APIReference
https://developers.cloudflare.com/api/resources/hyperdrive/
📖
GettingStarted
https://developers.cloudflare.com/hyperdrive/get-started/

Specifications

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/cloudflare-ai-inference-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

cloudflare-ai-inference-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Cloudflare / Accounts AI Inference API
  description: Needs description.
  license:
    name: BSD-3-Clause
    url: https://opensource.org/licenses/BSD-3-Clause
  version: 4.0.0
servers:
- url: https://api.cloudflare.com/client/v4
  description: Client API
security:
- api_email: []
  api_key: []
- api_token: []
- user_service_key: []
tags:
- name: AI Inference
  description: Execute AI models for text generation, embeddings, image classification, and other machine learning tasks.
paths:
  /accounts/{account_id}/ai/run/{model}:
    post:
      operationId: executeAiModel
      summary: Cloudflare Execute Ai Model
      description: Run an AI model on Cloudflare's global network. The model parameter specifies which model to invoke from the Workers AI catalog. Supports text generation, text-to-image, image classification, speech-to-text, translation, summarization, and embedding models.
      tags:
      - AI Inference
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - name: model
        in: path
        required: true
        description: The model identifier to execute, e.g. @cf/meta/llama-3.1-8b-instruct.
        schema:
          type: string
        example: example_value
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AiRunRequest'
            examples:
              ExecuteaimodelRequestExample:
                summary: Default executeAiModel request
                x-microcks-default: true
                value:
                  prompt: example_value
                  messages:
                  - role: system
                    content: example_value
                  image:
                  - 10
                  text: example_value
                  source_lang: example_value
                  target_lang: example_value
                  max_tokens: 10
                  temperature: 42.5
                  stream: true
      responses:
        '200':
          description: Model executed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AiRunResponse'
              examples:
                Executeaimodel200Example:
                  summary: Default executeAiModel 200 response
                  x-microcks-default: true
                  value:
                    result:
                      response: example_value
                    success: true
                    errors:
                    - {}
                    messages:
                    - {}
        '400':
          description: Bad request due to invalid input.
        '401':
          description: Unauthorized.
        '404':
          description: Model not found.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    AiRunRequest:
      type: object
      properties:
        prompt:
          type: string
          description: The input prompt for text generation models.
          example: example_value
        messages:
          type: array
          description: Array of messages for chat-style models.
          items:
            type: object
            properties:
              role:
                type: string
                enum:
                - system
                - user
                - assistant
              content:
                type: string
          example: []
        image:
          type: array
          items:
            type: integer
          description: Raw image bytes for image classification models.
          example: []
        text:
          type: string
          description: Text input for embedding or translation models.
          example: example_value
        source_lang:
          type: string
          description: Source language code for translation.
          example: example_value
        target_lang:
          type: string
          description: Target language code for translation.
          example: example_value
        max_tokens:
          type: integer
          description: Maximum number of tokens to generate.
          example: 10
        temperature:
          type: number
          description: Sampling temperature.
          example: 42.5
        stream:
          type: boolean
          description: Whether to stream the response using server-sent events.
          example: true
    AiRunResponse:
      type: object
      properties:
        result:
          type: object
          properties:
            response:
              type: string
              description: The generated text response.
          example: example_value
        success:
          type: boolean
          example: true
        errors:
          type: array
          items:
            type: object
          example: []
        messages:
          type: array
          items:
            type: object
          example: []
  parameters:
    AccountId:
      name: account_id
      in: path
      required: true
      description: The unique identifier of the Cloudflare account.
      schema:
        type: string