Copy
import Bytez from "bytez.js";
// insert your key
const sdk = new Bytez("BYTEZ_KEY");
// choose your chat model + insert your provider key
// const model = sdk.model("google/gemini-2.0-flash", "YOUR_GEMINI_KEY");
const model = sdk.model("openai/gpt-4o", "YOUR_OPEN_AI_KEY");
// provide the model your chat session
const messages = [
{ role: "system", content: "You are a friendly chatbot" },
{ role: "assistant", content: "Hello, I'm a friendly bot" },
{ role: "user", content: "Hello bot, what is the capital of England?" },
]
// send to model
const { error, output, provider } = await model.run(messages);
// `provider` is the raw OpenAI output
console.log({ error, output, provider });