# DigitalOcean Gradient AI

[DigitalOcean Gradient AI Serverless Inference](https://docs.digitalocean.com/products/inference/how-to/si-endpoints/) provides hosted access to foundation models without requiring you to operate model-serving infrastructure. AISIX maps the upstream model IDs to stable aliases and controls who can use them.

## 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.

* A Gradient AI model access key or a DigitalOcean personal access token that can call Serverless Inference.

* Access to the selected [DigitalOcean Inference model](https://docs.digitalocean.com/products/inference/details/models/).

* `curl` and `jq`.

## 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"
```

DigitalOcean is a community catalog provider with an OpenAI-compatible inference API. AISIX connects through the `openai` adapter and authenticates upstream requests with a bearer token.

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

```
export DIGITALOCEAN_INFERENCE_KEY="YOUR_MODEL_ACCESS_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": "digitalocean-prod",

      "provider": "digitalocean",

      "api_key": "'"${DIGITALOCEAN_INFERENCE_KEY}"'",

      "api_base": "https://inference.do-ai.run/v1",

      "apis": {

        "responses": {}

      },

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

    }' | jq -er '.provider_key.id'

)



echo "$PROVIDER_KEY_ID"
```

Use `digitalocean` as the catalog provider ID. AISIX derives the `openai` adapter; sending an explicit adapter on a catalog key returns a validation error.

The API base includes `/v1`. AISIX appends the selected endpoint path to this base.

The `apis.responses` declaration sends Responses requests to DigitalOcean's native endpoint on the same API base instead of translating them through Chat Completions.

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

Create an alias for a model currently available from Gradient AI:

```
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": "digitalocean-gpt-oss-prod",

      "model_name": "openai-gpt-oss-120b",

      "provider_key_id": "'"${PROVIDER_KEY_ID}"'"

    }' | jq -er '.model.id'

)



echo "$MODEL_ID"
```

Use the DigitalOcean model ID, not the original publisher repository name. Confirm current availability in the model reference before creating another alias.

### Create a Caller API Key[​](#create-a-caller-api-key "Direct link to 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": "digitalocean-caller",

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

    }' | jq -er '.plaintext'

)



echo "$AISIX_API_KEY"
```

## 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 DIGITALOCEAN_INFERENCE_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)"
```

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: e8430c01-3ac8-4b30-8c68-a891c3697859

    display_name: "digitalocean-prod"

    provider: "digitalocean"

    adapter: "openai"

    api_key: ${DIGITALOCEAN_INFERENCE_KEY}

    api_base: "https://inference.do-ai.run/v1"

    apis:

      responses: {}



models:

  - id: 83c4dbce-c584-4dee-afb9-676f8180341b

    display_name: "digitalocean-gpt-oss-prod"

    provider: "digitalocean"

    model_name: "openai-gpt-oss-120b"

    provider_key_id: e8430c01-3ac8-4b30-8c68-a891c3697859



api_keys:

  - id: f45e078e-5c38-44e2-a278-d330fd60a061

    display_name: "digitalocean-caller"

    key_hash: ${CALLER_API_KEY_SHA256}

    allowed_models:

      - "digitalocean-gpt-oss-prod"
```

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 Responses request through the AISIX proxy:

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

  -H "Authorization: Bearer $AISIX_API_KEY" \

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

  -d '{

    "model": "digitalocean-gpt-oss-prod",

    "input": "Say hello from DigitalOcean Gradient AI."

  }'
```

AISIX forwards `openai-gpt-oss-120b` to DigitalOcean's native Responses endpoint with the configured credential, then restores the AISIX alias in the response.

## Use Native Messages Through Passthrough[​](#use-native-messages-through-passthrough "Direct link to Use Native Messages Through Passthrough")

The provider key above already sends Responses requests to DigitalOcean's native endpoint. DigitalOcean also publishes a native [Messages endpoint](https://docs.digitalocean.com/products/inference/how-to/use-messages-api/) on the same API base. Messages remains translated unless you use the provider-native alternative below:

| AISIX route                              | Upstream behavior                                                                                                                                                            |
| ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/v1/messages` with a DigitalOcean alias | Translates the Anthropic-shaped caller request to DigitalOcean chat completions. It does not call DigitalOcean's native `/v1/messages` route.                                |
| `/passthrough/digitalocean/messages`     | Calls DigitalOcean's native Messages route without declaring the coupled surface. Send a DigitalOcean model ID supported by that endpoint. Count Tokens remains unavailable. |

DigitalOcean accepts the `x-api-key` header that AISIX uses for native Messages, but it does not publish Count Tokens. Keep this integration on passthrough rather than declaring `apis.messages`, which represents both routes as one surface.

