Connect → OpenAI SDK

Use AxForge with the OpenAI SDK

The official OpenAI SDKs take a base-URL option. Set it to https://api.axforge.ai/v1, use your AxForge key, and the rest of your code is unchanged — chat, streaming, tools, vision and embeddings all work against the same client.

Python

Python
# pip install openai — the official SDK, unchanged
from openai import OpenAI

client = OpenAI(
    base_url="https://api.axforge.ai/v1",   # or set OPENAI_BASE_URL
    api_key="YOUR_AXFORGE_KEY",             # or set OPENAI_API_KEY
)

resp = client.chat.completions.create(
    model="chat",
    messages=[{"role": "user", "content": "Hello from Stockholm"}],
)
print(resp.choices[0].message.content)
print(resp.usage)   # token counts, for your own accounting

Streaming

stream = client.chat.completions.create(
    model="chat", stream=True,
    messages=[{"role": "user", "content": "Count to five"}],
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

Embeddings

e = client.embeddings.create(model="embeddings", input="a sentence to embed")
print(len(e.data[0].embedding))   # 1024

Node / TypeScript

Node
// npm i openai
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.axforge.ai/v1",   // or OPENAI_BASE_URL
  apiKey: process.env.AXFORGE_API_KEY,       // or OPENAI_API_KEY
});

const resp = await client.chat.completions.create({
  model: "chat",
  messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);

Tip — use chat.completions. This SDK's client.chat.completions.create hits the widely-supported Chat Completions API and is the path shown here. AxForge also serves the newer Responses API (client.responses.create/v1/responses) natively, so either works — see Codex & Claude Code.

Model names

Use a stable role name like chat or embeddings, or an exact version like qwen3.8-27b-nvfp4 — both resolve to the same served model. Call client.models.list() (GET /v1/models) for the live catalogue, or see Models & pricing.

Keep your data in the EU

Every key is pinned to an EU region, and you can force one per request with a default header:

client = OpenAI(
    base_url="https://api.axforge.ai/v1", api_key="YOUR_AXFORGE_KEY",
    default_headers={"x-axforge-region": "eu-se-1"},
)

Prompts and completions are processed in memory and never retained — see Regions & data handling.

© 2026 AxForge · EU-hosted AI infrastructure Pricing Docs Trust Privacy Terms