# Other OpenAI-Compatible Providers

Many public model providers expose an OpenAI-compatible API. AISIX Enterprise and AISIX Cloud can connect to a provider when it accepts bearer-authenticated OpenAI chat-completions requests and appears in the AISIX provider catalog. The open-source AISIX gateway can use any reachable endpoint with the same protocol and authentication shape under an operator-chosen provider label.

When a provider has a dedicated setup listed under [Provider Upstreams](https://docs.api7.ai/ai-gateway/providers/overview.md), follow that page instead. The configuration below is a parameterized template for another public provider; the control-plane path assumes that the provider is in its catalog.

For a private or customer-operated server, use the dedicated [Ollama](https://docs.api7.ai/ai-gateway/providers/ollama.md), [vLLM](https://docs.api7.ai/ai-gateway/providers/vllm.md), or [Bring Your Own Endpoint](https://docs.api7.ai/ai-gateway/providers/bring-your-own-endpoint.md) guide.

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

Before starting, prepare the following:

* One AISIX setup:

  <!-- -->

  * For AISIX Enterprise or AISIX Cloud, an environment with an attached gateway and a write-scoped admin token. For AISIX Enterprise, follow the [AISIX Enterprise getting-started guide](https://docs.api7.ai/ai-gateway/getting-started/aisix-cloud-quickstart.md). To request AISIX Cloud access, [contact API7](https://api7.ai/contact).
  * For the open-source AISIX gateway, prepare either a local AISIX installation or the Docker setup from the [AISIX OSS getting-started guide](https://docs.api7.ai/ai-gateway/getting-started/gateway-quickstart.md). Configure the gateway to load a declarative resources file.

* An API key for an OpenAI-compatible provider. For AISIX Enterprise or AISIX Cloud, the provider must be listed in the AISIX provider catalog. For an unlisted endpoint, follow [Bring Your Own Endpoint](https://docs.api7.ai/ai-gateway/providers/bring-your-own-endpoint.md). The open-source resources workflow does not use the catalog for admission.

* `curl` and `jq`.

## Select Provider Values[​](#select-provider-values "Direct link to Select Provider Values")

For AISIX Enterprise or AISIX Cloud, choose the exact provider ID shown by the AISIX provider catalog. For an open-source resources file, choose a stable provider label, such as the provider's lowercase name. Then copy the API root and model ID from the provider's official API reference:

```
export PROVIDER_ID="YOUR_PROVIDER_ID"

export PROVIDER_API_KEY="YOUR_PROVIDER_API_KEY"

export PROVIDER_API_BASE="https://api.provider.example/v1"

export UPSTREAM_MODEL_ID="publisher/model-id"

export MODEL_ALIAS="provider-model-prod"
```

The address and IDs above are fictional placeholders. Replace every value before running the setup.

## Configure with AISIX Enterprise or AISIX Cloud[​](#configure-with-aisix-enterprise-or-aisix-cloud "Direct link to Configure with AISIX Enterprise or AISIX Cloud")

Export the control-plane connection details:

```
# AISIX_CP is the Admin API base URL; include /api and omit a trailing slash

# The local AISIX Enterprise quickstart uses http://localhost:8080/api

export AISIX_CP="YOUR_AISIX_CONTROL_PLANE_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 provider-backed chat-completions route.

AISIX connects through the `openai` adapter and uses the provider's API root as `api_base`. Give the provider key a descriptive label so operators can identify the upstream later.

### Create a Provider Key[​](#create-a-provider-key "Direct link to Create a Provider Key")

```
PROVIDER_KEY_RESPONSE=$(

  curl -sS -X POST "$AISIX_CP/provider_keys" \

    -H "Authorization: Bearer $AISIX_TOKEN" \

    -H "Content-Type: application/json" \

    --data-binary @- <<EOF

{

  "display_name": "community-provider-prod",

  "provider": "${PROVIDER_ID}",

  "api_key": "${PROVIDER_API_KEY}",

  "api_base": "${PROVIDER_API_BASE}",

  "allowed_environments": ["${ENV_ID}"]

}

EOF

)



PROVIDER_KEY_ID=$(printf '%s' "$PROVIDER_KEY_RESPONSE" | jq -er '.provider_key.id')

echo "$PROVIDER_KEY_ID"
```

`provider` must exactly match an ID in the AISIX catalog. The AISIX Cloud Admin API derives the `openai` adapter and bearer authentication for community catalog providers. Do not send an `adapter` field; that field is accepted only when `provider` is `byo`.

A provider without a dedicated setup page is admitted from the synced public catalog rather than from the gateway's built-in provider list. If the create returns `400 INVALID_REQUEST` naming the catalog, the control plane does not have that provider in its current catalog. Connected deployments sync at start and every 24 hours; packaged AISIX Enterprise deployments use a bundled snapshot by default and do not refresh it. Retry after an online sync, review the [AISIX Enterprise pricing-catalog settings](https://docs.api7.ai/ai-gateway/reference/on-premises-configuration.md#pricing-catalog), or configure the upstream with [Bring Your Own Endpoint](https://docs.api7.ai/ai-gateway/providers/bring-your-own-endpoint.md).

AISIX appends the endpoint path to `api_base`. Include provider-specific prefixes such as `/v1`, `/openai`, or `/openai/v1` when the official endpoint requires them. Setting the root explicitly also avoids depending on the API base cached by the latest catalog sync.

Provider key secrets follow the credential-handling behavior described in [Provider Keys](https://docs.api7.ai/ai-gateway/models/provider-keys.md#credential-handling).

### Create a Model[​](#create-a-model "Direct link to Create a Model")

Map the caller-facing alias to the provider's exact model ID:

```
MODEL_RESPONSE=$(

  curl -sS -X POST "$AISIX_CP/environments/$ENV_ID/models" \

    -H "Authorization: Bearer $AISIX_TOKEN" \

    -H "Content-Type: application/json" \

    --data-binary @- <<EOF

{

  "display_name": "${MODEL_ALIAS}",

  "model_name": "${UPSTREAM_MODEL_ID}",

  "provider_key_id": "${PROVIDER_KEY_ID}"

}

EOF

)



MODEL_ID=$(printf '%s' "$MODEL_RESPONSE" | jq -er '.model.id')

echo "$MODEL_ID"
```

`display_name` is the alias callers send in `model`. `model_name` is sent to the upstream unchanged, so preserve any publisher namespace, casing, punctuation, and version suffix.

To configure cost metadata for budget accounting or usage reports, see [Model Aliases](https://docs.api7.ai/ai-gateway/models/model-aliases.md#cost-metadata).

### Create a Caller API Key[​](#create-a-caller-api-key "Direct link to Create a Caller API Key")

Create a caller key limited to the model resource:

```
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": "community-provider-caller",

      "allowed_models": ["'"${MODEL_ID}"'"]

    }' | jq -er '.plaintext'

)



echo "$AISIX_API_KEY"
```

The plaintext is returned only when the caller key is created. Store it securely.

## Configure with AISIX OSS[​](#configure-with-aisix-oss "Direct link to Configure with AISIX OSS")

Export the upstream credential and choose the caller API key that applications will send to the gateway:

```
export PROVIDER_ID="YOUR_PROVIDER_ID"

export PROVIDER_API_BASE="YOUR_PROVIDER_API_BASE"

export UPSTREAM_MODEL_ID="YOUR_UPSTREAM_MODEL_ID"

export MODEL_ALIAS="YOUR_MODEL_ALIAS"

export PROVIDER_API_KEY="YOUR_PROVIDER_API_KEY"

export CALLER_API_KEY="YOUR_CALLER_API_KEY"

export CALLER_API_KEY_SHA256="$(printf '%s' "$CALLER_API_KEY" | sha256sum | cut -d ' ' -f 1)"
```

The open-source AISIX gateway validates the provider label's shape but does not require it to appear in the control-plane catalog. Use the same label on the provider key and model. The label also identifies the upstream in telemetry and, by convention, in a passthrough route path such as `/passthrough/example-provider/*`.

For a new gateway, use this complete resources file. For an existing gateway, merge the entries into its [current file](https://docs.api7.ai/ai-gateway/reference/resources-file.md#apply-resource-examples-safely), preserving its other resources:

resources.yaml

```
_format_version: "2"



provider_keys:

  - id: f5b164e8-8c3b-4c0f-b732-31c32b090d31

    display_name: "community-provider-prod"

    provider: "${PROVIDER_ID}"

    adapter: "openai"

    api_key: ${PROVIDER_API_KEY}

    api_base: "${PROVIDER_API_BASE}"



models:

  - id: 248781c3-7fb5-48f4-814c-ace0e6ac1b22

    display_name: "${MODEL_ALIAS}"

    provider: "${PROVIDER_ID}"

    model_name: "${UPSTREAM_MODEL_ID}"

    provider_key_id: f5b164e8-8c3b-4c0f-b732-31c32b090d31



api_keys:

  - id: 0554e0e9-a670-43e6-bd99-293b0c707ac1

    display_name: "community-provider-caller"

    key_hash: ${CALLER_API_KEY_SHA256}

    allowed_models:

      - "${MODEL_ALIAS}"
```

If AISIX is installed locally, validate the file before loading it:

```
aisix validate --resources resources.yaml
```

After validation, start the gateway with the referenced environment variables in its process environment. Reload an existing gateway only if those variables are already available to the process; otherwise, restart it with the updated environment.

If you use Docker, adapt the validation and startup commands in the [AISIX OSS getting-started guide](https://docs.api7.ai/ai-gateway/getting-started/gateway-quickstart.md). Mount this `resources.yaml` file and pass every environment variable it references with `-e` in both commands. After the resources load, prepare the shared verification request below:

```
export AISIX_API_KEY="$CALLER_API_KEY"
```

## Verify the Provider Connection[​](#verify-the-provider-connection "Direct link to Verify the Provider Connection")

Export the AISIX gateway origin:

```
# AISIX_PROXY has no trailing slash or endpoint path

# The local quickstarts use http://127.0.0.1:3000

export AISIX_PROXY="YOUR_AISIX_GATEWAY_URL"
```

Send a chat-completions request through the AISIX proxy:

```
curl -sS -X POST "$AISIX_PROXY/v1/chat/completions" \

  -H "Authorization: Bearer $AISIX_API_KEY" \

  -H "Content-Type: application/json" \

  --data-binary @- <<EOF

{

  "model": "${MODEL_ALIAS}",

  "messages": [

    {

      "role": "user",

      "content": "Say hello through the configured provider."

    }

  ]

}

EOF
```

The response should be OpenAI-compatible and should carry the caller-facing alias. Use the provider's request logs or usage page, when available, to confirm that the request reached the intended upstream account and model.

If the gateway returns an upstream authentication error, check the provider key's `api_key`. If it returns an upstream route error, check `api_base` and `UPSTREAM_MODEL_ID`.

## Support Provider-Specific Behavior[​](#support-provider-specific-behavior "Direct link to Support Provider-Specific Behavior")

The provider must accept OpenAI chat-completions requests. A provider with a different request format needs a native [adapter protocol family](https://docs.api7.ai/ai-gateway/providers/adapters.md) or a compatible endpoint.

The `openai` adapter does not make every normalized AISIX endpoint available to every provider label:

* `/v1/completions`, `/v1/embeddings`, `/v1/audio/*`, `/v1/files`, `/v1/batches`, and `/v1/fine_tuning/jobs` can dispatch through this adapter, but they work only when the upstream implements the corresponding OpenAI route and fields.
* `/v1/responses` uses the [Responses bridge](https://docs.api7.ai/ai-gateway/endpoints/responses-api.md) over chat for a community provider label. `/v1/messages` similarly translates the request and response through chat rather than using a provider-native Messages route.
* `/v1/images/generations`, `/v1/rerank`, and `/v1/videos` enforce provider allowlists. They can reject a community provider label even when its upstream exposes a similarly named route.

Configure a [passthrough route](https://docs.api7.ai/ai-gateway/endpoints/provider-passthrough.md) when an application needs a provider-native route or contract; by convention the route claims `/passthrough/<label>` with the provider's API base as its `target_url`, and the caller key must grant the route in its `allowed_routes`. Passthrough does not rewrite the model alias and has different streaming and usage-accounting behavior, so review its limitations before adopting it. See [Provider Compatibility](https://docs.api7.ai/ai-gateway/providers/compatibility.md) for the normalized-route matrix.

AISIX preserves `reasoning_content` and normalizes `reasoning` to that canonical field. If a provider streams reasoning from a different `delta` path, use the [`response.reasoning_field` override](https://docs.api7.ai/ai-gateway/models/provider-keys.md#configure-provider-specific-overrides) on the provider key.

## Next Steps[​](#next-steps "Direct link to Next Steps")

* [Model Aliases](https://docs.api7.ai/ai-gateway/models/model-aliases.md): configure routing, retry behavior, or cost metadata for the alias.
* [Provider Compatibility](https://docs.api7.ai/ai-gateway/providers/compatibility.md): review supported proxy endpoints and provider-specific boundaries.
