OpenAI Model
The openai function configures OpenAI as your model provider.
import { createAgent, openai } from "@inngest/agent-kit";
const agent = createAgent({ name: "Code writer", system: "You are an expert TypeScript programmer.", model: openai({ model: "gpt-4" }),});Configuration
Section titled “Configuration”The openai function accepts a model name string or a configuration object:
const agent = createAgent({ model: openai({ model: "gpt-4", apiKey: process.env.OPENAI_API_KEY, baseUrl: "https://api.openai.com/v1/", defaultParameters: { temperature: 0.5 }, }),});Options
Section titled “Options”model string required ID of the model to use. See the model endpoint compatibility table for details on which models work with the Chat API.
apiKey string The OpenAI API key to use for authenticating your request. By default we’ll
search for and use the OPENAI_API_KEY environment variable.
baseUrl string default: https://api.openai.com/v1/ The base URL for the OpenAI API.
defaultParameters object The default parameters to use for the model (ex: temperature, max_tokens,
etc).
Available Models
Section titled “Available Models”"gpt-4o""chatgpt-4o-latest""gpt-4o-mini""gpt-4""o1-preview""o1-mini""gpt-3.5-turbo"