Cerebras
Cerebras Inference hosts open-weight models on Cerebras inference systems. AISIX places those models behind one OpenAI-compatible API and centralizes upstream credentials, caller access, rate limits, and usage accounting.
Prerequisites
Before starting, prepare the following:
- One AISIX setup:
- For AISIX Cloud, an environment with an attached gateway and a write-scoped admin token. For On-Premises, follow the AISIX Cloud Quickstart. To request Hybrid Cloud access, contact API7.
- For the open-source AISIX gateway, prepare either a local AISIX installation or the Docker setup from the Open-Source AISIX Gateway Quickstart. Configure the gateway to load a declarative resources file.
- A Cerebras API key from the Cerebras Cloud console.
curlandjq.
Configure with AISIX Cloud
Export the AISIX Cloud connection details:
# AISIX_CP is the Admin API base URL; include /api and omit a trailing slash
# The local On-Premises quickstart uses http://localhost:8080/api
export AISIX_CP="YOUR_AISIX_CLOUD_ADMIN_API_URL"
export AISIX_TOKEN="YOUR_ADMIN_TOKEN"
export ENV_ID="YOUR_ENVIRONMENT_ID"
Create a provider key, model alias, and caller API key for the Cerebras-backed chat-completions route.
Because the Cerebras API is OpenAI-compatible, AISIX connects through the openai adapter and uses the Cerebras API root as api_base.
Create a Provider Key
Create the provider key that stores the Cerebras credential and API root:
# Replace with your value
export CEREBRAS_API_KEY="YOUR_PROVIDER_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": "cerebras-prod",
"provider": "cerebras",
"api_key": "'"${CEREBRAS_API_KEY}"'",
"api_base": "https://api.cerebras.ai/v1",
"allowed_environments": ["'"${ENV_ID}"'"]
}' | jq -r '.provider_key.id')
echo "$PROVIDER_KEY_ID"
❶ provider is cerebras. The AISIX Cloud Admin API derives the adapter from the catalog provider; the adapter field is only accepted on BYO provider keys.
❷ api_key stores the Cerebras API key. Cerebras authenticates with HTTP bearer authentication, which is what the openai adapter already sends. The value follows the credential-handling behavior in Provider Keys.
❸ api_base is https://api.cerebras.ai/v1, the same root that Cerebras documents as the baseURL for OpenAI client libraries. It already includes the /v1 path, so AISIX appends the endpoint path, such as /chat/completions, directly to it. For the cerebras catalog provider the field is optional — the AISIX Cloud Admin API fills in this same value when you omit it — but the examples set it explicitly so the root each key targets stays visible in the configuration.
The command captures the returned provider key ID in PROVIDER_KEY_ID.
Create a Model
Cerebras model IDs are bare identifiers with no vendor prefix, even when the weights come from another vendor. The OpenAI open-weight model is gpt-oss-120b on Cerebras, and the Google model is gemma-4-31b. Check the Cerebras model catalog for the current list before you create an alias; the catalog is short and rotates as models are added and retired. Current IDs include gpt-oss-120b, gemma-4-31b, and zai-glm-4.7.
Create the model alias callers will send in requests:
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": "cerebras-gptoss-prod",
"model_name": "gpt-oss-120b",
"provider_key_id": "'"${PROVIDER_KEY_ID}"'"
}' | jq -r '.model.id')
echo "$MODEL_ID"
❶ display_name is the alias callers send in model.
❷ model_name is the Cerebras model ID, for example gpt-oss-120b or gemma-4-31b. Do not carry over a prefixed ID such as openai/gpt-oss-120b from another provider that hosts the same weights.
❸ provider_key_id attaches the alias to the Cerebras provider key.
Create a Caller API Key
Create the caller API key that can access the model alias. The plaintext key is server-generated and returned once in the create response, so capture it now:
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": "cerebras-caller",
"allowed_models": ["'"${MODEL_ID}"'"]
}' | jq -r '.plaintext')
echo "$AISIX_API_KEY"
The allowed_models value must reference the model ID captured in the previous step. After the write, the configuration projects to attached gateways automatically.