Skip to content

docs(nip-am): normative amendment — cache SHOULD/MUST + pricingIdentity + consumer cost guidance - #4632

Open
wpfleger96 wants to merge 2 commits into
mainfrom
duncan/nip-am-usage-v2-amendment
Open

docs(nip-am): normative amendment — cache SHOULD/MUST + pricingIdentity + consumer cost guidance#4632
wpfleger96 wants to merge 2 commits into
mainfrom
duncan/nip-am-usage-v2-amendment

Conversation

@wpfleger96

@wpfleger96 wpfleger96 commented Aug 3, 2026

Copy link
Copy Markdown
Member

Amends docs/nips/NIP-AM.md with three normative publisher-behavior changes per the cleared Usage v2 plan (plan v3, D4 + D2').

Changes

1. Cache emission semantics (D4)

Replaces the unconditional MAY with qualified obligations:

  • Publishers SHOULD emit cacheReadTokens / cacheWriteTokens when the provider exposes a cache component.
  • Publishers MUST preserve an explicit zero when the provider reports zero.
  • Publishers MUST omit the field (never null or fabricated zero) when that component is unavailable to the publisher — including when the provider supports it but the harness does not surface it.

An explicit carve-out in both the JSON comment block and the Numeric-validity prose exempts these fields from the payload-wide null guidance. Omission is the only valid representation for an unavailable cache component.

2. Optional pricingIdentity field (D2')

Adds an optional, non-nullable pricingIdentity object (authority, model, cacheClass), defined as billing authority — distinct from the transport Provider enum.

  • authority is a registered billing-namespace identifier: exact lowercase hostname, no scheme, no path, no trailing slash. Registered values: api.anthropic.com, api.openai.com, openrouter.ai. The set extends only by NIP amendment. Pricing lookup is an exact string match on (authority, model).
  • Present only when the publisher can prove applicability: direct official-endpoint connections prove via the actually-requested resolved model; other routes MUST receive response-supplied authoritative billing identity.
  • MUST omit for custom/overridden base URLs, gateways (unless the gateway is the named billing authority), unresolved aliases, and turns where usage contributions carry more than one billing identity (including identity-bearing mixed with unresolved).
  • cacheClass is omitted (not null) when not applicable.
  • pricingIdentity is optional but not nullable — omission is the only absence representation.
  • The existing model field retains its non-billing semantics (configured/session model) and is never overloaded.
  • Consumers MUST treat omission as "price unknown" and MUST NOT infer a price from the session model field.

3. Consumer cost guidance (D4)

  • Consumers MAY recompute cost estimates using the billing identity and a pricing manifest.
  • Consumers MUST retain the provenance of any cost value (e.g. manifest-estimated, wire-reported).
  • Consumers MUST NOT merge manifest-estimated and wire-reported costs into an unlabeled total.

Manifest-vs-wire display preference is application policy and deliberately excluded from this NIP.

Scope

Doc-only. Single file: docs/nips/NIP-AM.md.

…ty + consumer cost guidance

Amends NIP-AM.md as a normative publisher-behavior amendment (not a
clarification) to address three gaps in Usage v2 arc (plan v2 D4 /
plan v3 D2'):

1. Cache component emission semantics (lines ~154-157 → qualified SHOULD):
   Replaces the unconditional "publishers MAY" with the graduated contract:
   when the provider exposes a cache component, publishers SHOULD emit it;
   publishers MUST preserve an explicit zero when the provider reports
   zero; publishers MUST omit the field when the provider does not report
   that component. Never null/zero for an unreported category.

2. New optional pricingIdentity field (authority, model, cacheClass):
   Defines a billing-authority namespace distinct from the runtime
   transport provider. Present only when the publisher can prove
   applicability from the actual official endpoint and the
   actually-requested model. Publishers MUST omit on custom/gateway base
   URLs, unresolved aliases, and mixed-billing turns. The existing model
   field retains its non-billing (configured/session) semantics.

3. Consumer cost guidance: consumers MAY recompute cost estimates using
   pricingIdentity and a pricing manifest; they MUST retain and expose
   cost provenance; they MUST NOT merge manifest-estimated and
   wire-reported costs into an unlabeled total. Display-policy preference
   (manifest vs wire) is explicitly out of NIP scope.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
@wpfleger96
wpfleger96 requested a review from a team as a code owner August 3, 2026 23:01
@wpfleger96
wpfleger96 force-pushed the duncan/nip-am-usage-v2-amendment branch from 92ded70 to 53226f4 Compare August 3, 2026 23:18
…ty semantics

Four normative defects corrected:

1. Cache omission scope: MUST omit when unavailable to the publisher,
   including when the harness does not surface a component the provider
   supports. Explicitly exempts cache fields from the payload-wide null
   guidance so omission is the only valid representation.

2. pricingIdentity non-nullability: removes the '`| null`' from the JSON
   example and states the field is optional but not nullable. authority and
   model MUST be non-null strings when the object is present; cacheClass is
   omitted (not null) when not applicable.

3. Mixed-identity gate: replaces the impossible multi-turn condition with
   'usage within this turn contains contributions from more than one billing
   identity'. Reconciles proof requirements with D2': direct official
   endpoints prove identity via the actually-requested resolved model;
   other routes require response-supplied authority.

4. Consumer MUST retain (not expose): removes the unapproved 'and expose'
   obligation so headless consumers are not required to surface provenance
   in a UI.

MINOR also addressed: authority is now specified as a full URI string
(scheme + host + required path prefix, no trailing slash) with exact
registered values; JSON example updated to show https://api.anthropic.com.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant