Developer Dashboard

Cloudflare AI Models ​

Cloudflare Workers AI hosts language, vision, image-generation, embedding, decision, and extraction models on Cloudflare's global network. AvalAI provides access with an AvalAI API key and public cf.* model IDs. Choose the endpoint for the task: conversational models, typed decision models, and extraction models use different request and response schemas.

Eight New Models: Extraction, Decisions, and Open Models ​

Reviewed: October 24, 2026. These eight models are available from AvalAI tier 0. The tables record AvalAI's public IDs, token limits, and prices; linked Cloudflare pages describe the upstream models. Send the AvalAI ID, not the Workers AI identifier, in your AvalAI request's model field.

AvalAI model IDPurpose and official model sourceContext / maximum input tokens
cf.clairicTyped extraction (preview)65536
cf.clef27B typed decision model65536
cf.clef-flashFast 9B typed decision model24576
cf.clef-omniMultimodal decisions, 30B / 3B active64000
cf.phonellm-mini-alpha-2Text dialogue for voice agents262140
cf.apertus-v1.5-8b8B multilingual open model262144
cf.eurollm-9b-it9B multilingual instruction model32768
cf.moondream3.1-9b-a2bVision-language model, 9B / 2B active32768

Keep cf.moondream3.1-9b-a2b lowercase in AvalAI requests; Cloudflare’s model page spells the upstream name moondream3.1-9B-A2B. Context figures describe the cataloged capacity, not a guaranteed output budget. State, instructions, question or field schemas, and supported media consume request capacity. AvalAI's EuroLLM catalog lists 32768 tokens, while Cloudflare's model page lists 32000; the table uses the AvalAI limit. The Apertus limit comes from AvalAI's rate-limit catalog and agrees with Cloudflare's 262144-token context.

Pricing ​

Prices are USD per 1 million tokens, with input, cached input, and output billed separately:

AvalAI model IDInputCached inputOutput
cf.clairic$0.10$0.00$0.00
cf.clef$0.24$0.00$0.00
cf.clef-flash$0.038$0.00$0.00
cf.clef-omni$0.15$0.00$0.00
cf.phonellm-mini-alpha-2$0.06$0.006$0.24
cf.apertus-v1.5-8b$0.10$0.01$0.20
cf.eurollm-9b-it$0.10$0.01$0.20
cf.moondream3.1-9b-a2b$0.30$0.03$1.00

Zero output pricing for Clairic and Clef means that their typed answers have no output-token charge; the input is still billable. For example, a total of 100,000 uncached billable input tokens across requests costs $0.01 with Clairic or $0.0038 with Clef-flash; this is an aggregate billing example, not a single-request size. Use the endpoint's reported usage, including schema and media work where applicable, to reconcile a request. A cached-input price applies to tokens actually accounted for as cached; it does not establish cache hits, a cache lifetime, or support for cache-control parameters. See pricing and response headers.

Clairic: Typed Extraction ​

cf.clairic is Cloudflare's preview extraction model. Define named fields with explicit types, supply source text, and read typed answers rather than generated conversation text. Its native schema supports nine field types: text, number, date, time, datetime, duration, list, estimate, and forecast, with confidence or distribution information appropriate to the field type. An unsupported or missing fact may produce value: null; a plausible guess does not replace that null value.

Use POST /v1/extraction through AvalAI. Clairic is not a Chat Completions or Clef decision model. The Extraction API reference documents state, fields, optional image inputs, and the keyed answers envelope. The extraction-model guide explains source spans, uncertainty, missing values, and application validation. Cloudflare describes embedded image support upstream; use the reference's format and limits rather than passing Chat Completions image_url content or assuming remote URLs are accepted.

Clef: Typed Multimodal Decisions ​

The Clef family evaluates evidence against explicit questions and returns choices, scores, or yes/no probabilities:

  • cf.clef is the 27B-parameter model for typed judgments over text, structured state, and upstream image inputs.
  • cf.clef-flash is the fast 9B-parameter alternative with a smaller context and lower input price.
  • cf.clef-omni uses a 30B-parameter mixture-of-experts backbone with 3B active parameters. Its native schema adds embedded audio and video to text, structured state, and images.

