Creating Plot Twists
    Preparing search index...

    Type Alias ModelPreferences

    Model preferences for selecting an AI model based on performance and cost requirements. This allows Plot to match those preferences with user preferences (such as preferred or disallowed providers), as well as availability of newer and better models.

    // Fast and cheap - uses Workers AI models like Llama 3.2 1B
    const response = await ai.prompt({
    model: { speed: "fast", cost: "low" },
    prompt: "Summarize this in one sentence: ..."
    });

    // Balanced performance - uses GPT-5 Mini or Gemini 2.5 Flash
    const response = await ai.prompt({
    model: { speed: "balanced", cost: "medium" },
    prompt: "Analyze this data..."
    });

    // Most capable - uses Claude Sonnet 4.5 or Opus 4.1
    const response = await ai.prompt({
    model: { speed: "capable", cost: "high" },
    prompt: "Solve this complex reasoning problem..."
    });

    // Request a specific model with a hint
    const response = await ai.prompt({
    model: { speed: "balanced", cost: "medium", hint: AIModel.CLAUDE_SONNET_45 },
    prompt: "..."
    });
    type ModelPreferences = {
        speed: "fast" | "balanced" | "capable";
        cost: "low" | "medium" | "high";
        hint?: AIModel;
    }
    Index

    Properties

    Properties

    speed: "fast" | "balanced" | "capable"

    Desired speed tier:

    • "fast": Optimized for low latency and quick responses
    • "balanced": Good balance of speed and capability
    • "capable": Maximum reasoning and problem-solving ability
    cost: "low" | "medium" | "high"

    Desired cost tier:

    • "low": Minimal cost, often using Workers AI models (free/very cheap)
    • "medium": Moderate pricing for good performance
    • "high": Premium pricing for best-in-class models
    hint?: AIModel

    Optional hint to suggest a specific model. The system will use this model if possible, but may override it based on user preferences.