Every official OpenAI client accepts a custom base_url and api_key. Set those two and the rest of your code is unchanged.
Python
Python
from openai import OpenAI
client = OpenAI(
base_url="https://api.privatemind.com/v1",
api_key="PMIND...:abcdef...",
)
resp = client.chat.completions.create(
model="<model-id>",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)TypeScript / Node.js
TypeScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.privatemind.com/v1",
apiKey: "PMIND...:abcdef...",
});
const resp = await client.chat.completions.create({
model: "<model-id>",
messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);Go
Go
import (
"context"
"fmt"
openai "github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
client := openai.NewClient(
option.WithBaseURL("https://api.privatemind.com/v1"),
option.WithAPIKey("PMIND...:abcdef..."),
)
resp, _ := client.Chat.Completions.New(context.Background(), openai.ChatCompletionNewParams{
Model: openai.F("<model-id>"),
Messages: openai.F([]openai.ChatCompletionMessageParamUnion{
openai.UserMessage("Hello"),
}),
})
fmt.Println(resp.Choices[0].Message.Content)LangChain
Python
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
base_url="https://api.privatemind.com/v1",
api_key="PMIND...:abcdef...",
model="<model-id>",
)
print(llm.invoke("Hello").content)LlamaIndex
Python
from llama_index.llms.openai_like import OpenAILike
llm = OpenAILike(
api_base="https://api.privatemind.com/v1",
api_key="PMIND...:abcdef...",
model="<model-id>",
is_chat_model=True,
)OpenAILike is the right class because PrivateMind isn't on api.openai.com. Same wire shape, different host.
Vercel AI SDK
TypeScript
import { createOpenAI } from "@ai-sdk/openai";
import { generateText } from "ai";
const privatemind = createOpenAI({
baseURL: "https://api.privatemind.com/v1",
apiKey: "PMIND...:abcdef...",
});
const { text } = await generateText({
model: privatemind("<model-id>"),
prompt: "Hello",
});What works, what doesn't
Anything that hits /v1/chat/completions, /v1/embeddings, /v1/models, or /v1/audio/* works.
SDK features that hit endpoints PrivateMind doesn't expose (Assistants API, Files API, fine-tuning, batch API) return 404.
Where next
- Quickstart for the shortest path to a first request.
- Chat completions for the full parameter list the SDKs forward.
- Models to feature-detect what's live in your org.