
Research
/Security News
737 Chrome VPN Extensions Linked to Brand Impersonation and Browser Traffic Redirection
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.
@perf_technology/sdk
Advanced tools
Official JavaScript/TypeScript SDK for Perf - the AI Runtime Orchestrator.
Perf automatically picks the best AI model for your prompt based on:
npm install @perf_technology/sdk
# or
yarn add @perf_technology/sdk
# or
pnpm add @perf_technology/sdk
import { PerfClient } from '@perf_technology/sdk';
const client = new PerfClient({
apiKey: 'pk_live_your_api_key',
});
// Simple chat completion
const response = await client.chat({
messages: [
{ role: 'user', content: 'What is the capital of France?' }
],
});
console.log(response.choices[0].message.content);
// Output: "The capital of France is Paris."
// Access Perf metadata
console.log(response.perf);
// { model_used: 'gpt-4o-mini', cost_usd: 0.0001, latency_ms: 234, ... }
// Stream responses
for await (const chunk of client.chatStream({
messages: [{ role: 'user', content: 'Write a haiku about coding' }],
})) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}
// Or collect into a string
const content = await client.chatStreamToString({
messages: [{ role: 'user', content: 'Explain quantum computing' }],
});
import {
PerfClient,
PerfError,
RateLimitError,
AuthenticationError
} from '@perf_technology/sdk';
try {
const response = await client.chat({
messages: [{ role: 'user', content: 'Hello!' }],
});
} catch (error) {
if (error instanceof RateLimitError) {
// Wait and retry
const retryAfter = error.retryAfter || 60;
console.log(`Rate limited. Retry after ${retryAfter} seconds`);
} else if (error instanceof AuthenticationError) {
console.error('Invalid API key');
} else if (error instanceof PerfError) {
console.error(`API Error: ${error.code} - ${error.message}`);
} else {
console.error('Unexpected error:', error);
}
}
const client = new PerfClient({
apiKey: 'pk_live_your_api_key', // Required
baseUrl: 'https://api.withperf.pro', // Optional, default shown
timeout: 120000, // Request timeout in ms (default: 2 min)
maxRetries: 3, // Retry attempts (default: 3)
retryDelay: 1000, // Base retry delay in ms (default: 1s)
});
const response = await client.chat({
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Hello!' },
],
model: 'gpt-4o', // Optional: override model selection
max_tokens: 1000, // Optional: limit response length
temperature: 0.7, // Optional: sampling temperature
max_cost_per_call: 0.01, // Optional: cost budget in USD
metadata: { // Optional: custom metadata
user_id: '123',
session_id: 'abc',
},
});
All types are exported for your convenience:
import type {
Message,
ChatRequest,
ChatResponse,
ChatStreamChunk,
PerfMetadata,
PerfClientConfig,
} from '@perf_technology/sdk';
MIT
FAQs
Official Perf SDK for JavaScript/TypeScript
The npm package @perf_technology/sdk receives a total of 0 weekly downloads. As such, @perf_technology/sdk popularity was classified as not popular.
We found that @perf_technology/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.