The `/passthrough/digitalocean` paths on this page assume a [passthrough route](https://docs.api7.ai/ai-gateway/endpoints/provider-passthrough.md) claiming that prefix with `https://inference.do-ai.run/v1` as its `target_url`; grant the route name on the caller key's `allowed_routes`. The paths omit `/v1` because the route's target already includes it; a duplicated leading `v1` segment is stripped either way. A passthrough route does not rewrite an AISIX alias. For the request shapes that record token usage, see [Envelope Detection and Usage](https://docs.api7.ai/ai-gateway/endpoints/provider-passthrough.md#envelope-detection-and-token-usage).

## Endpoint Coverage[​](#endpoint-coverage "Direct link to Endpoint Coverage")

| Route                                                   | Behavior with a DigitalOcean catalog alias                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/v1/chat/completions`                                  | Supported, including `stream: true`.                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `/v1/responses`                                         | Sent to DigitalOcean's native Responses API because this guide declares `apis.responses`. Without the declaration, AISIX uses the chat-based [Responses bridge](https://docs.api7.ai/ai-gateway/endpoints/responses-api.md).                                                                                                                                                                                                                               |
| `/v1/messages`                                          | Supported through translation to chat completions. `/v1/messages/count_tokens` is unavailable because the configured provider key does not declare a native Messages surface.                                                                                                                                                                                                                                                                              |
| `/v1/embeddings`                                        | Supported when the alias targets a DigitalOcean embedding model, such as `qwen3-embedding-0.6b`.                                                                                                                                                                                                                                                                                                                                                           |
| `/v1/audio/speech`                                      | The request reaches DigitalOcean when the alias targets a text-to-speech model such as `qwen3-tts-voicedesign`, but the response is not OpenAI-compatible end to end. DigitalOcean wraps base64-encoded audio in a JSON data envelope, and AISIX relays that body without decoding it into binary audio. Use `/passthrough/digitalocean/audio/speech` and decode `data[0].b64_json` when the application supports DigitalOcean's native response contract. |
| `/v1/audio/transcriptions` and `/v1/audio/translations` | Not available. DigitalOcean does not publish these routes.                                                                                                                                                                                                                                                                                                                                                                                                 |
| `/v1/images/generations`                                | Rejected because the normalized AISIX route accepts only models whose provider is `openai` or whose provider key uses the `azure-openai` adapter (see [Provider Requirement](https://docs.api7.ai/ai-gateway/endpoints/image-generation.md#provider-requirement)). Call the native route through `/passthrough/digitalocean/images/generations` with a compatible DigitalOcean model ID.                                                                   |
| `/v1/videos`                                            | Not implemented for the `digitalocean` provider. Submit a DigitalOcean-native video job through `/passthrough/digitalocean/videos`, poll it through `/passthrough/digitalocean/video/generations/{job_id}`, and optionally download the completed MP4 through `/passthrough/digitalocean/videos/{video_id}/content`.                                                                                                                                       |
| `/v1/rerank`                                            | Rejected because the normalized AISIX route accepts only the `openai`, `cohere`, and `jina` provider values.                                                                                                                                                                                                                                                                                                                                               |
| `/passthrough/digitalocean/async-invoke`                | Calls DigitalOcean's asynchronous endpoint for supported image, audio, and text-to-speech models. Use the provider-native request format.                                                                                                                                                                                                                                                                                                                  |
| `/passthrough/digitalocean/models`                      | Lists the model IDs accessible to the configured DigitalOcean credential.                                                                                                                                                                                                                                                                                                                                                                                  |

See [Provider Compatibility](https://docs.api7.ai/ai-gateway/providers/compatibility.md) for the gateway-wide endpoint matrix.

## Troubleshooting[​](#troubleshooting "Direct link to Troubleshooting")

| Symptom                             | Check                                                                                                                                                                            |
| ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Upstream `401` or `403`             | Confirm the credential has inference access. For a model access key, verify its model scope and any VPC restriction; VPC-restricted callers must use the VPC-local DNS resolver. |
| Upstream `404`                      | Keep `/v1` in `api_base` and verify the DigitalOcean model ID.                                                                                                                   |
| Model not found                     | Query DigitalOcean `GET /v1/models` with the same upstream credential and confirm that the model access key includes the selected model.                                         |
| Provider key creation returns `400` | Use `provider: "digitalocean"` without `adapter`.                                                                                                                                |

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

You have now connected AISIX to DigitalOcean Gradient AI and verified the model alias. Continue with these guides:

* [Model Aliases](https://docs.api7.ai/ai-gateway/models/model-aliases.md): configure routing, retry behavior, or cost metadata for the alias.
* [API Key and Model Rate Limits](https://docs.api7.ai/ai-gateway/traffic-controls/rate-limits.md): configure gateway-side request and token limits.
* [Routing and Failover](https://docs.api7.ai/ai-gateway/routing/routing-and-failover.md): fail over between DigitalOcean and another provider.
* [Provider Compatibility](https://docs.api7.ai/ai-gateway/providers/compatibility.md): review supported proxy endpoints and provider-specific boundaries.
