Skip to content

Conversation

Sagit-chu
Copy link
Owner

Synced from upstream PR: songquanpeng#2311

功能特性:

  1. 全面的模型别名映射系统 (relay/model/alias.go)
  2. 支持多渠道别名 (OpenRouter, Anthropic, Gemini, Groq)
  3. 能力注册自动创建标准名称和渠道名称的双重映射
  4. 请求处理中集成别名解析 (先别名解析,再模型映射)
  5. 计费系统支持别名模型的费率查找
  6. 完整的测试覆盖和性能优化

支持的模型映射示例:

  • gpt-4o → OpenRouter: openai/gpt-4o, OpenAI: gpt-4o
  • claude-3-sonnet → OpenRouter: anthropic/claude-3-sonnet, Anthropic: claude-3-sonnet-20240229
  • llama-3-8b-instruct → OpenRouter: meta-llama/llama-3-8b-instruct, Groq: llama3-8b-8192

close songquanpeng#2310

- Add comprehensive model alias mapping system in relay/model/alias.go
- Support standard model names (gpt-4o, claude-3-sonnet) across different channels
- Modify AddAbilities() to create aliases for both standard and channel-specific names
- Update text processing to resolve aliases before channel-specific mapping
- Enhance billing system to support alias-based model ratio lookup
- Add comprehensive tests for alias resolution and reverse mapping
- Support major providers: OpenRouter, Anthropic, Gemini, Groq

This allows users to use consistent model names (e.g., 'gpt-4o')
regardless of channel provider, with automatic mapping to
channel-specific names (e.g., 'openai/gpt-4o' for OpenRouter).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

实现模型别名系统,支持跨渠道统一模型名称
2 participants