This is the smallest real integration path: create a normal OpenAI client, wrap it with Admissible, configure the Admissible API URL and key, define managed tools, and run a real response through the wrapped client.
import OpenAI from "openai";import { authorityPresets, createBaselineOpenAI, defineBaselineTool,} from "@baseline-labs/adapter-openai";const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY!,});const stagingClient = createBaselineOpenAI({ openai, baseline: { baseUrl: process.env.ADMISSIBLE_BASE_URL!, apiKey: process.env.ADMISSIBLE_API_KEY!, authorityDefaults: { env: "staging", tenantId: "acme-co", }, }, agentId: "support-agent", sessionId: "sess_customer_123_staging", environmentName: "staging",});const productionClient = createBaselineOpenAI({ openai, baseline: { baseUrl: process.env.ADMISSIBLE_BASE_URL!, apiKey: process.env.ADMISSIBLE_API_KEY!, authorityDefaults: { env: "production", tenantId: "acme-co", }, }, agentId: "support-agent", sessionId: "sess_customer_123_production", environmentName: "production",});const readAccount = defineBaselineTool({ name: "readAccount", description: "Read staging account state before proposing a change.", authority: authorityPresets.readOnly, execute: async (input: { accountId: string }) => ({ accountId: input.accountId, status: "active", }),});const updatePlan = defineBaselineTool({ name: "updatePlan", description: "Apply a subscription change in production.", authority: authorityPresets.externalWrite, commit: { system: "billing", payload: (input: { accountId: string; plan: string }) => input, }, execute: async (input: { accountId: string; plan: string }) => ({ accepted: true, ...input, }),});const readResponse = await stagingClient.responses.create({ model: "gpt-4.1", input: "Read account acct_123 before the production update attempt.", tools: [readAccount],});const updateResponse = await productionClient.responses.create({ model: "gpt-4.1", input: "Upgrade account acct_123 to pro if needed.", tools: [updatePlan],});