Nebius Token Factory
Connect AISIX AI Gateway to Nebius Token Factory so applications can call Nebius-hosted models through a stable AISIX model alias.
Nebius exposes an OpenAI-compatible API with bearer authentication. AISIX accepts the nebius community catalog ID and derives the openai adapter.
| Setting | Value used by AISIX |
|---|---|
| Catalog provider ID | nebius |
| API base | https://api.tokenfactory.nebius.com/v1 |
| Example upstream model | meta-llama/Llama-3.3-70B-Instruct |
| Authentication | Bearer API key |
Prerequisites
Prepare:
- An AISIX Cloud environment with an attached gateway.
- A Nebius Token Factory API key.
curlandjq.
Export the AISIX connection details:
export AISIX_CP="http://localhost:8080/api"
export AISIX_TOKEN="aisix_pat_YOUR_ADMIN_TOKEN"
export ENV_ID="YOUR_ENVIRONMENT_ID"
export AISIX_PROXY="http://127.0.0.1:3000"
Configure the Nebius Upstream
Create a Provider Key
export NEBIUS_API_KEY="YOUR_NEBIUS_API_KEY"
PROVIDER_KEY_ID=$(
curl -sS -X POST "$AISIX_CP/provider_keys" \
-H "Authorization: Bearer $AISIX_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"display_name": "nebius-prod",
"provider": "nebius",
"api_key": "'"${NEBIUS_API_KEY}"'",
"api_base": "https://api.tokenfactory.nebius.com/v1",
"allowed_environments": ["'"${ENV_ID}"'"]
}' | jq -er '.provider_key.id'
)
echo "$PROVIDER_KEY_ID"
Do not add adapter to a catalog provider key. AISIX derives the openai adapter and bearer auth scheme from the catalog. The explicit API base makes the target visible in configuration even when the same value is available from the synchronized catalog.
Create a Model
Nebius model IDs include the publisher namespace. Create an alias with the complete ID:
MODEL_ID=$(
curl -sS -X POST "$AISIX_CP/environments/$ENV_ID/models" \
-H "Authorization: Bearer $AISIX_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"display_name": "nebius-llama-prod",
"model_name": "meta-llama/Llama-3.3-70B-Instruct",
"provider_key_id": "'"${PROVIDER_KEY_ID}"'"
}' | jq -er '.model.id'
)
echo "$MODEL_ID"
Copy another ID from the current Nebius model catalog rather than removing or changing the publisher prefix.
Create a Caller API Key
AISIX_API_KEY=$(
curl -sS -X POST "$AISIX_CP/environments/$ENV_ID/api_keys" \
-H "Authorization: Bearer $AISIX_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"display_name": "nebius-caller",
"allowed_models": ["'"${MODEL_ID}"'"]
}' | jq -er '.plaintext'
)
echo "$AISIX_API_KEY"
Verify the Provider Connection
curl -sS -X POST "$AISIX_PROXY/v1/chat/completions" \
-H "Authorization: Bearer $AISIX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nebius-llama-prod",
"messages": [
{
"role": "user",
"content": "Say hello from Nebius Token Factory."
}
]
}'
The upstream request uses POST /v1/chat/completions, the exact Nebius model ID, and Authorization: Bearer <NEBIUS_API_KEY>.
Endpoint Coverage
Chat completions is supported. AISIX can bridge compatible Responses and Anthropic Messages requests through the chat adapter. Embeddings work only when the selected Nebius model is an embedding model available on the same OpenAI-compatible root.
Image generation, video generation, and rerank do not accept the nebius provider value. See Provider Compatibility.
Troubleshooting
| Symptom | Check |
|---|---|
Upstream 401 or 403 | Confirm the Nebius API key and project access. |
Upstream 404 | Confirm /v1 is present in api_base. |
| Model not found | Preserve the publisher namespace and model-name casing. |
Provider key creation returns 400 | Use provider: "nebius" without adapter. |
For rate limits, failover, and cost controls on the alias, see Model Aliases.