Docs/Gateway/OpenAI-compatible API

OpenAI-compatible API

If you just want the models and already use an OpenAI client, point it at the gateway and use your cg_sk_ key. No codegraff SDK required.

TypeScript

ts
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://gateway.codegraff.com/v1",
  apiKey: process.env.CODEGRAFF_API_KEY,   // cg_sk_...
});

const res = await client.chat.completions.create({
  model: "deepseek-v4-pro",
  messages: [{ role: "user", content: "Hello from codegraff" }],
});
console.log(res.choices[0].message.content);

Python

python
from openai import OpenAI

client = OpenAI(
    base_url="https://gateway.codegraff.com/v1",
    api_key="cg_sk_...",
)

res = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[{"role": "user", "content": "Hello from codegraff"}],
)
print(res.choices[0].message.content)

See the full model list on the Models page, and the gateway contract for Responses, Claude, Gemini, and prompt caching.