Skip to content

NET-1329 feat(models): add getModelPricing with opt-in TTL cache#111

Open
AkhileshNair2201 wants to merge 5 commits into
devfrom
feat/sdk-caching
Open

NET-1329 feat(models): add getModelPricing with opt-in TTL cache#111
AkhileshNair2201 wants to merge 5 commits into
devfrom
feat/sdk-caching

Conversation

@AkhileshNair2201

Copy link
Copy Markdown
Contributor

TICKET (https://getnetra.atlassian.net/browse/NET-1329)

What

Adds Netra.models.getModelPricing() to fetch model pricing from GET /sdk/models, with optional in-memory caching via Phase 1 TTLCache.

Why

Gives the JS SDK parity with Python for model pricing, and lets callers opt into short-lived caching (default 300s) without changing prompts cache behavior or requiring a global cache flag.

How

  • New src/api/models/ module (types, HTTP client, API, tests)
  • Wired into Netra.init() / shutdown() (clearCache)
  • Cache is opt-in (useCache / cacheTtl); failures are not cached

AkhileshNair2201 and others added 5 commits July 10, 2026 13:01
Co-authored-by: Cursor <cursoragent@cursor.com>
Use Vitest 3.x so dev test runs align with engines.node >=18, and add
getPrompt cacheTtl integration coverage plus shutdown re-init behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.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.

2 participants