Variable: openai
constopenai: (modelId,config?) =>ModelConfig&object
Defined in: packages/core/src/providers/factories.ts:97
Configure OpenAI provider explicitly
Type Declaration
models
models: (
config?) =>Promise<ModelInfo[]>
List the OpenAI models the configured key can see, newest-first.
Parameters
config?
Returns
Promise<ModelInfo[]>
Param
OpenAI model ID (e.g., 'gpt-4o-mini', 'gpt-4o', 'o1-preview', 'gpt-5')
Param
Optional configuration (provider settings + reasoning options)
Returns
ModelConfig with provider set to 'openai'
Examples
const bot = new Baleybot({
model: openai('gpt-4o-mini')
});
const bot = new Baleybot({
model: openai('gpt-4o-mini', {
apiKey: 'sk-...'
})
});
const bot = new Baleybot({
model: openai('gpt-5', {
reasoningEffort: 'high',
reasoningSummary: 'detailed'
})
});
const bot = new Baleybot({
model: openai('gpt-5', {
baseUrl: 'https://api.custom.com/v1',
reasoningEffort: 'medium',
reasoningSummary: 'concise'
})
});
import { wrapWithLogging, wrapWithRetries } from '@baleybots/core';
const bot = new Baleybot({
model: openai('gpt-4o-mini', {
fetch: wrapWithRetries(
wrapWithLogging(globalThis.fetch),
5
)
})
});