All three use /v1/decisions and /v1/systemone in AvalAI. The Decisions reference uses input and an array of questions; the System One reference uses state and a question map with native noul, choice, and score types. The response envelopes also differ. These models do not use /v1/chat/completions, /v1/responses, /v1/messages, or /v1/extraction.

Cloudflare's descriptions mention video for Clef and Clef-flash, but their raw native schemas expose images and do not define videos. Reserve audio/video claims for Clef-omni. Native media fields are not automatically valid Decisions fields, and upstream media support does not establish an executed AvalAI media request. Follow the System One media-scope notes for formats, size limits, and verification boundaries. Keep downstream actions subject to your application's permissions and validation; a model judgment does not authorize an action.

PhoneLLM, Apertus, EuroLLM, and Moondream ​

These four models use /v1/chat/completions for the documented conversational workflows:

  • cf.phonellm-mini-alpha-2 is Daily's open text model tuned for voice-agent dialogue. Cloudflare describes it as based on Nemotron Nano 30B capabilities, with thinking disabled. AvalAI's catalog enables function calling for this ID. Voice-agent tuning describes its dialogue behavior; it does not establish speech recognition, audio input, or speech output. Use separate speech components for those parts of a voice pipeline.
  • cf.apertus-v1.5-8b is Swiss AI's 8B multilingual model, developed with fully open training data. Cloudflare advertises vision and function calling upstream, but AvalAI's catalog disables function calling for this ID. This page documents text chat; do not infer AvalAI vision or tool support from the upstream badges.
  • cf.eurollm-9b-it is the 9B instruction-tuned EuroLLM model. Cloudflare reports training on 4 trillion tokens drawn from multilingual web, parallel, and curated high-quality data. Use it for multilingual dialogue and text tasks, with the AvalAI context limit shown above.
  • cf.moondream3.1-9b-a2b is a vision-language model with 9B total and 2B active parameters. Cloudflare describes visual reasoning, OCR, object detection, and pointing. AvalAI exposes the model through the Chat Completions vision format; see the vision guide. Cloudflare's native task: query/caption/point/detect, image, target, and reasoning fields belong to its native skill API and are not established AvalAI Chat Completions parameters or response shapes.

Text Chat Example with PhoneLLM ​

Read AVALAI_API_KEY from your server environment. For the Python and Node.js versions, install the corresponding openai SDK in your application's environment; the JavaScript example is a Node.js ES module. All three clients below send the same JSON request. They use a 60-second timeout and make one attempt; the SDK examples disable automatic retries.

bash
curl --fail-with-body --connect-timeout 10 --max-time 60 \
  https://api.avalai.ir/v1/chat/completions \
  -H "Authorization: Bearer $AVALAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "cf.phonellm-mini-alpha-2",
    "messages": [
      {"role": "system", "content": "Return one short sentence suitable for a voice assistant."},
      {"role": "user", "content": "Confirm that my appointment is booked for Tuesday at 10 AM."}
    ],
    "max_tokens": 256
  }'
python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
    timeout=60.0,
    max_retries=0,
)
response = client.chat.completions.create(
    model="cf.phonellm-mini-alpha-2",
    messages=[
        {
            "role": "system",
            "content": "Return one short sentence suitable for a voice assistant.",
        },
        {
            "role": "user",
            "content": "Confirm that my appointment is booked for Tuesday at 10 AM.",
        },
    ],
    max_tokens=256,
)
print(response.choices[0].message.content)
javascript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.AVALAI_API_KEY,
  baseURL: "https://api.avalai.ir/v1",
  timeout: 60000,
  maxRetries: 0,
});
const response = await client.chat.completions.create({
  model: "cf.phonellm-mini-alpha-2",
  messages: [
    { role: "system", content: "Return one short sentence suitable for a voice assistant." },
    { role: "user", content: "Confirm that my appointment is booked for Tuesday at 10 AM." },
  ],
  max_tokens: 256,
});
console.log(response.choices[0].message.content);

