Installation

SDK install steps for Node.js, Python, and Go clients, plus environment setup.

Xcity’s gateway is OpenAI-compatible, so you install the same SDK you’d use for OpenAI and point it at our base URL.

Node.js

npm install openai
import OpenAI from 'openai';

export const xcity = new OpenAI({
  apiKey: process.env.XCITY_API_KEY!,
  baseURL: 'https://tokenhub.xcity.one/v1',
});

Python

pip install openai
from openai import OpenAI

xcity = OpenAI(
    api_key=os.environ["XCITY_API_KEY"],
    base_url="https://tokenhub.xcity.one/v1",
)

Go

go get github.com/sashabaranov/go-openai
cfg := openai.DefaultConfig(os.Getenv("XCITY_API_KEY"))
cfg.BaseURL = "https://tokenhub.xcity.one/v1"
client := openai.NewClientWithConfig(cfg)

Environment variables

VariablePurpose
XCITY_API_KEYBearer token issued from /dashboard/keys
XCITY_BASE_URLOptional override; defaults to https://tokenhub.xcity.one/v1
XCITY_DEFAULT_MODELOptional default model id used by your app

Never commit XCITY_API_KEY to git. Store it in your platform’s secret manager — see Operations: Secrets.

Last updated: