Affiliate disclosure: JXZNE AI is an independent Ofox referral site, not Ofox and not an official model provider. Eligible signups or spend through our Ofox link may earn us a commission. Prices and compatibility follow the provider.
OPENAI-COMPATIBLE API

Call an OpenAI-compatible API from Python, Node, or curl

The official OpenAI SDK separates the host from the model. Keep chat.completions.create and change two values: the API root, and a model id from that provider’s catalog. Ofox documents the OpenAI-compatible root as https://api.ofox.ai/v1. The three samples below are that shape. They are not a call this site has recorded as passing. The smoke status is still unverified.

Three checks before the first request

  1. Use the root https://api.ofox.ai/v1. Python’s argument is base_url. Node’s argument is baseURL. Do not append /chat/completions on the SDK root. The SDK adds that path.
  2. Keep the key in an environment variable or a local secret store. The SDK sends Authorization: Bearer. Do not put a key in a repository, a web page, or the samples below.
  3. Use the full model id from the provider catalog. These samples use openai/gpt-5.4 because the public catalog on 2026-11-12 included that id and did not include openai/gpt-5.6. Catalogs change. Check the models list before you send traffic.

Python base_url: openai-python. Node baseURL: openai-node. Ofox Chat Completions: Ofox docs.

Python

Install the official openai package, then pass the root when you construct the client. YOUR_API_KEY is a placeholder.

Python · official SDK
from openai import OpenAI

client = OpenAI(
    base_url="https://api.ofox.ai/v1",
    api_key="YOUR_API_KEY",
)

response = client.chat.completions.create(
    model="openai/gpt-5.4",
    messages=[{"role": "user", "content": "Hello"}],
)

print(response.choices[0].message.content)

The official client also reads OPENAI_API_KEY. If the key stays in the environment, OpenAI(base_url="https://api.ofox.ai/v1") is enough.

Node

The official package is openai. The option is baseURL, not Python’s base_url.

Node · official SDK
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.ofox.ai/v1",
  apiKey: process.env.OPENAI_API_KEY,
});

const response = await client.chat.completions.create({
  model: "openai/gpt-5.4",
  messages: [{ role: "user", content: "Hello" }],
});

console.log(response.choices[0].message.content);

curl

curl has no SDK, so the URL includes the method once: /chat/completions. Read the key from the environment.

curl
curl https://api.ofox.ai/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-5.4","messages":[{"role":"user","content":"Hello"}]}'

What these samples do not prove

scripts/ofox-smoke.py posts once to https://api.ofox.ai/v1/chat/completions when a key is present. The default model is openai/gpt-5.4. The recorded overall is unverified: the environment that prepared the status file had no key, so that call was not sent. Do not read a latency or a bill out of the samples above.

Cursor, Claude Code, and Codex are not in these three samples. Changing a base URL is not an official subscription for those products. For tools whose own docs describe a custom OpenAI-compatible base URL, see the checked list. This site has not verified the Codex or Claude Code clients. Ofox marks direct Cursor use as unsuitable.

Next: check a model id · 401 / 404 / 429 / timeout · estimate a month from rates you paste · what the smoke file means

Questions

Should base_url include /chat/completions?

No for the official Python and Node SDKs. Use https://api.ofox.ai/v1. The SDK requests /chat/completions. curl uses https://api.ofox.ai/v1/chat/completions once.

Is openai/gpt-5.4 a verified call?

No. It is the model id in the request shape. The public catalog on 2026-11-12 included that id and did not include openai/gpt-5.6. The smoke record on this site is still unverified.

Where do 401, 404, 429, and timeouts go?

Check the key, the path, and the model id, then rate and client timeout. The steps are on OpenAI-compatible API errors.

Open an account when you need a key

The samples can send a request only after you have a key for that root. The account, the top-up, and the key live on Ofox, not on this static page.

Get an Ofox API keyThis site is an Ofox affiliate site. Signing up through the link may earn a commission.

Disclosure: this is an Ofox affiliate / referral link. Qualifying signups or spend may earn JXZNE a commission. Prices and compatibility follow Ofox’s current page.