Docs/IDE Integration & API/OpenAI-Compatible API

OpenAI-Compatible API

The gateway implements the OpenAI Chat Completions / Embeddings protocol. Switch base_url and you're done.

Python

from openai import OpenAI
client = 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-dependent
  • Routing

    Use model: "auto" to let the gateway pick; or specify a concrete model. See Custom Base URL.