OpenAI drop-in
Keep the official client. Change baseURL.
example.ts
TYPESCRIPT
| 1 | import OpenAI from "openai"; |
| 2 | |
| 3 | const openai = new OpenAI({ |
| 4 | apiKey: process.env.PROMPTIMIZER_API_KEY, |
| 5 | baseURL: "https://www.promptimizer.site/api/v1", |
| 6 | }); |
| 7 | |
| 8 | await openai.chat.completions.create({ |
| 9 | model: "auto", |
| 10 | messages: [{ role: "user", content: "Explain REST in two sentences." }], |
| 11 | }); |
Works with LangChain, the Vercel AI SDK, and any agent that already speaks OpenAI chat completions. Streaming is not enabled yet.