openaiClientAdapter
Points the OpenAI SDK at OpenAI itself. This is the baseline — use it when your backend is OpenAI.
Signature
openaiClientAdapter({
openai: OpenAI,
})
Install
npm install supercompat openai
Responses API
import OpenAI from 'openai'
import {
supercompat,
openaiClientAdapter,
openaiResponsesRunAdapter,
memoryStorageAdapter,
} from 'supercompat/openai'
const client = supercompat({
clientAdapter: openaiClientAdapter({
openai: new OpenAI({ apiKey: process.env.OPENAI_API_KEY }),
}),
storageAdapter: memoryStorageAdapter(),
runAdapter: openaiResponsesRunAdapter(),
})
const response = await client.responses.create({
model: 'gpt-4.1-mini',
input: 'Hello.',
})
Assistants API
import OpenAI from 'openai'
import {
supercompat,
openaiClientAdapter,
completionsRunAdapter,
prismaStorageAdapter,
} from 'supercompat/openai'
import { PrismaClient } from '@prisma/client'
const client = supercompat({
clientAdapter: openaiClientAdapter({ openai: new OpenAI() }),
storageAdapter: prismaStorageAdapter({ prisma: new PrismaClient() }),
runAdapter: completionsRunAdapter(),
})
const assistant = await client.beta.assistants.create({
model: 'gpt-4.1-mini',
instructions: 'You are a helpful assistant.',
})
const thread = await client.beta.threads.create()
await client.beta.threads.messages.create(thread.id, { role: 'user', content: 'Hi.' })
const run = await client.beta.threads.runs.createAndPoll(thread.id, { assistant_id: assistant.id })
Compatible run adapters