Commit Graph
9 Commits
Author SHA1 Message Date
yetone 4790c06b02 usage: each call keeps where it went — the provider's host, or the account it was — so a provider id later pointed somewhere else no longer puts the earlier place's tokens and cost under the new one: a model's usage is told apart by host (provider/model @ host) when its provider went to more than one place in the period, or to somewhere other than where it goes now. Asked on Discord 2026-09-26 19:03:14 +08:00
yetone 7b69b22a76 quota: what is left of every subscription, plan and key balance, for scripts and agents — magpie quota [<provider>] [--json] prints each window's use and remaining percent and when it starts again, and each key's balance; the gateway answers the same at GET /v1/magpie/quotas (only to this machine, as it names the accounts), so an agent can pick where to send its work (#85) 2026-09-26 17:22:00 +08:00
yetone f1fba8d7eb usage: a GLM Coding Plan's allowance and OpenCode Go's show on the Usage page — Zhipu's (open.bigmodel.cn) and Z.ai's 5-hour and weekly windows and the month's MCP calls, with the plan's level, and OpenCode Go's 5-hour, weekly and monthly ones, each asked of the vendor with the provider's key, a card for each key when it has several; a pay-as-you-go GLM key, which has no windows, shows none (#68) 2026-09-25 22:27:18 +08:00
yetone 293c45677c agent + gui: magpie and curl are clients the gateway knows by name, with their logos, beside the agents — the Usage and Routing views both draw a request's client from the one list, every agent in it whether it is set up here or not, where Routing only knew those found on this machine 2026-09-25 05:55:33 +08:00
yetone 2b1e9e8619 usage: the Usage page shows what is left on an API key beside the subscriptions' allowances — DeepSeek, Kimi, OpenRouter and SiliconFlow are asked by their hosts, and any custom provider can name its balance endpoint and where the amount sits in the reply (Balance URL / field in the editor, balance= / balance.path= in the CLI), each key it has on asked with itself; magpie provider <id> prints it too (#40) 2026-09-25 01:12:18 +08:00
yetone 2a90ed1030 usage: the page no longer waits on subscription quotas — they load on their own, in parallel, stale-while-revalidate (#6) 2026-09-24 12:49:51 +08:00
yetone 702477525a Claude subscription as a provider; model lists fetched, never compiled in
A signed-in Claude Code is now offered as a provider (claude/…) like Codex
and Copilot. Anthropic classifies another agent's system prompt as
third-party traffic even over Claude Code's OAuth, so magpie drives the
real local claude binary for every generation: the caller's tools are
bridged in over MCP (magpie claude-mcp-helper), and tool results resume
the same Claude Code turn. Token counting is estimated locally so the
OAuth token takes no side path.

No model list is compiled in any more. The built-in catalog, preset
defaults and Claude Code's alias list are gone; the picker shows the
models.dev catalog (refreshed in the background when stale) layered with
each vendor's own /models answer, and signed-in accounts fetch theirs at
start-up. Whether a model rejects temperature/top_p now comes from
models.dev rather than a name prefix.

The gateway retries a Chat request on the Responses endpoint when the
model is Responses-only, and remembers that. Recent calls keep the first
256 KB of request and response bodies, viewable in the call list. The
Usage tab shows subscription allowances (Claude, Codex, Copilot) as the
vendors report them.
2026-09-24 00:20:59 +08:00
yetone 402a96c39d Rename dial to magpie, with a magpie for a logo
The product, module path (github.com/yetone/magpie), binaries, env vars
(MAGPIE_ADDR, MAGPIE_DEV_UI, MAGPIE_THEME, MAGPIE_DEBUG), config and cache
folders (~/.config/magpie, ~/.cache/magpie), bundle id (com.yetone.magpie),
gateway provider id and token, and every UI string now say magpie.

On first run magpie copies ~/.config/dial and ~/.cache/dial to the new
folders when they don't exist yet (copy, not move, so a still-running dial
keeps working; the old folders can be deleted by hand later).

The logo is a small round magpie in profile: one path for the header and
the tray, and the app tile adds the white belly and the blue-green tail.
The header mark is drawn in ink rather than the accent colour, which
fought the text in light mode.
2026-09-23 23:55:11 +08:00
yetone 30c489a000 usage: a token statistics page
The gateway now records every call's token counts (read from the provider's
own usage block, in both the translated and the pass-through paths) with the
calling agent taken from the client's User-Agent, into
~/.config/dial/usage.jsonl. A Usage tab sums them by period, agent and
model, with a per-hour/day/week timeline and cost at models.dev list
prices; dial usage does the same in the terminal.

Also nudges the window header 1pt up so the brand sits level with the
traffic lights, and lets ?view= open the window on a tab.
2026-09-23 03:16:33 +08:00