TypeScript, with the OpenAI SDK
The client you already have, pointed somewhere else. Everything the SDK sends — messages, temperature, tools, response format, images — is forwarded to whichever model Alphe picks, and the response comes back in the shape your code already parses.
- baseURL is the only line that changes
- model: "auto" hands the choice to the router
- Streaming, tool calls, structured output and vision pass through
- Set ALPHE_KEY from your environment, never in source
import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.alpheai.com/v1", // the only change apiKey: process.env.ALPHE_KEY, }); const res = await client.chat.completions.create({ model: "auto", messages: [{ role: "user", content: input }], });