Integration
InferencePass with the OpenAI SDK.
Point the official Python or JavaScript client at one new base URL and keep the chat completion workflow you already know.
Python
Install openai, set INFERENCEPASS_API_KEY, and configure the base URL.
Python
from openai import OpenAI
client = OpenAI(
api_key=os.environ["INFERENCEPASS_API_KEY"],
base_url="https://api.inferencepass.com/v1",
)
response = client.chat.completions.create(
model="auto",
messages=[{"role": "user", "content": "Explain vector databases."}],
)JavaScript
Use the server-side OpenAI client. Never ship the API key in browser JavaScript.
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.INFERENCEPASS_API_KEY,
baseURL: "https://api.inferencepass.com/v1",
});
const response = await client.chat.completions.create({
model: "auto",
messages: [{ role: "user", content: "Hello" }],
});Models and features
Start with auto. Streaming, JSON response formats, system messages, temperature, max_tokens, and compatible tools use the normal SDK options.