OpenAI-Compatible API
The gateway implements the OpenAI Chat Completions / Embeddings protocol. Switch base_url and you're done.Python
from openai import OpenAIclient = OpenAI( api_key="cpk_xxx", base_url="https://api.codepus.ai/v1", )resp = client.chat.completions.create( model="gpt-4o-mini", messages=[{"role": "user", "content": "hello"}], ) print(resp.choices[0].message.content)
Node.js
import OpenAI from "openai";const client = new OpenAI({ apiKey: "cpk_xxx", baseURL: "https://api.codepus.ai/v1", });
Supported fields
β
messages, model, temperature, top_p, max_tokens β
stream (SSE) β
tools / tool_calls β
response_format (json_object / json_schema) β οΈ Some fields are model-dependentRouting
Use model: "auto" to let the gateway pick; or specify a concrete model. See Custom Base URL.