The following is a complete illustrative Chat Completions response, with invented text, identifiers, and token counts. It is not a captured AvalAI result or a billing receipt. The hypothetical estimated_cost uses the listed PhoneLLM rates, the sample token counts, and an illustrative exchange rate of 270000 toman per USD:

json
{
  "id": "chatcmpl-example",
  "object": "chat.completion",
  "created": 1792843200,
  "model": "cf.phonellm-mini-alpha-2",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Your appointment is booked for Tuesday at 10 AM."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 33,
    "completion_tokens": 12,
    "total_tokens": 45
  },
  "estimated_cost": {
    "unit": "0.0000048600",
    "irt": 1.31,
    "exchange_rate": 270000
  }
}

Read text from choices[0].message.content and inspect finish_reason and actual usage. The appointment message is synthetic test input; a generated confirmation does not verify a booking in your application. Change only model to cf.apertus-v1.5-8b or cf.eurollm-9b-it for a text-only comparison, then evaluate the response in your own workflow. For images with Moondream, use the vision message structure instead. For Clairic or Clef, choose their dedicated endpoint and schema rather than changing this example's model ID.

On an HTTP error, inspect the returned error body and retain avalai-request-id when present. Correct invalid fields or a mismatched model/endpoint before retrying; authentication and exhausted quota require intervention. This example adds no retry loop. See the error-handling guide for troubleshooting. The requests and client code are schema-based examples; live model responses, optional features, and SDK execution require separate validation with your account.

Available Models ​

Cloudflare AI models span multiple categories and providers, from compact text models to larger reasoning systems. The following sections cover other model families; use the task-specific endpoint guidance above for the eight new IDs.

Meta Llama Models ​

Cloudflare hosts a comprehensive collection of Meta's Llama models, from the latest Llama 4 Scout to various versions of Llama 3.x series.

ModelParametersSpecializationContext Window
cf.llama-4-scout-17b-16e-instruct17B (16 experts)Multimodal, Text & Image128K
cf.llama-3.3-70b-instruct-fp8-fast70B (FP8)Fast inference, General purpose128K
cf.llama-3.1-8b-instruct-fast8BFast multilingual dialogue128K
cf.llama-3.1-8b-instruct-awq8B (int4)Efficient inference128K
cf.llama-3.1-8b-instruct-fp88B (FP8)Balanced performance128K
cf.llama-3.1-8b-instruct8BStandard dialogue128K
cf.llama-3.1-70b-instruct70BComplex reasoning128K
cf.llama-3.2-1b-instruct1BCompact dialogue128K
cf.llama-3.2-3b-instruct3BAgentic tasks128K
cf.meta-llama-3-8b-instruct8BImproved reasoning8K
cf.llama-3-8b-instruct-awq8B (int4)Efficient deployment8K
cf.llama-3-8b-instruct8BStandard instruction8K
cf.llama-guard-3-8b8BContent safety8K

Llama 4 Scout - Multimodal Excellence ​

The newest addition to the Llama family, featuring native multimodal capabilities:

python
from openai import OpenAI

client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")

# Text and image understanding
completion = client.chat.completions.create(
    model="cf.llama-4-scout-17b-16e-instruct",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "What's in this image?"},
                {
                    "type": "image_url",
                    "image_url": {"url": "data:image/jpeg;base64,..."},
                },
            ],
        }
    ],
)
Responses API version This version uses `gpt-5.5` because `cf.llama-4-scout-17b-16e-instruct` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.6-luna",
    input=[
        {
            "role": "user",
            "content": [
                {"type": "input_text", "text": "Describe this image."},
                {"type": "input_image", "image_url": "https://example.com/image.png"},
            ],
        }
    ],
)

print(response.output_text)
  • messages → input
  • system message → instructions or a developer item
  • choices[0].message.content → response.output_text
  • for tools and multimodal output, inspect response.output by item type.

Google Gemma Models ​

Google's Gemma models offer excellent performance with multilingual capabilities and LoRA support.

