Skip to main content
Version: Dev

Get Started with AISIX Enterprise

In this quickstart, you evaluate AISIX Enterprise on one machine using Docker Compose, the bundled PostgreSQL database, and local endpoints. You start the control plane and dashboard, attach an AISIX gateway, configure an OpenAI model, and send a request through the gateway.

The local setup runs the control-plane services, dashboard, and PostgreSQL as one management stack. The AISIX gateway runs separately, giving configuration and live traffic distinct paths:

The control plane sends the configuration to the gateway. Client requests then travel through the gateway to OpenAI without crossing the control plane, while the dashboard provides gateway status, logs, and usage.

Licensing

The AISIX Enterprise control plane and dashboard are commercial software. Certain features are free for development, testing, and evaluation, but production use requires a commercial license. To run AISIX Enterprise in production, contact API7 or email support@api7.ai.

Prerequisites​

  • Install Docker with Docker Compose V2.
  • Install cURL, tar, and OpenSSL. If you use the Admin API to configure AISIX Enterprise, also install jq.
  • Make sure the installation host can reach run.api7.ai, Docker Hub, and OpenAI.
  • Make sure ports 5432, 8080, 7944, and 3000 are available on the installation host.
  • Use a browser on the installation host to open the dashboard at http://localhost:8080.
  • Prepare an OpenAI API key with access to gpt-4o-mini.

Start the Control Plane​

On a host with Docker and internet access, run:

curl -fsSL "https://run.api7.ai/aisix-self-hosted/quickstart" | bash

The installer downloads the current AISIX Enterprise package into ./aisix-self-hosted, generates a .env file with fresh secrets, pulls the container images, and starts the stack. The default dashboard URL is http://localhost:8080.

The installer also prints the first administrator's credentials, once, when the stack first starts successfully. If the first start fails, the run that succeeds prints them:

First administrator (shown this once):
email: admin@example.com
password: <generated password>

Keep them for the next step. They are also stored in .env as AISIX_CLOUD_BOOTSTRAP_ADMIN_EMAIL and AISIX_CLOUD_BOOTSTRAP_ADMIN_PASSWORD.

For this single-host quickstart, open ./aisix-self-hosted/.env and set the data-plane manager URL to:

AISIX_CLOUD_DPMGR_BASE_URL=https://host.docker.internal:7944

Recreate the api and dpm Docker Compose services so the dashboard uses the updated endpoint and dp-manager issues its TLS certificate for it. Wait for both services to become healthy:

cd aisix-self-hosted
docker compose up -d --wait api dpm

Check the control-plane health endpoint:

curl -fsS "http://127.0.0.1:8080/healthz"

The command should return {"status":"ok"}. Keep this terminal in the aisix-self-hosted directory for the remaining shell commands.

Sign In​

Open http://localhost:8080 and sign in with the first administrator's email address and password from the installer.

AISIX Enterprise sign-in page showing the default administrator email and an empty password field

When prompted, enter the installer password in Current password. Enter your replacement in New password and select Change password. The dashboard signs you in to the Default organization as its owner. If you run the quickstart again with the same PostgreSQL volume, sign in with the password you set here.

Create Gateway Resources​

AISIX Enterprise provides two ways to manage gateway resources.

  • Use the dashboard to create and inspect resources in the browser.
  • Use the AISIX Cloud Admin API to automate the same operations and export resource IDs for follow-on guides.

Choose one workflow to create the quickstart resources.

Dashboard​

The environment holds the model and the caller API key. The model uses a provider key to authenticate to OpenAI, and the caller key gives your application access to the model.

Create the Environment​

  1. Under Organization, open Environments and select New environment.

  2. Enter prod in Display name and select Create environment.

    New environment form with prod in Display name and the Create environment button
  3. On the confirmation page, select Back to environments.

Add the OpenAI Provider Key​

  1. Under Organization, open Provider keys and select New provider key.
  2. Set Display name to OpenAI and choose OpenAI in Provider.
  3. Paste your OpenAI API key into Upstream API key.
  4. Under Allowed environments, select prod so models in that environment can use the credential.
New provider key form with OpenAI as the name and provider, the credential masked, and prod selected

