Skip to content

feat(dashboard): integrate PymtHouse usage, API keys, and discovery#3

Open
eliteprox wants to merge 17 commits into
mainfrom
feat/pymthouse-integration
Open

feat(dashboard): integrate PymtHouse usage, API keys, and discovery#3
eliteprox wants to merge 17 commits into
mainfrom
feat/pymthouse-integration

Conversation

@eliteprox

@eliteprox eliteprox commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Wire the dashboard to PymtHouse backend services: live account usage from OpenMeter, API key management, and a discovery-backed model catalog — replacing mock data and deprecated gateway paths.

Device-code login (OIDC device flow for CLI/python-gateway) is split into a follow-up stacked PR (#7) on top of this one.

Usage

  • Add useAccountUsage hook and /api/pymthouse/account-usage BFF route with no-store caching for live data.
  • Implement usage-capability-display.ts for capability breakdowns, color coding, and UTC date-key alignment with OpenMeter daily buckets.
  • Overhaul UsageView and StackedAreaChart for per-day visualization (Y-axis ticks, grid lines, hover tooltips, dynamic period length).
  • Include retail data in external-user usage fetches; update SidebarUsageCard to show real balances.

API keys

  • Add useApiKeys hook and /api/pymthouse/keys BFF route for create/revoke.
  • Add /api/pymthouse/keys/exchange BFF facade so CLI clients (e.g. python-gateway via --billing-url) can exchange an API key for a signer session.
  • Adopt @pymthouse/builder-sdk 0.4.6; return signerUrl from the exchange handler only when PYMTHOUSE_SIGNER_URL (or SIGNER_PUBLIC_URL) points at the remote signer base.
  • Simplify KeysView to use live key data instead of mocks.

Discovery & explore

  • Add discovery client, config, types, and map-to-model transforms.
  • BFF routes for explore catalog and model detail (/api/discovery/explore, /api/discovery/models/[id]).
  • Wire useExploreModels, useDiscoveryModel, and ExploreView to the discovery service.

Cleanup

  • Remove deprecated gateway session routes, signer proxy rewrites, LiveStreamPlayground, and related env/config.
  • Simplify CodeSnippets without gateway dependencies.

Config

Env vars documented in .env.example: PYMTHOUSE_ISSUER_URL, PYMTHOUSE_PUBLIC_CLIENT_ID, PYMTHOUSE_M2M_CLIENT_ID, PYMTHOUSE_M2M_CLIENT_SECRET, PYMTHOUSE_SIGNER_URL.

Test plan

- Implemented `usage-capability-display.ts` for displaying account usage capabilities with color coding and data distribution.
- Created `useAccountUsage.ts` hook to manage account usage state and fetch usage data.
- Added `useApiKeys.ts` for managing API keys with create and revoke functionality.
- Introduced `useDiscoveryModel.ts` and `useExploreModels.ts` for fetching and managing discovery models.
- Developed `useSigningSession.ts` for handling signing sessions and token management.
- Added discovery client functions in `client.ts` for fetching capabilities and models.
- Created configuration and constants files for discovery service.
- Implemented mapping functions for transforming discovery capabilities to models.
- Defined types for discovery service API responses.
- Updated package dependencies and added type definitions for jmuxer and mux.js.
@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dashboard Ready Ready Preview, Comment Jul 14, 2026 6:45pm

Request Review

…a visualization

- Updated StackedAreaChart to support Y-axis ticks, horizontal grid lines, and per-day hover tooltips.
- Integrated dayKeys prop for better date handling in the chart.
- Modified UsageView to utilize new daily data structure, including dynamic period day count and improved data fetching.
- Added utility functions for generating UTC date keys and aligning daily request series with OpenMeter data.
- Introduced tests for new utility functions to ensure correctness in date handling and data alignment.
- Changed dependency from local link to versioned package for @pymthouse/builder-sdk in package.json and pnpm-lock.yaml.
- Updated lock file to reflect the new version and its peer dependencies.
- Added new environment variable `GATEWAY_SIGNER_FROM_REQUEST_ORIGIN` to control signer URL behavior.
- Implemented API route rewrites for orchestrator info, discovery, and payment generation to use the dashboard's signer proxy.
- Refactored session handling in the API to read configuration from the request context.
- Introduced a new signer proxy handler to forward requests based on allowed paths.
- Updated the LiveStreamPlayground component to optimize sleep intervals for better performance.
- Adjusted gateway configuration functions to support request-based signer URL resolution.
…up related code

- Deleted unused gateway session API routes and related handlers to streamline the codebase.
- Removed references to the LiveStreamPlayground component and associated gateway checks from the playground tab.
- Cleaned up environment variables in `.env.example` by removing obsolete gateway configurations.
- Updated the `next.config.ts` to eliminate unnecessary rewrites related to the gateway.
- Enhanced the API key exchange configuration to include audience requirements for improved security.
- Refactored the CodeSnippets component to simplify snippet generation without gateway dependencies.
- Eliminated the audience parameter from the API key exchange configuration in both exchange routes to simplify the code and avoid reliance on deprecated functionality.
- Updated the fetchAccountUsageForExternalUser function to include the `includeRetail` parameter for both current and prior usage data requests, enhancing the data retrieval capabilities for external users.
- Changed dependency from local link to versioned package for @pymthouse/builder-sdk in package.json and pnpm-lock.yaml.
- Updated lock file to reflect the new version and its peer dependencies.
- Added `dynamic` export to force dynamic rendering for live data.
- Implemented `NO_STORE_HEADERS` to prevent caching of account usage responses, ensuring users always receive the latest data.
- Updated the `GET` method to include these headers in both successful and error responses.
- Modified the `useAccountUsage` hook to fetch account usage data with `cache: "no-store"` to align with the new caching strategy.
- Updated dependency for @pymthouse/builder-sdk in package.json and pnpm-lock.yaml to the latest version 0.4.3.
- Adjusted lock file to reflect the new version and its integrity hash.
# Conflicts:
#	app/(app)/apps/[id]/page.tsx
#	app/(app)/layout.tsx
#	app/(app)/page.tsx
#	components/dashboard/KeysView.tsx
#	components/dashboard/UsageView.tsx
@eliteprox eliteprox marked this pull request as ready for review June 18, 2026 17:07
@eliteprox eliteprox requested a review from adamsoffer as a code owner June 18, 2026 17:07
Adopt direct signer DMZ integration: bump builder-sdk from 0.4.3, remove
the dashboard /api/signer proxy route, and return signerUrl from exchange
handlers only when PYMTHOUSE_SIGNER_URL (or SIGNER_PUBLIC_URL) points at
the remote signer DMZ base — not a dashboard proxy path.
@eliteprox eliteprox changed the title feat(dashboard): add usage capability display and account usage hooks feat(dashboard): integrate PymtHouse auth, usage, API keys, and discovery Jun 22, 2026
Updated the @pymthouse/builder-sdk dependency in package.json and pnpm-lock.yaml to version 0.4.6, reflecting the latest changes and integrity hash.
Drop the OIDC device-flow routes, device-approved page, and login UI
branches from this branch so PR #3 stays focused on API keys, usage,
discovery, and signing. Relocate createPmtHouseClientForPublicApp into
pymthouse-bff so remaining BFF routes keep working without device-flow.ts.
@eliteprox eliteprox changed the title feat(dashboard): integrate PymtHouse auth, usage, API keys, and discovery feat(dashboard): integrate PymtHouse usage, API keys, and discovery Jun 23, 2026
Updated the layout components for both the app and auth sections to utilize AuthProvider instead of the now-removed DashboardProviders. This change simplifies the authentication context management. Additionally, modified the .env.example file to clarify the purpose of PymtHouse configuration variables and removed deprecated signing token API and related components to streamline the codebase.
…environment configuration

- Added support for live runner integration, including new API routes for managing signer sessions and forwarding requests to the runner gateway.
- Introduced `RunnerGatewayProvider` and context to manage live runner state in the playground.
- Updated `.env.example` to include `RUNNER_DISCOVERY_URL` for local development.
- Bumped `@pymthouse/builder-sdk` dependency to version 0.5.0, reflecting changes in the SDK for live runner support.
- Enhanced playground code snippets to accommodate live runner calls and external user ID handling.
…ent configurations

- Updated `.env.example` to reflect new PymtHouse URLs for production and local development.
- Introduced new API routes for handling live runner capabilities and improved playground functionality.
- Enhanced routing in `next.config.ts` to support dynamic paths for app management.
- Added new components and context for managing live runner state in the dashboard.
- Improved error handling and response parsing in API interactions for better reliability.
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