ModelParametersSpecializationContext Window
cf.gemma-3-12b-it12BMultimodal, 140+ languages128K
cf.gemma-7b-it-lora7BLoRA fine-tuning8K
cf.gemma-2b-it-lora2BCompact LoRA8K
cf.gemma-7b-it7BGeneral instruction8K

Gemma 3 - Advanced Multimodal ​

python
# Gemma 3 with extended context
completion = client.chat.completions.create(
    model="cf.gemma-3-12b-it",
    messages=[
        {
            "role": "user",
            "content": "Analyze this document and provide a comprehensive summary.",
        }
    ],
    max_tokens=2048,
)
Responses API version This version uses `gpt-5.5` because `cf.gemma-3-12b-it` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.6-luna",
    input=[
        {
            "role": "user",
            "content": [
                {
                    "type": "input_text",
                    "text": "Analyze this document and provide a comprehensive summary.",
                },
                {"type": "input_file", "file_id": "file_abc123"},
            ],
        }
    ],
)

print(response.output_text)
  • messages → input
  • system message → instructions or a developer item
  • choices[0].message.content → response.output_text
  • for tools and multimodal output, inspect response.output by item type.

Mistral AI Models ​

Mistral's latest models with enhanced vision understanding and extended context capabilities.

ModelParametersSpecializationContext Window
cf.mistral-small-3.1-24b-instruct24BVision + Text, Function calling128K

Mistral Small 3.1 - Vision Enhanced ​

python
# Function calling with vision
completion = client.chat.completions.create(
    model="cf.mistral-small-3.1-24b-instruct",
    messages=[
        {"role": "user", "content": "Analyze this chart and extract the key metrics"}
    ],
    tools=[
        {
            "type": "function",
            "function": {
                "name": "extract_metrics",
                "description": "Extract numerical metrics from data",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "metrics": {"type": "array", "items": {"type": "number"}}
                    },
                },
            },
        }
    ],
)
Responses API version This version uses `gpt-5.5` because `cf.mistral-small-3.1-24b-instruct` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

tools = [
    {
        "type": "function",
        "name": "get_current_weather",
        "description": "Get the current weather in a given location.",
        "parameters": {
            "type": "object",
            "properties": {"location": {"type": "string"}},
            "required": ["location"],
            "additionalProperties": False,
        },
    }
]

response = client.responses.create(
    model="gpt-5.6-luna",
    input="Analyze this chart and extract the key metrics",
    tools=tools,
)

for item in response.output:
    if item.type == "function_call":
        print(item.name, item.arguments)
print(response.output_text)
  • messages → input
  • system message → instructions or a developer item
  • choices[0].message.content → response.output_text
  • for tools and multimodal output, inspect response.output by item type.

Qwen Models ​

Alibaba's Qwen models specialized for reasoning, code generation, and embeddings.

ModelParametersSpecializationContext Window
cf.qwq-32b32BAdvanced reasoning32K
cf.qwen2.5-coder-32b-instruct32BCode generation128K
cf.qwen3-30b-a3b-fp830B (FP8)Chat, balanced performance128K
cf.qwen3-embedding-0.6b0.6BText embeddingsN/A

QwQ - Reasoning Model ​

python
# Advanced reasoning tasks
completion = client.chat.completions.create(
    model="cf.qwq-32b",
    messages=[
        {
            "role": "user",
            "content": "Solve this complex math problem step by step: If a train travels 120 km in 2 hours, and then increases its speed by 20%, how long will it take to travel the next 180 km?",
        }
    ],
    temperature=0.1,  # Lower temperature for reasoning tasks
)
Responses API version This version uses `gpt-5.5` because `cf.qwq-32b` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.6-luna",
    instructions="You are a helpful assistant.",
    input="Solve this complex math problem step by step: If a train travels 120 km in 2 hours, and then increases its speed by 20%, how long will it take to travel the next 180 km?",
)

print(response.output_text)
  • messages → input
  • system message → instructions or a developer item
  • choices[0].message.content → response.output_text
  • for tools and multimodal output, inspect response.output by item type.

