6242717e7b
- 新增 /opc/compute/*(require_roles opc_member): base(基础 API 地址)/models(可用模型)/prices(价目)/tokens(我的令牌 列表/创建/删除) - pineagents_catalog: 供应商自动对接 PineAgents 的模型与价目目录(与 /v1 中继模型一致) - compute_client: 新增 issue_user_token/list_user_tokens/delete_token(按用户名挂引擎用户) - 令牌创建经引擎签 PAT, 用户可自服务管理; 引擎数据经 server-core 代理, 前端不直连
37 lines
1.7 KiB
Python
37 lines
1.7 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""PineAgents 算力目录:用户端算力中心「自动对接的供应商」模型清单与价目。
|
|
|
|
供应商自动对接 PineAgents —— 用户无需配置上游,直接看到本平台经 server-core /v1 中继
|
|
可调用的模型与价格。模型列表与 relay.py 的 _ENGINE_MODEL_IDS 保持一致;价格为 元/百万token。
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
# 模型目录(id = OpenAI 兼容模型名,供 /v1/chat/completions 使用)
|
|
MODELS: list[dict] = [
|
|
{"id": "deepseek-chat", "name": "DeepSeek Chat", "company": "深度求索", "tags": ["对话", "通用"]},
|
|
{"id": "deepseek-reasoner", "name": "DeepSeek Reasoner", "company": "深度求索", "tags": ["推理", "深度思考"]},
|
|
{"id": "deepseek-v4-flash", "name": "DeepSeek V4 Flash", "company": "深度求索", "tags": ["快速", "低延迟"]},
|
|
{"id": "deepseek-v4-pro", "name": "DeepSeek V4 Pro", "company": "深度求索", "tags": ["旗舰", "高性能"]},
|
|
]
|
|
|
|
# 价目:元 / 百万token(输入 / 输出)
|
|
PRICES: dict[str, dict] = {
|
|
"deepseek-chat": {"input": 0.5, "output": 1.5, "unit": "/百万tokens"},
|
|
"deepseek-reasoner": {"input": 1.0, "output": 2.5, "unit": "/百万tokens"},
|
|
"deepseek-v4-flash": {"input": 0.3, "output": 1.0, "unit": "/百万tokens"},
|
|
"deepseek-v4-pro": {"input": 2.0, "output": 6.0, "unit": "/百万tokens"},
|
|
}
|
|
|
|
|
|
def models() -> list[dict]:
|
|
"""可用模型清单(加入价格为可选)。"""
|
|
out = []
|
|
for m in MODELS:
|
|
price = PRICES.get(m["id"], {})
|
|
out.append({**m, "price": price})
|
|
return out
|
|
|
|
|
|
def prices() -> list[dict]:
|
|
return [{"id": m["id"], "name": m["name"], **PRICES.get(m["id"], {})} for m in MODELS]
|