Docs.
Detailed guides for every way to connect to 2KEN. Use the same token, base URL, and model configuration from command lines, OpenAI-compatible SDKs, HTTP APIs, code clients, and switching tools.
OpenAI SDK
Connect any OpenAI-compatible SDK to the 2KEN API address. Replace only `baseURL` and the token while keeping chat completions familiar.
Endpoint
Replace only the base URL. SDK shape, JSON body, and bearer auth stay familiar.
https://apis.2ken.com/v1npm install openaiimport OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.TWOKEN_API_KEY,
baseURL: "https://apis.2ken.com/v1",
});
const response = await client.chat.completions.create({
model: "gpt-4.1-mini",
messages: [
{ role: "user", content: "Say hello from 2KEN." },
],
});
console.log(response.choices[0]?.message?.content);NotesKeep the real token on the server or in local environment variables, then reuse the current API address and model from the example.
Ready to ship?
Open the console next, copy a token, inspect model policy, and place the real values into the matching client.