Qwen2.5-Coder - Programming Specialist ​

python
# Code generation and explanation
completion = client.chat.completions.create(
    model="cf.qwen2.5-coder-32b-instruct",
    messages=[
        {
            "role": "user",
            "content": "Write a Python function to implement a binary search tree with insert, search, and delete operations.",
        }
    ],
)
Responses API version This version uses `gpt-5.5` because `cf.qwen2.5-coder-32b-instruct` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.6-luna",
    instructions="You are a helpful assistant.",
    input="Write a Python function to implement a binary search tree with insert, search, and delete operations.",
)

print(response.output_text)
  • messages → input
  • system message → instructions or a developer item
  • choices[0].message.content → response.output_text
  • for tools and multimodal output, inspect response.output by item type.

DeepSeek Models ​

DeepSeek's distilled reasoning models offering competitive performance.

ModelParametersSpecializationContext Window
cf.deepseek-r1-distill-qwen-32b32BReasoning, outperforms o1-mini128K

OpenAI Open Source Models ​

OpenAI's open-weight models available on Cloudflare's edge network.

ModelParametersSpecializationContext Window
cf.gpt-oss-120b120BLarge-scale reasoning128K
cf.gpt-oss-20b20BEfficient general purpose128K

NVIDIA Nemotron Models ​

NVIDIA's latest Nemotron models with hybrid LatentMoE architecture.

ModelParametersSpecializationContext Window
cf.nemotron-3-120b-a12b120B (12B active)Agentic workflows, long-context reasoning1M

Nemotron-3-120B-A12B - Agentic Excellence ​

NVIDIA's Nemotron-3-Super-120B-A12B is a large language model designed to deliver strong agentic, reasoning, and conversational capabilities. It employs a hybrid LatentMoE architecture utilizing interleaved Mamba-2 and MoE layers with Multi-Token Prediction (MTP) for faster text generation.

FeatureDetails
Total Parameters120B (12B active)
ArchitectureLatentMoE - Mamba-2 + MoE + Attention hybrid
Context window1,000,000 tokens
Input pricing$0.50 / 1M tokens
Cached input pricing$0.05 / 1M tokens (90% cost reduction)
Output pricing$1.50 / 1M tokens
Supported languagesEnglish, French, German, Italian, Japanese, Spanish, Chinese
Best forAgentic workflows, long-context reasoning, high-volume workloads, IT ticket automation

Key Features:

  • 1M Context Window: Industry-leading context length for extensive documents
  • Configurable Reasoning: Enable or disable reasoning mode via chat template
  • Multi-Token Prediction: MTP layers for faster text generation
  • Tool Use & RAG: Excellent for tool calling and retrieval-augmented generation
  • Cost-Effective: Only 12B active parameters for exceptional efficiency

Benchmark Highlights:

  • SWE-Bench (OpenHands): 60.47%
  • AIME 2025: 90.21%
  • HMMT Feb 2025 (with tools): 94.73%
  • LiveCodeBench: 81.19%
python
from openai import OpenAI

client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")

# Long-context reasoning with Nemotron
completion = client.chat.completions.create(
    model="cf.nemotron-3-120b-a12b",
    messages=[
        {
            "role": "user",
            "content": "Analyze this extensive codebase and suggest architectural improvements for better scalability.",
        }
    ],
    temperature=1.0,  # Recommended setting for Nemotron
    top_p=0.95,
)

print(completion.choices[0].message.content)
Responses API version This version uses `gpt-5.5` because `cf.nemotron-3-120b-a12b` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.6-luna",
    instructions="You are a helpful assistant.",
    input="Analyze this extensive codebase and suggest architectural improvements for better scalability.",
)

print(response.output_text)
  • messages → input
  • system message → instructions or a developer item
  • choices[0].message.content → response.output_text
  • for tools and multimodal output, inspect response.output by item type.

IBM Granite Models ​

IBM's Granite models for enterprise applications.

ModelParametersSpecializationContext Window
cf.granite-4.0-h-microMicroEfficient enterprise chat128K

