Skip to content

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

Merged
AkhileshNair2201 merged 7 commits into
devfrom
feat/sdk-caching
Jul 13, 2026
Merged

NET-1329 feat(models): add getModelPricing with opt-in TTL cache#111
AkhileshNair2201 merged 7 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>
AkhileshNair2201 and others added 2 commits July 13, 2026 09:58
* NET-1329 simplify cache TTL to module const and per-call override

Co-authored-by: Cursor <cursoragent@cursor.com>

* test: cover prompt default TTL and drop removed cacheTtlSeconds

Assert PROMPT_CACHE_TTL_SECONDS expiry when cacheTtl is omitted, and stop passing the removed Config option in models client tests.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@AkhileshNair2201 AkhileshNair2201 merged commit 89ed09a into dev Jul 13, 2026
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