
BotHub: Попробуйте ИИ прямо сейчасbot
Fournisseurs spotlightSur Bothub, vous pouvez choisir vous-même les fournisseurs pour les requêtes. Si vous n'avez pas fait de choix, nous trouverons automatiquement des fournisseurs adaptés capables de gérer la taille et les paramètres de votre demande.
Пример кода и API для spotlightМы предлагаем полный доступ к API OpenAI через наш сервис. Все наши конечные точки полностью соответствуют конечным точкам OpenAI, их можно использовать как с плагинами, так и при разработке собственного программного обеспечения через SDK.Создать 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: 'spotlight',
});
}
// Async - Text generation
async function main() {
const stream = await openai.chat.completions.create({
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'spotlight',
stream: true
});
for await (const chunk of stream) {
const part: string | null = chunk.choices[0].delta?.content ?? null;
}
}
main();
Comment ça marche spotlight?
Les bothubs recueillent des informations...