Libraries

The OpenAI SDK, pointed at a different base URL.

Python and JavaScript/TypeScript have an official OpenAI client, and both accept a base_url override — point one at us and every typed model, retry and streaming helper in the SDK keeps working unmodified. No other language in this list has a client built for a configurable base URL, so the samples throughout these docs talk to the gateway with plain HTTP and the standard library instead.

Python

cURL
pip install openai
Python
from openai import OpenAI

client = OpenAI(
    api_key="...",             # or leave unset to read LARSA_API_KEY
    base_url="https://api.console.larsa.larsima.com/v1",
)

Requires openai >= 1.0 — the pre-1.0 client had no base_url parameter at all.

JavaScript / TypeScript

cURL
npm install openai
TypeScript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.LARSA_API_KEY,
  baseURL: "https://api.console.larsa.larsima.com/v1",
});

Requires openai >= 4.0, the version that ships its own TypeScript types and the baseURL constructor option.

Every other language

Go, Rust, Java, C#, PHP and Ruby all reach the gateway the same way: a JSON body, one Authorization header, and whichever HTTP client already ships with the language. That's not a workaround — it's the whole API, and it's what every sample in these docs, for every one of those languages, actually does.

Client`base_url` paramTyped request/responseStreaming helperUpload helperAuto-retry
openai-python
openai-node
Go — net/http
Rust — reqwest
Java — java.net.http
C# — HttpClient
PHP — curl
Ruby — net/http

"—" doesn't mean a feature is unavailable — every capability this platform has is one JSON field away in any of these languages. It means the SDK isn't holding your hand: you build the struct, parse the text/event-stream lines yourself for streaming, and decide your own retry policy for a 429 or a 5xx.

See also

Navigate Open esc Close