Call on-premises models on ARX through the API
Overview
ARX runs on a server with GPU resources, so you can deploy models quickly and give your generative AI applications local inference.
The ARX model gateway speaks two formats: the OpenAI API and the Claude API. Your applications keep using the mainstream API format they already use, which also makes switching between cloud and on-premises models straightforward.
This article covers where to find the three values a call needs, with examples in cURL and Python.
What you'll learn
- Get the model API endpoint, API key, and model ID
- Tell the OpenAI and Claude API formats apart
- Call an on-premises model with cURL and the Python SDKs
Estimated time: about 10 minutes
Applies to
- ARX OS 1.0 and later
Before you begin
- You have deployed a model in AI Model Center, and its status on the Model Instance page reads Running
If you haven't deployed one yet, see AI Model Center for the download and deploy walkthrough.
What you'll need
A call needs these three values:
| Value | What it is | Where to find it |
|---|---|---|
| Model API Endpoint | The URL of the ARX model gateway | The Home page in AI Model Center, or API Key › API Endpoint |
| API Key | The credential that authenticates the call | The API Key page in AI Model Center — you create it yourself |
| Model ID | The identifier you pass in the request's model field | The Home page, API Key › API Endpoint, or Model Instance |
Step 1: Get the three values
Model API endpoint
Look on the Home page in AI Model Center, or on API Key › API Endpoint.
<API_ENDPOINT>: the endpoint the ARX interface shows already ends in /ai/v1, for example http://192.168.1.100/ai/v1. Each example appends its own path.API key
- Go to the API Key page in AI Model Center
- Click Add API Key
- Follow the fields to finish the setup — you can set an expiry date for the key and choose which models it can reach
- Copy the generated key
Model ID
The Home page, the API Key › API Endpoint page, and the Model Instance page all show the model's Instance Name. That string is the model ID you pass in the request's model field.
How the two API formats differ
The same endpoint and key work with both formats. Here's what changes:
| OpenAI API format | Claude API format | |
|---|---|---|
| Request path | <API_ENDPOINT>/chat/completions | <API_ENDPOINT>/messages |
| Auth header | Authorization: Bearer <YOUR_API_KEY> | x-api-key: <YOUR_API_KEY> |
max_tokens | Optional | Required |
| Where the system prompt goes | An item with role system in the messages array | A separate system field |
| Where the reply text sits | choices[0].message.content | The text block in the content array |
SDK base_url | The endpoint as shown | The endpoint without the trailing /v1 |
Pick the format your application's existing SDK already uses: if it calls OpenAI, stay on the OpenAI format; if it calls Claude, stay on the Claude format. Either way, your application logic doesn't change.
Step 2: Make your first request with cURL
Before you start, replace the three placeholders with the values from Step 1: <API_ENDPOINT>, <YOUR_API_KEY>, and <MODEL_ID>.
List the available models
Run this first to confirm the key and the endpoint are both correct:
curl <API_ENDPOINT>/models \
-H "Authorization: Bearer <YOUR_API_KEY>"
The deployed model should appear in the returned list.
OpenAI API format
curl <API_ENDPOINT>/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-d '{
"model": "<MODEL_ID>",
"messages": [
{"role": "user", "content": "Explain on-premises model deployment in one sentence."}
]
}'
A successful call returns something like the following, with the model's output in choices[0].message.content:
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "<MODEL_ID>",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "On-premises model deployment means running an AI model on your own hardware, so your data never leaves for the cloud."
},
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 21, "completion_tokens": 35, "total_tokens": 56 }
}
Claude API format
The auth header and the request path both differ from the OpenAI format, and max_tokens is required:
curl <API_ENDPOINT>/messages \
-H "Content-Type: application/json" \
-H "x-api-key: <YOUR_API_KEY>" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "<MODEL_ID>",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Explain on-premises model deployment in one sentence."}
]
}'
Step 3: Call the model from the Python SDK
OpenAI API format
Install the package:
pip install openai
import os
from openai import OpenAI
client = OpenAI(
base_url=os.environ["ARX_ENDPOINT"], # ← Change 1: point at your ARX device
api_key=os.environ["ARX_API_KEY"], # ← Change 2: your API key
)
response = client.chat.completions.create(
model=os.environ["ARX_MODEL_ID"], # ← Change 3: the model ID
messages=[
{"role": "system", "content": "You are a friendly technical assistant. Keep answers short and precise."},
{"role": "user", "content": "Explain on-premises model deployment in one sentence."},
],
)
print(response.choices[0].message.content)
An application that already calls OpenAI needs no logic changes — only the three marked values.
base_url:Use the endpoint as the interface shows it (ending in /ai/v1) for the OpenAI SDK's base_url. The SDK appends /chat/completions itself.Claude API format
Install the package:
pip install anthropic
import os
import anthropic
client = anthropic.Anthropic(
base_url=os.environ["ARX_ENDPOINT"].removesuffix("/v1"), # ← Change 1: point at your ARX device
api_key=os.environ["ARX_API_KEY"], # ← Change 2: your API key
)
message = client.messages.create(
model=os.environ["ARX_MODEL_ID"], # ← Change 3: the model ID
max_tokens=1024, # Required in the Claude format
system="You are a friendly technical assistant. Keep answers short and precise.",
messages=[
{"role": "user", "content": "Explain on-premises model deployment in one sentence."},
],
)
for block in message.content:
if block.type == "text":
print(block.text)
/v1 from the Claude SDK's base_url:The Anthropic SDK appends /v1/messages itself — the opposite of the OpenAI SDK.Official API documentation
For the full field reference, see the vendor documentation:
- OpenAI API: https://developers.openai.com/api/docs
- Claude API: https://platform.claude.com/docs/en/api/overview
