ai-chat-studio

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

AI Chat Studio

AI Chat Studio

Description

描述

AI Chat Studio provides a multi-LLM chat orchestration framework with 300+ assistant presets, intelligent model routing, and conversation management. The agent configures and manages interactions across multiple language model providers—OpenAI, Anthropic, Google, open-source models—selecting the optimal model for each task based on capability, cost, and latency requirements.
Not every task needs the most powerful model. A code review benefits from a reasoning-heavy model; a translation task runs well on a mid-tier model; a simple reformatting task wastes money on anything beyond a fast, cheap model. This skill implements intelligent routing that matches task characteristics to model capabilities, reducing cost by 40-60% while maintaining quality where it matters.
The 300+ assistant presets encode domain-specific system prompts, temperature settings, and output format constraints for common tasks: code generation, technical writing, data analysis, creative ideation, customer support, legal review, and more. Each preset is tested against a quality benchmark and tagged with the models it performs best on.
AI Chat Studio 提供了一个多 LLM 聊天编排框架,包含 300+ 个助手预设、智能模型路由以及对话管理功能。该 Agent 负责配置和管理跨多个语言模型提供商的交互,包括 OpenAI、Anthropic、Google 和开源模型,并根据任务的能力、成本和延迟要求,为每项任务选择最优模型。
并非每项任务都需要使用最强大的模型。代码审查适合使用偏重推理的模型;翻译任务在中端模型上即可良好运行;简单的格式调整任务则无需消耗高于快速、低成本模型的其他模型费用。该 skill 实现了智能路由,可将任务特征与模型能力进行匹配,在关键场景保持质量的同时将成本降低 40-60%。
这 300+ 个助手预设包含常见任务的领域专用系统提示词、temperature 设置和输出格式约束,涵盖代码生成、技术写作、数据分析、创意构思、客户服务、法律审查等场景。每个预设均经过质量基准测试,并标注了其表现最佳的模型。

Use When

使用场景

  • Configuring multi-provider LLM access in an application
  • Routing tasks to the optimal model by cost-quality trade-off
  • Managing conversation history and context windows
  • Deploying domain-specific AI assistants with curated presets
  • Building chat interfaces with streaming responses
  • Comparing model outputs for the same prompt across providers
  • 在应用中配置多提供商 LLM 接入
  • 根据成本与质量的权衡将任务路由至最优模型
  • 管理对话历史和上下文窗口
  • 使用经过精选的预设部署领域专用 AI 助手
  • 构建支持流式响应的聊天界面
  • 针对同一提示词比较不同提供商的模型输出

How It Works

工作原理

mermaid
graph TD
    A[User Message] --> B[Task Classifier]
    B --> C{Task Type}
    C -->|Complex Reasoning| D[Claude 4 / GPT-4o]
    C -->|Code Generation| E[Claude 4 / Codestral]
    C -->|Translation| F[GPT-4o-mini / Gemini Flash]
    C -->|Simple Format| G[Haiku / Flash]
    D --> H[Apply Preset: System Prompt + Params]
    E --> H
    F --> H
    G --> H
    H --> I[Manage Context Window]
    I --> J[Stream Response]
    J --> K[Log Usage + Cost]
The task classifier analyzes the incoming message to determine complexity and domain, then routes to the most cost-effective model capable of handling it. Presets provide domain-specific system prompts and parameter tuning.
mermaid
graph TD
    A[User Message] --> B[Task Classifier]
    B --> C{Task Type}
    C -->|Complex Reasoning| D[Claude 4 / GPT-4o]
    C -->|Code Generation| E[Claude 4 / Codestral]
    C -->|Translation| F[GPT-4o-mini / Gemini Flash]
    C -->|Simple Format| G[Haiku / Flash]
    D --> H[Apply Preset: System Prompt + Params]
    E --> H
    F --> H
    G --> H
    H --> I[Manage Context Window]
    I --> J[Stream Response]
    J --> K[Log Usage + Cost]
任务分类器会分析传入的消息,以确定其复杂度和所属领域,然后将其路由至能够处理该任务且最具成本效益的模型。预设则提供领域专用系统提示词和参数调优。