Select Create provider key and confirm that OpenAI appears in the list.

Create the Direct Model​

  1. In Environments, select Enter for prod.

  2. Open Models, select Create model, and choose Direct model.

    Create model menu with Direct model outlined above the other model types
  3. Enter gpt-4o-mini in Display name and Upstream model id. The display name is the alias your application sends. The upstream model ID is the model AISIX requests from OpenAI.

  4. In Provider key, select OpenAI (openai).

New model form showing gpt-4o-mini as the display name and upstream model ID with OpenAI selected as the provider key

Select Create model and confirm that gpt-4o-mini appears in the environment's model list.

Create the Caller API Key​

  1. In prod, open API keys and select New API key.

  2. Set Display name to quickstart-caller and select gpt-4o-mini under Allowed models.

    New API key form with quickstart-caller as the display name and gpt-4o-mini selected under Allowed models
  3. Select Create API key. On the One-time view card, select Copy to store the plaintext securely.

  4. Select I've saved it and confirm that quickstart-caller appears in the list. The plaintext is no longer available after you dismiss the card.

Export the copied caller key to send the verification request:

export AISIX_API_KEY="YOUR_CALLER_API_KEY"

For guides that use the Admin API, create an admin token and look up the IDs of existing resources with the list operations in the Admin API.

Continue to Attach an AISIX Gateway once the caller key is exported.

AISIX Cloud Admin API​

Use a write-scoped admin token to create the resources and save their IDs for later API calls.

Create an Admin Token​

The AISIX Cloud Admin API authenticates with an organization-scoped admin token.

  1. In the organization navigation, open Admin tokens and select New token.
  2. Enter a unique name such as quickstart-admin, choose an expiration period, and enable the write scope.
  3. Create the token and copy its plaintext value before leaving the page. The value is shown only once.

Export the control-plane API URL and token in the terminal:

export AISIX_CP="http://localhost:8080/api"
export AISIX_TOKEN="YOUR_ADMIN_TOKEN"

For token scope, expiration, and rotation details, see Admin Tokens.

Create the Resources​

Create the prod environment:

ENV_RESPONSE=$(curl -fsS -X POST "$AISIX_CP/environments" \
-H "Authorization: Bearer ${AISIX_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"display_name": "prod"}')

export ENV_ID=$(echo "$ENV_RESPONSE" | jq -er '.environment.id')
echo "$ENV_RESPONSE" | jq

Create a provider key that stores your OpenAI credential and allow it in the environment:

export OPENAI_API_KEY="YOUR_OPENAI_API_KEY"

PROVIDER_KEY_RESPONSE=$(curl -fsS -X POST "$AISIX_CP/provider_keys" \
-H "Authorization: Bearer ${AISIX_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"provider": "openai",
"display_name": "OpenAI",
"api_key": "'"${OPENAI_API_KEY}"'",
"api_base": "https://api.openai.com/v1",
"allowed_environments": ["'"${ENV_ID}"'"]
}')

export PROVIDER_KEY_ID=$(echo "$PROVIDER_KEY_RESPONSE" | jq -er '.provider_key.id')
echo "$PROVIDER_KEY_RESPONSE" | jq

Create a gpt-4o-mini model backed by the provider key:

MODEL_RESPONSE=$(curl -fsS -X POST "$AISIX_CP/environments/$ENV_ID/models" \
-H "Authorization: Bearer ${AISIX_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"display_name": "gpt-4o-mini",
"model_name": "gpt-4o-mini",
"provider_key_id": "'"${PROVIDER_KEY_ID}"'"
}')

export MODEL_ID=$(echo "$MODEL_RESPONSE" | jq -er '.model.id')
echo "$MODEL_RESPONSE" | jq

Create a caller API key that can use the model. Save the plaintext value because it is returned only once:

API_KEY_RESPONSE=$(curl -fsS -X POST "$AISIX_CP/environments/$ENV_ID/api_keys" \
-H "Authorization: Bearer ${AISIX_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"display_name": "quickstart-caller",
"allowed_models": ["'"${MODEL_ID}"'"]
}')

export API_KEY_ID=$(echo "$API_KEY_RESPONSE" | jq -er '.api_key.id')
export AISIX_API_KEY=$(echo "$API_KEY_RESPONSE" | jq -er '.plaintext')
echo "$API_KEY_RESPONSE" | jq 'del(.plaintext)'

Each command saves the resource ID needed by the next step or by subsequent guides. If curl or jq reports an error, stop and correct it before continuing; a missing ID causes later commands to fail.

Attach an AISIX Gateway​

The gateway runs separately from the control plane. Issue a certificate for prod so the gateway can connect and load that environment's configuration.

  1. In Environments, select Enter for prod, then open Data planes. If the page already lists registered gateways, select Add a data plane.

  2. For this local setup, leave Validity at its default and Hostname (optional) empty. Select Issue certificate.

    Issue gateway certificate panel with default validity, an empty hostname field, and the Docker install script still locked
  3. On the Docker tab, copy the generated snippet. Treat the snippet as a secret because it contains the gateway certificate and private key.

  4. On Linux with Docker Engine, add --add-host host.docker.internal:host-gateway before the image name in the generated docker run command. Docker Desktop resolves host.docker.internal automatically.

  5. Run the snippet. It starts a container named aisix-dp, publishes the proxy on port 3000, and waits for /readyz to return success. If it keeps waiting, inspect docker logs aisix-dp.

  6. Return to Data planes and select Refresh. Under Registered data planes, check that the gateway is Healthy and has a recent Last heartbeat.

Registered data planes showing a healthy gateway and its last heartbeat

For certificate validity, other deployment options, and connection troubleshooting, see Connect a Gateway.

Send and Verify a Request​

Use the same terminal where you exported AISIX_API_KEY.

  1. Set the local gateway URL and check that the proxy is reachable.

    export AISIX_PROXY="http://127.0.0.1:3000"
    curl -fsS "$AISIX_PROXY/livez"

    Expect ok. If the connection is refused, run docker logs aisix-dp to check whether the gateway is still waiting for its first configuration. See Startup and the First Configuration.

  2. List the models available to the caller key.

    curl -fsS "$AISIX_PROXY/v1/models" \
    -H "Authorization: Bearer ${AISIX_API_KEY}"

    Check that gpt-4o-mini appears in the data array. If it is missing, wait a few seconds for the configuration to reach the gateway and repeat this check.

  3. Send a chat request after the model appears.

    curl -sS -X POST "$AISIX_PROXY/v1/chat/completions" \
    -H "Authorization: Bearer ${AISIX_API_KEY}" \
    -H "Content-Type: application/json" \
    -d '{
    "model": "gpt-4o-mini",
    "messages": [
    {"role": "user", "content": "Say hello from AISIX Enterprise."}
    ]
    }'

    Expect an OpenAI-compatible response with an assistant message in choices[0].message.

In the dashboard, open Logs in prod to inspect the request. Open Usage in the organization navigation to see its usage data.

Clean Up​

If you plan to continue to another AISIX Enterprise guide, leave the stack and gateway running and skip cleanup. Otherwise, remove the caller key, model, and provider key with either workflow.

In the dashboard, open prod and revoke quickstart-caller in API keys. Then delete gpt-4o-mini from Models and OpenAI from Provider keys.

If you used the Admin API, delete the resources in the same order:

curl -fsS -X DELETE \
"$AISIX_CP/environments/$ENV_ID/api_keys/$API_KEY_ID" \
-H "Authorization: Bearer ${AISIX_TOKEN}" | jq

curl -fsS -X DELETE \
"$AISIX_CP/environments/$ENV_ID/models/$MODEL_ID" \
-H "Authorization: Bearer ${AISIX_TOKEN}" | jq

curl -fsS -X DELETE \
"$AISIX_CP/provider_keys/$PROVIDER_KEY_ID" \
-H "Authorization: Bearer ${AISIX_TOKEN}" | jq

If you created an admin token, revoke it in the dashboard when you finish the API cleanup. Then remove the gateway container:

docker rm -f aisix-dp

Before stopping the control plane, delete the prod environment you created so you can recreate it on a later run.

Stop and remove the control-plane containers:

./run.sh down

This preserves the PostgreSQL data volume.

Next Steps​

You have now sent a request through a gateway connected to your local control plane. From here: