Xinference
Model API quickstart

Send your first request in minutes.

Xinference provides production-ready open models through one OpenAI-compatible endpoint hosted in Australia.

Before you start

  1. 1. Create an accountSign in to the Xinference Cloud console.
  2. 2. Choose a modelReview each model ID and its US dollar price per 1M tokens.
  3. 3. Create an API keyStore it in the XINFERENCE_API_KEY environment variable.
View models & pricing

Python

OpenAI Python SDK

import os
from uuid import uuid4
from openai import OpenAI

client = OpenAI(
    base_url="https://YOUR-REGIONAL-API-HOST/v1",
    api_key=os.environ["XINFERENCE_API_KEY"],
    max_retries=0,
)

# With prepaid billing, use a fresh ID for each new logical request. Retain it
# after an unknown result unless the response says retry_with_new_key. Duplicate
# prepaid IDs are rejected, not replayed; subscription deployments ignore it.
request_id = os.environ.get("MODEL_API_REQUEST_ID") or str(uuid4())
print("Request ID:", request_id)
response = client.chat.completions.create(
    model="deepseek-v4.1-flash",
    extra_headers={"Idempotency-Key": request_id},
    messages=[{"role": "user", "content": "Hello!"}],
)

print(response.choices[0].message.content)

Endpoint

https://YOUR-REGIONAL-API-HOST/v1

This public example uses a placeholder. Sign in and copy the regional base URL from API quickstart before running it.

Xinference