Skip to content

SDKs & examples

The Arbitex Gateway is a superset of the OpenAI API, so any client, SDK, or tool that targets OpenAI works against the gateway with only two changes: the base URL and the API key. There is no Arbitex-specific SDK to install.

Setting Value
Base URL https://api.arbitex.ai/v1
API key arb_live_… (see Authentication)
Model format provider/model-id (e.g. anthropic/claude-sonnet-4-20250514, openai/gpt-4o)
from openai import OpenAI
client = OpenAI(
api_key="arb_live_your-api-key-here",
base_url="https://api.arbitex.ai/v1",
)
# Streaming, with Arbitex DLP events surfaced alongside standard chunks
stream = client.chat.completions.create(
model="openai/gpt-4o",
messages=[{"role": "user", "content": "Summarize our Q3 results."}],
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta.content or ""
print(delta, end="")
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "arb_live_your-api-key-here",
baseURL: "https://api.arbitex.ai/v1",
});
const resp = await client.chat.completions.create({
model: "anthropic/claude-sonnet-4-20250514",
messages: [{ role: "user", content: "Draft a polite decline email." }],
});
console.log(resp.choices[0].message.content);

Any tool with a configurable OpenAI base URL works — LangChain, LlamaIndex, the OpenAI CLI, IDE assistants, and similar. Point the base URL at https://api.arbitex.ai/v1 and supply your arb_live_ key.

The standard SDKs return the OpenAI response shape. To read the Arbitex additions:

  • Policy headers (X-Policy-Action, X-Matched-Rule) — read them from the raw HTTP response. Most SDKs expose response headers via a with_raw_response accessor or equivalent.
  • DLP streaming events (dlp_correction, output_blocked) — surface as events in the stream; handle them alongside standard content chunks.

See Chat completions for the full streaming + DLP-event reference.