Get started
Quickstart
Send your first OpenAI-compatible request to an InferX endpoint.
Before you begin
Sign in to the InferX Console and open the endpoint or model you want to use. Copy the API Base URL, Model Name, and API Key shown in Client Setup.
Send a request
InferX uses the OpenAI-compatible client interface. Install the standard Python client, set your API key, and point the client to InferX.
shell
pip install openaiinference.py
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["INFERX_API_KEY"],
base_url="https://model.inferx.net/v1",
)
stream = client.chat.completions.create(
model="YOUR_MODEL_ID",
messages=[{"role": "user", "content": "Hello, InferX."}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")