JavaScript
JavaScript Integration
Installation
npm install openaiUsage
import OpenAI from "openai";
// Initialize the client
const openai = new OpenAI({
apiKey: "your-api-key", // Use your Agent ID as the API Key
baseURL: "https://api-quicksilver.iotex.ai/v1", // QuickSilver API endpoint
});
// Prepare Actor input
const runInput = {
model: "gpt-3.5-turbo",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Tell me about OpenAPI schemas." }
],
temperature: 0.7
};
// Run the conversation
async function main() {
const response = await openai.chat.completions.create(runInput);
// Process the response
console.log(response.choices[0].message.content);
}
main();Tips
Last updated

