bifrost-ai
v1.0.0
Published
BifrostAI SDK - Unified client for multiple AI providers (OpenAI, Anthropic, Google)
Maintainers
Readme
BifrostAI JavaScript SDK
Official JavaScript/TypeScript SDK for BifrostAPI — one API for various AI models (ChatGPT, Claude, Gemini).
Installation
npm install bifrost-aiQuick Start
import BifrostAI from 'bifrost-ai';
const client = new BifrostAI({
apiKey: 'bfr-xxxxx',
headers: { 'X-OpenAI-Key': 'sk-xxxxx' }
});
const response = await client.chat(
[{ role: 'user', content: 'Hello!' }],
{ model: 'gpt-4' }
);
console.log(response.choices[0].message.content);Streaming
for await (const chunk of client.chatStream(
[{ role: 'user', content: 'Count 1 to 5' }],
{ model: 'gpt-4' }
)) {
process.stdout.write(chunk.choices?.[0]?.delta?.content || '');
}File Upload
const file = await BifrostAI.fileFromPath('document.pdf');
const response = await client.chatWithFiles(
[{ role: 'user', content: 'Summarize this' }],
[file],
{ model: 'gpt-4-turbo' }
);
console.log(response.choices[0].message.content);License
MIT
