Skip to content

feat: 渠道缓存与费用明细及生效价格展示 #38

Description

@zuiho-kai

Agent issue

背景:针对不同渠道,他们命中率,ttft,tps都可能不相同,为了让不同渠道的信息可对比,所以新增了渠道级别的信息面板

解决:

  1. 理论上看 平均1m开销和缓存命中率、ttft和e2e就差不多能选择一个好渠道了
image image image

Agent

  • Tool: OpenAI Codex(AI-assisted)
  • Tool version: codex-cli 0.155.0-alpha.16.4
  • Model (full id): GPT-6;运行环境未提供完整部署 ID
  • Host: Codex desktop / Windows
  • Date (UTC): 2026-09-26

Out of scope — refuse

  • Matched: no。不是新增订阅提供商,也不是使用/配置问题。
  • If yes: 不适用。

File gate — do not file unless all are satisfied

  • Out of scope: no
  • Usage / configuration / integration: no
  • Required facts present without invention: yes(功能请求,现有限制和用途如下)
  • Body is short and factual; no unfiltered AI-generated text: yes
  • File: yes
  • If no: 不适用。

Kind

  • Feature

Usage / configuration / integration check

  • docs/guides/billing-unpriced.md:说明现有账本、未计价及快照语义。
  • docs/guides/pay-as-you-go-providers.md:New API 额度查询已有支持,不是本请求。
  • CONTRIBUTING.md:已读构建、验证和组件复用要求。
  • README:已有 provider/model/token 用量统计说明。
  • Relevant code paths: core/internal/storage/sqlite/pricing.go、core/internal/pricing/ 保存账本与价格快照;apps/desktop/src/PricingWorkspace.tsx 为现有费用界面。
  • Can current version do this? 部分基础能力已存在,已有账本和概览,但渠道操作中没有缓存命中/每百万 Token 费用明细,也没有渠道模型价格覆盖表单。
  • Verdict: new feature。

Environment

  • AstrLink: upstream 8e3c7d5,本地组合实现 250a52d。
  • Install source: source build。
  • OS and architecture: Windows x64。
  • Runtime: Tauri desktop + Go core。

Problem facts

  • Actual behavior: 已有账本和概览,但渠道操作中没有缓存命中/每百万 Token 费用明细,也没有渠道模型价格覆盖表单。
  • Impact: 难以从渠道页核对缓存效果和价格来源。
  • Frequency: 不适用,功能缺失而非偶发故障。

Type-specific details

Relay / API

不适用:不是转发故障报告,也不新增提供商协议。

Cost / usage

按账本终态调用与上游 usage 汇总;输入/输出/缓存价格取当次价格快照。缺失价格保持待计价,显示的费用不是提供商实际扣款。此处是新增视图及价格配置,不是某笔账单错误报告。

Desktop / frontend

  • Page: API 提供商 → 操作 → 缓存与费用。
  • Runtime: Tauri 2 / Windows WebView2;不是特定 WebView 版本回归。
  • Dimensions/theme/logs: 不适用,功能请求不依赖窗口尺寸或主题;没有附带私人日志。

Installation / upgrade

  • Source build on Windows x64。
  • Data migration: no,复用现有价格 JSON 和账本。
  • Upgrade failure/logs: 不适用,未报告升级故障。

Reproduction and expected result

  • Steps: 从上游 8e3c7d5 打开 API 提供商页。
  • Expected: 渠道缓存与费用统计、当前生效价格和渠道模型自定义价格。
  • Screenshots: 无;本 issue 聚焦功能范围。

Feature (feature requests only)

  • Description: 渠道缓存与费用统计、当前生效价格和渠道模型自定义价格。
  • Use case: 比较渠道缓存效率与调用成本,核对生效单价。

Duplicate check

Research

Docs

Code

core/internal/storage/sqlite/pricing.go、core/internal/pricing/ 保存账本与价格快照;apps/desktop/src/PricingWorkspace.tsx 为现有费用界面。

Experiments

  • 本地组合实现:go test ./internal/pricing ./internal/storage/sqlite ./internal/controlapi;费用 UI/catalog 测试。观察到重试去重、缓存未知样本排除、自定义价格优先均通过。
  • 独立分支正在重新验证,结果将在 PR 列出。

Working theory

  • Missing: 已有账本和概览,但渠道操作中没有缓存命中/每百万 Token 费用明细,也没有渠道模型价格覆盖表单。
  • Why: 现有职责集中于账本及概览。
  • Falsifier: 上游已有同等入口与执行能力,则应复用而非重复新增。

Scope

  • In scope: 渠道缓存与费用统计、当前生效价格和渠道模型自定义价格。
  • Out of scope: 新订阅接入、远端余额扣费、智力检测。
  • Large or directional: no;扩展现有账本、价格配置与渠道视图。

Proposed direction

渠道统计按模型展示请求、缓存及费用;明确价格来源和未计价状态;自定义价格不追改已有调用快照。

Not verified

macOS/Linux 原生交互;所有提供商。最新布局手工检查被用户 Escape 中止。

Related

#34

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions