Quickstart
One-shot prompt
Section titled “One-shot prompt”Run codex login once first if you want to use Codex OAuth.
import { prompt } from 'open-agent-sdk';
const result = await prompt('Summarize the repository structure.', { model: 'gpt-5.4', provider: 'codex'});
console.log(result.result);console.log(result.usage);Session workflow
Section titled “Session workflow”import { createSession } from 'open-agent-sdk';
const session = await createSession({ model: 'gpt-5.4', provider: 'codex'});
await session.send('Read the current directory and list key files.');
for await (const message of session.stream()) { if (message.type === 'assistant') { console.log(message.message.content); }}
session.close();Next step
Section titled “Next step”- Configure runtime defaults in Provider & Auth Strategy
- Add safety controls in Permissions & Safety
- Use
provider: 'openai'withOPENAI_API_KEYif you prefer usage-based OpenAI Platform access instead of Codex OAuth