
BotHub: ¡Prueba gratis!bot
Ejemplo de código y API para gpt-4.5-previewOfrecemos acceso completo a la API de OpenAI a través de nuestro servicio. Todos nuestros puntos finales cumplen completamente con los puntos finales de OpenAI y se pueden usar tanto con complementos como al desarrollar su propio software a través del SDK.Crear clave API
import OpenAI from 'openai';
const openai = new OpenAI({
apiKey: '<your bothub access token>',
baseURL: 'https://bothub.chat/api/v2/openai/v1'
});
// Sync - Text generation
async function main() {
const chatCompletion = await openai.chat.completions.create({
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'gpt-4.5-preview',
});
}
// Async - Text generation
async function main() {
const stream = await openai.chat.completions.create({
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'gpt-4.5-preview',
stream: true
});
for await (const chunk of stream) {
const part: string | null = chunk.choices[0].delta?.content ?? null;
}
}
main();
Cómo funciona gpt-4.5-preview?
Los bothubs recopilan información...