@hpprouter/sdk
v0.1.0
Published
TypeScript client SDK for HPP Router
Readme
@hpprouter/sdk
TypeScript client SDK for the HPP Router consumer API.
Installation
npm install @hpprouter/sdkyarn add @hpprouter/sdkpnpm add @hpprouter/sdkUsage
import { HppRouter } from '@hpprouter/sdk';
const client = new HppRouter({
apiKey: process.env.HPPROUTER_API_KEY!,
baseURL: 'https://your-gateway.example.com'
});
const completion = await client.chat.send({
model: 'hpprouter/auto',
messages: [{ role: 'user', content: 'Hello!' }]
});
console.log(completion.data.choices);
console.log(completion.meta.resolvedModel);Models
const models = await client.models.list();
console.log(models.data.data);Usage and quota
const usage = await client.usage.get();
const quota = await client.quota.check();
console.log(usage.data.remaining);
console.log(quota.data.has_quota);Image generation
const image = await client.images.generate({
model: 'gpt-image-1',
prompt: 'A serene mountain landscape at sunset',
size: '1024x1024',
quality: 'auto'
});
console.log(image.data.data);Streaming
const { stream, meta } = await client.chat.stream({
model: 'openai/gpt-5',
messages: [{ role: 'user', content: 'Stream a short answer.' }]
});
for await (const event of stream) {
console.log(event);
}
console.log(meta.resolvedModel);Maintainer release commands
Run these commands from the repository root.
Build the SDK and generate OpenAPI-derived TypeScript types:
npm run build:sdkRun the SDK unit tests:
npm run test:sdkPreview the npm package contents without creating a tarball:
npm run pack:sdk:dryCreate the local npm tarball, for example hpprouter-sdk-0.1.0.tgz:
npm run pack:sdkPublish the package to the public npm registry under the hpprouter organization:
npm run publish:sdkBefore publishing, make sure you are logged in to npm with an account that has publish access to the hpprouter organization:
npm loginUse npm run pack:sdk:dry before every publish to verify that only dist, README.md, and package.json are included in the package.
