Repository navigation
feat(ai): community AI providers, credit balances & per-call cost (desktop + mobile) #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 16 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f634027
feat(mobile): browse & install community AI providers
ddutchie abfa8ee
feat(ai): provider credit balances and per-call cost visibility
ddutchie 424d3ce
fix(mobile): address PR review — registry fetch guards, install dedup…
ddutchie 8edd856
fix(ci): unused test imports + live-check skip when sibling repo absent
ddutchie b741548
fix(ai): PR review — costUsd optional/validated, subagent cost, tiny-…
ddutchie 359f805
feat(ai): provider balance in the chat usage ring + portal chat-setti…
ddutchie 3d4010e
feat(ai): default model is now gpt-5.6-luna (desktop + mobile)
ddutchie 7113cb1
fix(ai): address PR review — ring balance cache keys, shared formatte…
ddutchie 4139f6c
feat(ai): per-model cost, provider logos & image gating from models.dev
ddutchie e856132
feat(ai): show model input-capability chips (T/I/PDF/V/A) in pickers
ddutchie 4e4b428
fix(ai): crash on legacy catalog cache + icon capability chips
ddutchie b8ee5cb
feat(ai): attach PDFs to chat messages (document parts + rasterized f…
ddutchie cee5385
fix(ai): PR review — negative-cost formatting + catalog-aware image g…
ddutchie 61a9704
feat(ai, mobile): model dropdown + auto-fetch model list like desktop
ddutchie 3cb6ef1
feat(ai, mobile): favorite models in the model dropdown like desktop
ddutchie 90f0fa8
fix(ai): resolve model logos from models.dev canonical owner
ddutchie e9a68f5
feat(settings): brand marks on saved providers + URL fallback match
ddutchie 5024ddd
feat(settings): fall back to models.dev logos for direct-vendor endpo…
ddutchie 17ff3fb
fix(mobile+desktop): render models.dev logos through ConnectorLogo chip
ddutchie 2f0bef1
feat(mobile): edit provider on demand + hide Browse in Apple/Rork mode
ddutchie 57fc792
fix: address PR #108 review comments
ddutchie 59a66db
fix(lint): use const for logoSvgSubscribers (never reassigned)
ddutchie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| ## Features | ||
|
|
||
| - **Remaining-credit badges now work beyond OpenRouter.** The settings credit lookup previously probed a single OpenRouter-style `GET {base}/v1/key` endpoint, so only OpenRouter showed a balance. Community providers can now advertise a `credits` descriptor (a dedicated HTTPS endpoint + response shape) in the `providers.json` catalog, and the main process looks that up for the active endpoint and parses the reply accordingly. DeepSeek (via `GET /user/balance`, with its USD/CNY balance shown in the right currency) and OpenAI (via the legacy `credit_grants` endpoint) ship with descriptors; any provider that doesn't expose a balance API still gracefully hides the display. | ||
| - **Neuralwatt now shows a live balance too.** Its catalog entry gained a `credits` descriptor pointing at `GET /v1/quota`, and the parser reads the energy account's `credits_remaining_usd` / `total_credits_usd` / `credits_used_usd`. The credit-parsing logic moved into a small shared module, and the `cairn-community` repo gained a live endpoint test (`npm run test:credits`) that exercises every provider's balance endpoint against real keys (set them in `.env.test`). | ||
| - **Per-turn cost in the context ring.** Providers that report the USD cost of a call in their usage (`usage.cost` — Neuralwatt's energy accounting does) now surface that figure in the context-ring popover, alongside the token breakdown, so you can see what each message cost. | ||
| - **Account balance in the context ring.** The ring's popover now also shows a **Balance** row with your remaining credits for the active provider (`$5.42 of $45.5`, or "Free tier" for no-cost providers), refreshed at most once a minute so repeated ring instances share a single probe. It hides when the provider exposes no balance or you're offline, and is skipped on per-subagent rings (it's account-level, not per-turn). | ||
| - **New default model.** Fresh installs, resets, and unset-model fallbacks now use **`gpt-5.6-luna`** instead of `gpt-4o`/`gpt-4o-mini` as the default for chat, coding agents, notes AI actions, and flow summaries (the model picker still lists the endpoint's real models). | ||
| - **Model pickers now show cost and provider logos.** Every model dropdown (chat quick-settings, endpoint rows, saved-provider form) pulls live per-model data from the public models.dev catalog: the provider logo sits next to the model name, a compact **`$in/$out`** cost label shows the per-1M-token price (or "free"), and a warning triangle marks models known not to support tool calls. The same info appears on the closed trigger button, and logos adapt to the theme (light glyph on dark, dark on light). | ||
| - **Provider logos now match the model's own brand.** models.dev lists each model under every host that serves it, so the logo used to be whoever came first in the catalog (e.g. `deepseek/deepseek-v4-flash` could show an HPC AI or Cortecs glyph instead of DeepSeek's). Cairn now reads models.dev's canonical ownership list (`models.json`, keyed by `<provider>/<model>` id) and uses the model's actual owner for the icon — falling back to a brand-name heuristic and finally the catalog entry. Correct logos now appear for long-tail labs too (GLM, Grok, Qwen, Gemma, and more), even before the full catalog has loaded. | ||
| - **Image attachments are gated per model.** The chat composer's attach-image button is hidden when the selected model is known (via models.dev) not to accept image input; models we can't look up stay permissive. Pasting images is ignored too. Everything falls back gracefully offline or before the catalog loads. | ||
| - **Attach PDFs to chat messages.** The chat composer now accepts PDF files alongside images. Models known (via models.dev) to take PDF input receive the raw bytes as an Anthropic-style `document` part — lossless, and smaller for text-heavy files. Models that only take images get the PDF rasterized (pdf.js, up to 8 pages) into image parts instead, so the file still arrives. Attachments show as a PDF chip in the composer and the sent message, and the context-ring token count uses a size-based estimate for document parts rather than raw base64 length. | ||
|
|
||
| ## Fixes | ||
|
|
||
| - **Chat settings no longer clip in narrow windows.** The in-chat quick-settings dropdown used inline positioning inside the chat panel's overflow container, so in a narrow window (or a docked panel) it could get cut off at the panel edge. It's now a portaled popover, so it always floats above the window edge. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.