Implementation

实现

typescript
interface ModelConfig {
  provider: "openai" | "anthropic" | "google" | "ollama";
  model: string;
  maxTokens: number;
  costPer1kInput: number;
  costPer1kOutput: number;
  capabilities: string[];
}

const MODEL_REGISTRY: ModelConfig[] = [
  { provider: "anthropic", model: "claude-sonnet-4-20250514", maxTokens: 8192,
    costPer1kInput: 0.003, costPer1kOutput: 0.015, capabilities: ["reasoning", "code", "analysis"] },
  { provider: "openai", model: "gpt-4o-mini", maxTokens: 4096,
    costPer1kInput: 0.00015, costPer1kOutput: 0.0006, capabilities: ["general", "translation", "format"] },
  { provider: "google", model: "gemini-2.0-flash", maxTokens: 8192,
    costPer1kInput: 0.0001, costPer1kOutput: 0.0004, capabilities: ["general", "fast", "multimodal"] },
];

interface AssistantPreset {
  id: string;
  name: string;
  systemPrompt: string;
  temperature: number;
  preferredModels: string[];
  tags: string[];
}

class ChatRouter {
  constructor(private models: ModelConfig[], private presets: Map<string, AssistantPreset>) {}

  route(message: string, presetId?: string): { model: ModelConfig; preset?: AssistantPreset } {
    const preset = presetId ? this.presets.get(presetId) : undefined;
    const taskType = this.classifyTask(message);

    const candidates = this.models.filter(m =>
      m.capabilities.some(c => taskType.requiredCapabilities.includes(c))
    );

    const selected = candidates.sort((a, b) => a.costPer1kInput - b.costPer1kInput)[0];
    return { model: selected, preset };
  }

  private classifyTask(message: string): { type: string; requiredCapabilities: string[] } {
    const lower = message.toLowerCase();
    if (lower.includes("debug") || lower.includes("refactor") || lower.includes("architect"))
      return { type: "complex", requiredCapabilities: ["reasoning", "code"] };
    if (lower.includes("translate") || lower.includes("rewrite"))
      return { type: "simple", requiredCapabilities: ["general", "translation"] };
    return { type: "general", requiredCapabilities: ["general"] };
  }
}

class ConversationManager {
  private history: Array<{ role: string; content: string }> = [];
  private maxContextTokens: number;

  constructor(maxContextTokens: number = 100_000) {
    this.maxContextTokens = maxContextTokens;
  }

  addMessage(role: string, content: string): void {
    this.history.push({ role, content });
    this.trimToContextWindow();
  }

  getHistory(): Array<{ role: string; content: string }> {
    return [...this.history];
  }

  private trimToContextWindow(): void {
    while (this.estimateTokens() > this.maxContextTokens && this.history.length > 2) {
      this.history.splice(1, 1);
    }
  }

  private estimateTokens(): number {
    return this.history.reduce((sum, m) => sum + Math.ceil(m.content.length / 4), 0);
  }
}
typescript
interface ModelConfig {
  provider: "openai" | "anthropic" | "google" | "ollama";
  model: string;
  maxTokens: number;
  costPer1kInput: number;
  costPer1kOutput: number;
  capabilities: string[];
}

const MODEL_REGISTRY: ModelConfig[] = [
  { provider: "anthropic", model: "claude-sonnet-4-20250514", maxTokens: 8192,
    costPer1kInput: 0.003, costPer1kOutput: 0.015, capabilities: ["reasoning", "code", "analysis"] },
  { provider: "openai", model: "gpt-4o-mini", maxTokens: 4096,
    costPer1kInput: 0.00015, costPer1kOutput: 0.0006, capabilities: ["general", "translation", "format"] },
  { provider: "google", model: "gemini-2.0-flash", maxTokens: 8192,
    costPer1kInput: 0.0001, costPer1kOutput: 0.0004, capabilities: ["general", "fast", "multimodal"] },
];