Image Generation Models ​

Cloudflare AI offers powerful image generation models via the v1/images/generations endpoint.

ModelDescriptionBase Price (1MP)
cf.flux-2-klein-9bFLUX 2 Klein 9B parameter model$0.015/image
cf.flux-2-klein-4bFLUX 2 Klein 4B compact model$0.010/image
cf.flux-2-devFLUX 2 Development model$0.010/image
cf.lucid-originLucid Origin image generation$0.015/image
cf.phoenix-1.0Phoenix 1.0 image generation$0.015/image

Image Generation Example ​

python
from openai import OpenAI

client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")

# Generate an image with FLUX 2 Klein
response = client.images.generate(
    model="cf.flux-2-klein-9b",
    prompt="A futuristic cityscape at sunset with flying cars",
    n=1,
    size="1024x1024",
)

print(response.data[0].url)

Embedding Models ​

Cloudflare AI provides embedding models for semantic search and text analysis via the v1/embeddings endpoint.

ModelOwnerDescriptionInput Price ($/1M tokens)
cf.qwen3-embedding-0.6bAlibabaQwen3 Embedding 0.6B$0.012
cf.plamo-embedding-1bPFNPLaMo Embedding 1B$0.019
cf.embeddinggemma-300mGoogleEmbeddingGemma 300M$0.012

Embedding Example ​

python
from openai import OpenAI

client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")

# Generate embeddings
response = client.embeddings.create(
    model="cf.qwen3-embedding-0.6b",
    input="Machine learning enables computers to learn from data.",
)

embedding = response.data[0].embedding
print(f"Embedding dimension: {len(embedding)}")

Key Parameters ​

The following parameters apply to conversational models that support them through Chat Completions. Defaults and limits vary by model; the table is not a contract for every Cloudflare model. Clairic and Clef use the fields in their dedicated endpoint references:

ParameterDescriptionDefaultRange
temperatureControls randomness0.70.0-2.0
max_tokensMaximum response length20481-4096
top_pNucleus sampling1.00.0-1.0
frequency_penaltyReduces repetition0.0-2.0-2.0
presence_penaltyEncourages new topics0.0-2.0-2.0

API Endpoints ​

Cloudflare models are available through multiple AvalAI endpoints depending on model type:

  • Chat Completions: /v1/chat/completions for enabled conversational and vision models, including PhoneLLM, Apertus, EuroLLM, and Moondream above.
  • Extraction: /v1/extraction for cf.clairic.
  • Decisions: /v1/decisions and native /v1/systemone for cf.clef, cf.clef-flash, and cf.clef-omni.
  • Responses: /v1/responses only for models enabled for that route; support is model-specific and may be partial.
  • Embeddings: /v1/embeddings for embedding models.
  • Image Generation: /v1/images/generations for image-generation models.
  • Messages: /v1/messages only for models enabled for that route; support is model-specific and may be partial.

The new Clairic and Clef IDs are excluded from Chat Completions, Responses, and Messages. This launch does not announce Responses or Messages support for the four new conversational models. The existing Responses adaptation examples below select a different enabled model; they do not establish Responses support for the Cloudflare ID in the paired chat example.

Example Usage ​

Basic Text Generation ​

python
from openai import OpenAI

client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")

completion = client.chat.completions.create(
    model="cf.llama-3.1-8b-instruct",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain quantum computing in simple terms."},
    ],
    temperature=0.7,
    max_tokens=1024,
)

print(completion.choices[0].message.content)
Responses API version This version uses `gpt-5.5` because `cf.llama-3.1-8b-instruct` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.6-luna",
    instructions="You are a helpful assistant.",
    input="Explain quantum computing in simple terms.",
)

print(response.output_text)
  • messages → input
  • system message → instructions or a developer item
  • choices[0].message.content → response.output_text
  • for tools and multimodal output, inspect response.output by item type.

Streaming Responses ​

