Loading...
Loading...
Integrate Portkey AI Gateway into TypeScript/JavaScript applications. Use when building LLM apps with observability, caching, fallbacks, load balancing, or routing across 200+ LLM providers.
npx skill4agent add portkey-ai/skills portkey-typescript-sdknpm install portkey-ai
# or
yarn add portkey-ai
# or
pnpm add portkey-aiimport Portkey from 'portkey-ai';
const client = new Portkey({
apiKey: 'YOUR_PORTKEY_API_KEY',
virtualKey: 'YOUR_VIRTUAL_KEY', // Optional: for provider routing
});
const response = await client.chat.completions.create({
model: 'gpt-4',
messages: [
{ role: 'user', content: 'Hello!' }
],
});
console.log(response.choices[0].message.content);