interface AssistantPreset {
  id: string;
  name: string;
  systemPrompt: string;
  temperature: number;
  preferredModels: string[];
  tags: string[];
}

class ChatRouter {
  constructor(private models: ModelConfig[], private presets: Map<string, AssistantPreset>) {}

  route(message: string, presetId?: string): { model: ModelConfig; preset?: AssistantPreset } {
    const preset = presetId ? this.presets.get(presetId) : undefined;
    const taskType = this.classifyTask(message);

    const candidates = this.models.filter(m =>
      m.capabilities.some(c => taskType.requiredCapabilities.includes(c))
    );

    const selected = candidates.sort((a, b) => a.costPer1kInput - b.costPer1kInput)[0];
    return { model: selected, preset };
  }

  private classifyTask(message: string): { type: string; requiredCapabilities: string[] } {
    const lower = message.toLowerCase();
    if (lower.includes("debug") || lower.includes("refactor") || lower.includes("architect"))
      return { type: "complex", requiredCapabilities: ["reasoning", "code"] };
    if (lower.includes("translate") || lower.includes("rewrite"))
      return { type: "simple", requiredCapabilities: ["general", "translation"] };
    return { type: "general", requiredCapabilities: ["general"] };
  }
}

class ConversationManager {
  private history: Array<{ role: string; content: string }> = [];
  private maxContextTokens: number;

  constructor(maxContextTokens: number = 100_000) {
    this.maxContextTokens = maxContextTokens;
  }

  addMessage(role: string, content: string): void {
    this.history.push({ role, content });
    this.trimToContextWindow();
  }

  getHistory(): Array<{ role: string; content: string }> {
    return [...this.history];
  }

  private trimToContextWindow(): void {
    while (this.estimateTokens() > this.maxContextTokens && this.history.length > 2) {
      this.history.splice(1, 1);
    }
  }

  private estimateTokens(): number {
    return this.history.reduce((sum, m) => sum + Math.ceil(m.content.length / 4), 0);
  }
}

Best Practices

最佳实践

  • Route simple tasks to cheaper models—80% of queries do not need frontier models
  • Implement streaming responses for all chat interactions to improve perceived latency
  • Trim conversation history from the middle, preserving the system prompt and recent messages
  • Log model selection decisions alongside cost to optimize routing rules over time
  • Test presets against a benchmark dataset before deploying to production
  • Provide fallback models for every route in case the primary provider is unavailable
  • 将简单任务路由至成本更低的模型——80% 的查询并不需要前沿模型
  • 为所有聊天交互实现流式响应,以改善感知延迟
  • 从对话历史中部进行裁剪,同时保留系统提示词和近期消息
  • 记录模型选择决策及其成本,以持续优化路由规则
  • 在部署到生产环境前,使用基准数据集测试各个预设
  • 为每条路由提供备用模型,以防主要提供商不可用

Platform Compatibility

平台兼容性

PlatformSupportNotes
CursorFullMulti-model configuration
VS CodeFullExtension-based LLM access
WindsurfFullBuilt-in model routing
Claude CodeFullMulti-provider support
ClineFullModel selection config
aiderFullMultiple model backends
平台支持情况备注
Cursor完全支持多模型配置
VS Code完全支持基于扩展的 LLM 接入
Windsurf完全支持内置模型路由
Claude Code完全支持多提供商支持
Cline完全支持模型选择配置
aider完全支持多个模型后端

Related Skills

相关 Skills

  • Assistant Presets
  • Workflow Orchestration
  • Multi-Model Routing
  • Knowledge Base Injection
  • Assistant Presets
  • Workflow Orchestration
  • Multi-Model Routing
  • Knowledge Base Injection

Keywords

关键词

ai-chat
multi-llm
model-routing
assistant-presets
conversation-management
streaming
cost-optimization
chat-studio

© 2026 googleadsagent.ai™ | Agent Skills™ | MIT License
ai-chat
multi-llm
model-routing
assistant-presets
conversation-management
streaming
cost-optimization
chat-studio

© 2026 googleadsagent.ai™ | Agent Skills™ | MIT 许可证