broker: response-cost credit mode + per-IP cap; submit io.pilot.orthogonal#71
Merged
Conversation
…redit path Adds two additive knobs to the managed-HTTP credit budget so a meta-API like orthogonal (one master key fronting 851 endpoints, per-call price only known from the response, some 'dynamic') can be metered true to real usage: - cost_source:"response" — no up-front debit; a billable path (cost_credits>0) is refused with 402 only when the caller is already depleted, and after a 2xx the ACTUAL cost (CostField × cost_scale, micro-$) is settled, clamped to floor the balance at zero. Free control-plane paths always pass. Adds Store.Settle (atomic clamp-debit) to MemStore + SQLiteStore. - max_identities_per_ip / mint_cooldown_ms on CreditSpec — wires the existing Provision IP cap into the credit path (previously passed 0), so a depleted user can't farm a fresh $5 grant by minting a new pilot identity from one IP. Fixed-cost apps (agentphone etc.) are unchanged. Tests cover settle-from-response, free control-plane, 402-on-depletion, overshoot-clamps-to-zero, failed-call-free, and the per-IP cap. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… response-cost metering Rich managed submission (backend.auth=managed, 9 methods, vendor+listing). Wraps Orthogonal's 58 APIs / 851 endpoints behind the managed-key broker: NL router (orthogonal.search) + discover→price→execute; only orthogonal.run bills, metered true-to-usage against a per-user $5 budget with a per-IP identity cap. Bundles published to R2 via the catalogue PR (not committed here). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
da79faa to
53fd84a
Compare
This was referenced Jul 6, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds the io.pilot.orthogonal managed app (a metered wrapper over Orthogonal — one key fronting 58 APIs / 851 endpoints) plus the two additive broker features it needs.
Broker change (
internal/broker)Orthogonal is a meta-API: every call goes through
POST /v1/run, the per-call price is only known from the response (priceCents), and 104 endpoints are"dynamic"(priced only after the fact). A staticcost_creditstable can't express that, so thecreditblock gets two additive knobs (fixed-cost apps like agentphone are unchanged):cost_source: "response"+cost_scale— no up-front debit; a billable path (cost_credits > 0) is refused with 402 only when the caller is already depleted, and after a 2xx the actual cost (CostField × cost_scale, micro-$) is settled against the budget, clamped so the balance floors at zero. Free control-plane paths always pass. AddsStore.Settle(atomic clamp-debit) toMemStore+SQLiteStore.max_identities_per_ip/mint_cooldown_msonCreditSpec— wires the existing Provision per-IP identity cap into the HTTP credit path (previously hardcoded to 0), so a depleted user can't farm a fresh $5 grant by minting a new pilot identity from one IP.New tests: settle-from-response, free-control-plane, 402-on-depletion, overshoot-clamps-to-zero, failed-call-free, per-IP cap. Existing broker tests unchanged/green.
Submission (
submissions/io.pilot.orthogonal)Managed HTTP app (
backend.auth: managed), 9 methods incl. the natural-language routerorthogonal.searchand the discover→price→execute flow.publisher+vendorpopulated; per-user $5 budget metered true-to-real-usage via the broker change above.Testing
go test ./internal/broker/green (incl. new tests);verify-submissionbuilds + gates all 4 platforms.pilotctl appstore install, store card renders, andorthogonal.runexecutes through the live managed-key broker (realpriceCentsdebited from the per-user budget; free discovery/balance calls don't debit; per-IP cap returns 429 on the 6th identity).broker.pilotprotocol.network(registry entry + master key), so managed calls work on merge.🤖 Generated with Claude Code