python
# Streaming for real-time responses
stream = client.chat.completions.create(
    model="cf.llama-3.3-70b-instruct-fp8-fast",
    messages=[
        {"role": "user", "content": "Write a short story about AI and humanity."}
    ],
    stream=True,
)

for chunk in stream:
    if chunk.choices[0].delta.content is not None:
        print(chunk.choices[0].delta.content, end="")
Responses API version This version uses `gpt-5.5` because `cf.llama-3.3-70b-instruct-fp8-fast` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.6-luna",
    instructions="You are a helpful assistant.",
    input="Write a short story about AI and humanity.",
)

print(response.output_text)
  • messages → input
  • system message → instructions or a developer item
  • choices[0].message.content → response.output_text
  • for tools and multimodal output, inspect response.output by item type.

Function Calling ​

python
# Function calling with supported models
completion = client.chat.completions.create(
    model="cf.mistral-small-3.1-24b-instruct",
    messages=[{"role": "user", "content": "What's the weather like in Paris?"}],
    tools=[
        {
            "type": "function",
            "function": {
                "name": "get_weather",
                "description": "Get current weather for a city",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "city": {"type": "string", "description": "City name"}
                    },
                    "required": ["city"],
                },
            },
        }
    ],
)
Responses API version This version uses `gpt-5.5` because `cf.mistral-small-3.1-24b-instruct` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

tools = [
    {
        "type": "function",
        "name": "get_current_weather",
        "description": "Get the current weather in a given location.",
        "parameters": {
            "type": "object",
            "properties": {"location": {"type": "string"}},
            "required": ["location"],
            "additionalProperties": False,
        },
    }
]

response = client.responses.create(
    model="gpt-5.6-luna",
    input="What",
    tools=tools,
)

for item in response.output:
    if item.type == "function_call":
        print(item.name, item.arguments)
print(response.output_text)
  • messages → input
  • system message → instructions or a developer item
  • choices[0].message.content → response.output_text
  • for tools and multimodal output, inspect response.output by item type.

Best Practices ​

Model Selection ​

  • For speed: Use FP8 or AWQ quantized models like cf.llama-3.3-70b-instruct-fp8-fast
  • For reasoning: Choose cf.qwq-32bor cf.deepseek-r1-distill-qwen-32b
  • For code: Use cf.qwen2.5-coder-32b-instruct
  • For multimodal: Select cf.llama-4-scout-17b-16e-instruct or cf.gemma-3-12b-it
  • For efficiency: Try compact models like cf.llama-3.2-1b-instruct

Performance Optimization ​

  1. Use appropriate quantization: FP8 models offer good balance of speed and quality
  2. Leverage edge deployment: Models run on Cloudflare's global network for low latency
  3. Context management: Budget state, instructions, supported media, and output against the selected model’s limits; the new models have different contexts as listed above
  4. Streaming: Enable streaming for better user experience in interactive applications

Content Safety ​

Implement cf.llama-guard-3-8bfor content moderation:

python
# Content safety check
safety_check = client.chat.completions.create(
    model="cf.llama-guard-3-8b",
    messages=[{"role": "user", "content": "User message to check for safety"}],
)
Responses API version This version uses `gpt-5.5` because `cf.llama-guard-3-8b` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.6-luna",
    instructions="You are a helpful assistant.",
    input="User message to check for safety",
)

print(response.output_text)
  • messages → input
  • system message → instructions or a developer item
  • choices[0].message.content → response.output_text
  • for tools and multimodal output, inspect response.output by item type.

Using Cloudflare Models via AvalAI ​

Cloudflare models use AvalAI authentication, with the endpoint and request format selected for each task. Enabled conversational models use Chat Completions; Clairic uses Extraction, and Clef uses Decisions or native System One. Reuse an existing client only when it implements the selected endpoint's schema.

Authentication ​

python
client = OpenAI(
    api_key="your-avalai-api-key",  # Your AvalAI API key
    base_url="https://api.avalai.ir/v1",  # AvalAI endpoint
)

Rate Limits ​

Cloudflare models follow AvalAI's standard rate limiting policies. Check your tier limits in the Rate Limits Guide.