Configure an OpenAI SDK custom base URL
Set Python base_url or Node.js baseURL to the InferGate API endpoint. Avoid doubled v1 paths, wrong credentials and app-host requests.
Use the API host
The SDK base URL is https://api.useinfergate.com/v1. Do not use the public website or application host as the SDK endpoint.
| Client | Option | Value |
|---|---|---|
| Python | base_url | https://api.useinfergate.com/v1 |
| Node.js | baseURL | https://api.useinfergate.com/v1 |
Avoid path and credential mistakes
- Use an InferGate key, not a key from a different provider.
- Include /v1 once in the base URL; the SDK appends /responses.
- Keep secrets in environment variables or a server secret manager.
- List available models with the same key before selecting an ID.
Minimal configurations
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["INFERGATE_API_KEY"],
base_url="https://api.useinfergate.com/v1",
)
response = client.responses.create(
model="gpt-5.5",
input="Reply with one sentence about API design.",
max_output_tokens=256,
)
print(response.output_text)import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.INFERGATE_API_KEY,
baseURL: "https://api.useinfergate.com/v1",
});
const response = await client.responses.create({
model: "gpt-5.5",
input: "Reply with one sentence about API design.",
max_output_tokens: 256,
});
console.log(response.output_text);Compare URL configuration mistakes
| Layer or outcome | Expected value or observation | Action |
|---|---|---|
| Correct SDK base | https://api.useinfergate.com/v1 | SDK appends the endpoint |
| Wrong host | The public site or app host | May return HTML instead of API JSON |
| Doubled version | /v1/v1/responses | Usually indicates duplicate path configuration |
| Wrong credential | Another provider key | Use the InferGate account key |
Frequently asked questions
Do I put /responses into base_url?
No. Use https://api.useinfergate.com/v1 as the SDK base and call the Responses method. The SDK supplies the endpoint path.
Why do I receive HTML rather than JSON?
Inspect the actual request host and path. The website and dashboard serve HTML; model requests belong on the API host. Record a sanitized URL, not the authorization header.
Does changing an environment variable affect every client?
Not necessarily. An application may explicitly set the URL or reuse a client created before the variable changed. Inspect the configuration of the instance sending the request.
Continue your integration
Review prepaid pricing · Read API documentation · Get Started