关于 ai-chat-studio
AI Chat Studio 是面向应用开发者的多模型聊天编排框架,提供 300 多种助手预设、模型路由和对话管理。它根据任务特点与成本、能力和延迟需求选择模型,并为不同任务配置提示词和参数。
主要功能
- 01300 多种助手预设
- 02按任务特征路由模型
- 03多提供方模型配置
- 04对话历史与上下文管理
- 05聊天响应流式输出
适用场景
- 01为不同任务选择合适的模型
- 02部署带有领域配置的 AI 助手
- 03跨提供方比较相同提示词的输出
- 04在应用中管理多模型聊天
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ itallstartedwithaidea/ agent-skills --skill ai-chat-studio安装后在 Claude Code 中输入/ai-chat-studio确认已加载。
详细介绍
AI Chat Studio
Agent Skills™ 的一部分,由 googleadsagent.ai™ 提供
描述
AI Chat Studio 提供多大模型聊天编排框架,包含 300 多个助手预设、智能模型路由和对话管理。该 Agent 可配置和管理与多个语言模型提供商(OpenAI、Anthropic、Google、开源模型)的交互,并根据能力、成本和延迟要求,为每项任务选择最合适的模型。
并非每项任务都需要最强大的模型。代码审查适合使用推理能力强的模型;翻译任务使用中档模型即可;简单的格式调整若使用快速、低成本模型以外的模型,则会造成浪费。此技能实现了智能路由,可根据任务特征匹配模型能力,在保证关键环节质量的同时降低 40%–60% 的成本。
这 300 多个助手预设为常见任务配置了特定领域的系统提示词、温度设置和输出格式限制,包括代码生成、技术写作、数据分析、创意构思、客户支持、法律审查等。每个预设都经过质量基准测试,并标注了效果最佳的模型。
使用场景
- 在应用中配置多提供商大模型访问
- 根据成本与质量的权衡,将任务路由至最合适的模型
- 管理对话历史和上下文窗口
- 使用精选预设部署特定领域的 AI 助手
- 构建支持流式响应的聊天界面
- 跨提供商比较同一提示词的模型输出
工作原理
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]
任务分类器会分析传入消息,判断其复杂度和领域,然后将其路由至能够处理该任务且最具成本效益的模型。预设提供特定领域的系统提示词和参数调优。
实现
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);
}
}
最佳实践
- 将简单任务路由至更便宜的模型——80% 的查询无需使用前沿模型
- 为所有聊天交互实现流式响应,提升用户感知的响应速度
- 从对话历史中间部分开始裁剪,同时保留系统提示词和近期消息
- 记录模型选择决策及其成本,以便持续优化路由规则
- 在部署到生产环境之前,使用基准数据集测试预设
- 为每条路由配置备用模型,以防主要提供商不可用
平台兼容性
| 平台 | 支持情况 | 备注 |
|---|---|---|
| Cursor | 完全支持 | 多模型配置 |
| VS Code | 完全支持 | 基于扩展的大模型访问 |
| Windsurf | 完全支持 | 内置模型路由 |
| Claude Code | 完全支持 | 支持多个提供商 |
| Cline | 完全支持 | 模型选择配置 |
| aider | 完全支持 | 多种模型后端 |
相关技能
关键词
ai-chat multi-llm model-routing assistant-presets conversation-management streaming cost-optimization chat-studio
© 2026 googleadsagent.ai™ | Agent Skills™ | MIT License