@vlunaai/sdk
v0.1.4
Published
VlunaAI TypeScript SDK for billing and gate APIs
Maintainers
Readme
@vlunaai/sdk
Official TypeScript SDK for the VlunaAI billing and usage gate APIs.
The package bundles:
- Service-to-service and bearer-auth clients
- Service Key authentication helpers
- Shared HTTP transport and typed error handling
- Generated typed API bindings
Documentation:
https://docs.vluna.ai/docs/adapters/sdk
Installation
npm install @vlunaai/sdkRuntime support:
- Modern browsers
- Node.js >= 18
Quickstart (Service Key, server-to-server)
import {
createServiceClient,
type RequestContext,
type ServiceClientOptions,
} from '@vlunaai/sdk'
const options: ServiceClientOptions = {
config: {
baseUrl: process.env.VLUNA_SERVICE_BASE_URL ?? 'https://us-central1.api.vluna.ai/mgt/v1',
realmId: process.env.VLUNA_REALM_ID!,
},
serviceKey: {
keyId: process.env.VLUNA_SERVICE_KEY_ID!,
secret: process.env.VLUNA_SERVICE_KEY_SECRET!,
},
}
const client = createServiceClient(options)
const context: RequestContext = {
principalId: 'team_123',
userId: 'user_456',
}
const authz = await client.s2s.gate.authorize(
{ feature_code: 'openai.gpt5.2', feature_family_code: 'llm.premium' },
context,
)
console.log(authz.data?.lease_token)Quickstart (Bearer token, end-user calls)
import { createBearerClient, type BearerClientOptions, type RequestContext } from '@vlunaai/sdk'
const options: BearerClientOptions = {
config: {
baseUrl: process.env.VLUNA_BEARER_BASE_URL ?? 'https://us-central1.api.vluna.ai/api/v1',
realmId: process.env.VLUNA_REALM_ID!,
},
}
const client = createBearerClient(options)
const context: RequestContext = {
accessToken: process.env.VLUNA_ACCESS_TOKEN!,
}
const products = await client.bearer.listCatalogProducts(undefined, context)
console.log(products)More details:
https://docs.vluna.ai/docs/adapters/sdk
