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.

ClientOptionValue
Pythonbase_urlhttps://api.useinfergate.com/v1
Node.jsbaseURLhttps://api.useinfergate.com/v1

Avoid path and credential mistakes

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 outcomeExpected value or observationAction
Correct SDK basehttps://api.useinfergate.com/v1SDK appends the endpoint
Wrong hostThe public site or app hostMay return HTML instead of API JSON
Doubled version/v1/v1/responsesUsually indicates duplicate path configuration
Wrong credentialAnother provider keyUse 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

Start with a small request

Create an InferGate account Read API documentation

Explore the API

OpenAI-compatible APIMulti-model APIAI API gateway