broker: method-specific credit costs + free reads (default_cost 0)#66
Merged
Alexgodoroja merged 1 commit intoJul 4, 2026
Merged
Conversation
The credit gate priced by PATH only, but a REST partner reuses a path across
methods: GET /v1/numbers (list, free) vs POST /v1/numbers (buy, $3). Path-only
pricing would wrongly charge the free list. And default_cost 0 was silently
bumped to 1, so reads couldn't be free.
- cost_credits keys may now be method-specific ("POST /v1/numbers") or
any-method ("/v1/usage"); templated paths still work. Method-specific wins.
Resolution: method exact → any exact → method pattern → any pattern → default.
- default_cost 0 is honored (reads free); only a negative value is clamped.
- Test: free GET vs paid POST on the same path, debit → 402. Full suite green.
MANAGED-KEY.md example updated to the method-scoped, free-reads shape.
Alexgodoroja
pushed a commit
to Alexgodoroja/app-template
that referenced
this pull request
Jul 4, 2026
…cal number recall Managed AgentPhone app: keyless adapter → Pilot broker (holds the master key, meters each user against a $5 budget → 402) → https://api.agentphone.ai. - 53 methods covering every non-streaming /v1 endpoint (agents, numbers, messages, calls, conversations, contacts, contact-cards, usage, voices, webhooks). Every method described; params tagged path/query/body. No websockets — poll for status. - Local number recall: buy_number captures the provisioned number to ~/.pilot/.agentphone; agentphone.mynumber reads it back locally (no round-trip). - verify-submission builds + verifies darwin/linux amd64+arm64. Requires the broker credit gate (pilot-protocol#64) + method-aware costs (pilot-protocol#66) + local-metadata scaffold (pilot-protocol#67), all merged.
Alexgodoroja
added a commit
that referenced
this pull request
Jul 4, 2026
…cal number recall (#65) Managed AgentPhone app: keyless adapter → Pilot broker (holds the master key, meters each user against a $5 budget → 402) → https://api.agentphone.ai. - 53 methods covering every non-streaming /v1 endpoint (agents, numbers, messages, calls, conversations, contacts, contact-cards, usage, voices, webhooks). Every method described; params tagged path/query/body. No websockets — poll for status. - Local number recall: buy_number captures the provisioned number to ~/.pilot/.agentphone; agentphone.mynumber reads it back locally (no round-trip). - verify-submission builds + verifies darwin/linux amd64+arm64. Requires the broker credit gate (#64) + method-aware costs (#66) + local-metadata scaffold (#67), all merged. Co-authored-by: Alex Godoroja <alex@vulturelabs.io>
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.
Follow-up to the credit gate (#64). Two fixes needed for a real REST partner:
GET /v1/numbers(list, free) vsPOST /v1/numbers(buy, $3). Pricing by path alone would charge the free list.cost_creditskeys may now be method-scoped ("POST /v1/numbers") or any-method ("/v1/usage"); templated paths still work; method-specific wins. Resolution: method-exact → any-exact → method-pattern → any-pattern → default.default_cost: 0is honored (was bumped to 1), so reads are free and only priced calls debit — polling for status/replies never burns budget.Test covers free GET vs paid POST on the same path through to 402. Full suite green;
MANAGED-KEY.mdupdated.