Replies: 5 comments 1 reply
-
Pixiu AI 网关将输入统一为openai格式,通过一个适配器filter转换成对应的供应商的格式 graph TD
subgraph "客户端 (Client)"
UserRequest("👤 用户/客户端")
end
subgraph "AI 网关 (AI Gateway)"
A["入口: 接收标准OpenAI格式请求"]
B{"选择对应的适配器"}
subgraph "适配层 (Adapter Layer)"
C1["适配器: OpenAI (透传)"]
C2["适配器: Anthropic Claude"]
C3["适配器: Google Gemini"]
C4["适配器: ...更多"]
end
A --> B
B -- "model: 'gpt-4o'" --> C1
B -- "model: 'claude-3-opus-20240229'" --> C2
B -- "model: 'gemini-1.5-pro'" --> C3
end
subgraph "LLM 供应商 (LLM Providers)"
D1[☁️ OpenAI API]
D2[☁️ Anthropic API]
D3[☁️ Google AI API]
end
C1 --> D1
C2 --> D2
C3 --> D3
%% --- 转换过程示例 (Conversion Example) ---
subgraph "转换示例: OpenAI -> Anthropic"
direction LR
Input("输入请求 (OpenAI 格式):
POST /v1/chat/completions
{
'model': 'claude-3-opus-20240229',
'messages': [
{ 'role': 'system', 'content': '你是一个乐于助人的助手。' },
{ 'role': 'user', 'content': '你好,克劳德!' } ],
'max_tokens': 1024 }"
)
Output("输出请求 (Anthropic 格式):
POST /v1/messages
{
'model': 'claude-3-opus-20240229',
'system': '你是一个乐于助人的助手。',
'messages': [
{ 'role': 'user', 'content': '你好,克劳德!' } ],
'max_tokens': 1024 }"
)
Input -- "通过 Claude 适配器处理" --> Output
end
UserRequest --> A
%% Styling
style A fill:#D6EAF8,stroke:#3498DB
style B fill:#E8DAEF,stroke:#8E44AD
style C2 fill:#D5F5E3,stroke:#2ECC71
style Input fill:#FEF9E7,stroke:#F1C40F
style Output fill:#FDEDEC,stroke:#E74C3C
style C2 fill:#D5F5E3,stroke:#2ECC71
style A fill:#D6EAF8,stroke:#3498DB
style B fill:#E8DAEF,stroke:#8E44AD
style Output fill:#FDEDEC,stroke:#E74C3C
|
Beta Was this translation helpful? Give feedback.
-
可以更新下 task list,把 nacos 支持也加进去 |
Beta Was this translation helpful? Give feedback.
-
API密钥的健康探测对于密钥数组中的某个密钥,若触发了failover则视为该密钥不健康,对于不健康的密钥在下次请求的时候不会使用它发送请求,待超时机制过后重新探测其健康性 |
Beta Was this translation helpful? Give feedback.
-
LLM cluster endpoint 层级的设计现在的代码用的是方案2,但是我越来越觉得方案1要好(工作量要少很多,并且逻辑更加清晰) 方案一:一个 Endpoint 对应一个 API Key这种设计将一个 apikey 视为一个 # 方案一:原子化的 Endpoint
clusters:
- name: "chat"
lb_policy: "round_robin" # 假设是轮询
endpoints:
- id: 1
provider: "deepseek"
api_key: "key-1"
- id: 2
provider: "deepseek"
api_key: "key-2"
- id: 3
provider: "openai"
api_key: "key-3" 优势 (Pros)
劣势 (Cons)
方案二:一个 Endpoint 对应多个 API Key这种设计将一个供应商视为一个 # 方案二:分组的 Endpoint
clusters:
- name: "chat"
lb_policy: "round_robin" # 这个策略现在只作用于 Endpoint 列表 并不作用于api_keys列表
endpoints:
- id: 1
provider: "deepseek"
api_keys: # 一个 key 列表
- name: "apikey-1"
key: "key-1"
- name: "apikey-2"
key: "key-2" 优势 (Pros)
劣势 (Cons)
|
Beta Was this translation helpful? Give feedback.
-
ai-gateway observability grafana demonstrate ![]() ![]() |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
https://jimmysong.io/blog/ai-gateway-in-depth/
Step1: 基础
Step2: 兼容
1. 面向密钥的负载均衡[AI] AI gateway milestones #696 (comment)llmproxy
strategy, extract retry policy into a configurable strategy #692llmproxy
strategy, extract retry policy into a configurable strategy #692Step3: 完善
Beta Was this translation helpful? Give feedback.
All reactions