Skip to content

OpenAI SDK

Use the official OpenAI SDKs with Mango Inference by overriding the base URL and API key. See OpenAI compatibility for the compatibility boundary.

Note

OpenAI SDK support is partial at MVP. Chat Completions is the primary supported surface; other OpenAI SDK features may not be available yet. See OpenAI compatibility for the current list of supported endpoints.

Python

from openai import OpenAI

client = OpenAI(
    base_url="https://api.mangoboost.io/v1",
    api_key="<your-api-key>",
)

resp = client.chat.completions.create(
    model="zai-org/GLM-5.3",
    messages=[{"role": "user", "content": "Hello from the OpenAI SDK!"}],
)
print(resp.choices[0].message.content)

JavaScript / TypeScript

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.mangoboost.io/v1",
  apiKey: process.env.MANGOINFERENCE_API_KEY,
});

const resp = await client.chat.completions.create({
  model: "zai-org/GLM-5.3",
  messages: [{ role: "user", content: "Hello from the OpenAI SDK!" }],
});
console.log(resp.choices[0].message.content);

What works, and what 404s

The SDK is a client for the whole OpenAI platform; Mango Inference serves part of it. Calls map onto the API surface like this:

SDK call Result
client.chat.completions.create(...) Works: the supported surface.
client.models.list() Works: returns the models your key can call.
client.embeddings.create(...) 404
client.responses.create(...) 404
client.files.*, client.batches.*, client.images.*, client.audio.* 404

Unsupported calls fail as a NotFoundError with a plain-text body, because the path is not routed at all. The SDK never gets a structured API error to explain itself. If a call raises NotFoundError and the model ID is right, the method is the problem, not your request.

Note also that reasoning_content on a reasoning model is not part of the OpenAI schema, so your SDK version may drop it from the typed response object. See Reasoning and OpenAI compatibility.