Before building an agent that uses an OpenAI model, you’ll need to create an OpenAI developer account and get an API key.

Configuration

name
OpenAiModel
The name of the OpenAI model you want your agent to use. By default, your agent will use gpt-4o-mini.
secret
string
The name of the secret which contains your OpenAI API key. NOTE: This is the name of the secret, not your actual secret key!

Creating the Model

Calling openai() with no arguments will use all default values:
import { Agent, openai } from '@ardent-ai/sdk';

const agent = new Agent({
  model: openai()
});
Passing a single string argument will set the model name:
import { Agent, openai } from '@ardent-ai/sdk';

const agent = new Agent({
  model: openai('gpt-4.5-preview')
});
Or, you can set every parameter by passing a configuration object:
import { Agent, openai } from '@ardent-ai/sdk';

const agent = new Agent({
  model: openai({
    name: 'gpt-4.5-preview',
    secret: 'MY_CUSTOM_OPENAI_SECRET_NAME'
  })
});