---
title: "Get started with DWS AI Gateway API"
canonical_url: "https://www.nutrient.io/guides/dws-ai-gateway/getting-started/"
md_url: "https://www.nutrient.io/guides/dws-ai-gateway/getting-started.md"
last_updated: "2026-10-14T00:00:00.000Z"
description: "Enable AI Gateway, get an API key, and send a Responses request using curl, the OpenAI JavaScript SDK, or Python."
---

# Get started with DWS AI Gateway API

Send your first text request to `https://api.nutrient.io/ai/v1/responses` using a DWS API key enabled for AI Gateway.

## 1. Set up access

Create an account in the [Nutrient dashboard](https://dashboard.nutrient.io/sign_up/?product=ai-gateway) or sign in to your existing DWS account. Open the [AI Gateway dashboard](https://dashboard.nutrient.io/ai-gateway/). If AI Gateway is unavailable for your organization, [contact Nutrient](https://www.nutrient.io/contact-sales/?lob=dws-api) to enable access.

Open [API keys](https://dashboard.nutrient.io/ai-gateway/api_keys/) and create or copy a key with access to AI Gateway. A key restricted to another product does not grant AI Gateway access.

Live keys start with `pdf_live_`. Test keys start with `pdf_test_`, accept text only, and do not consume your included usage.

Keep keys on your server. Do not embed them in browser or mobile applications. See [security and privacy](https://www.nutrient.io/guides/dws-ai-gateway/security-and-privacy.md) for data-handling details.

## 2. Set your API key

Set an environment variable in the terminal where you run the examples. Replace the placeholder with your key:

```shell

export NUTRIENT_API_KEY="your_api_key_goes_here"

```

## 3. Send a request

The following examples use the `nutrient-s` model with the Responses API. The prompt includes the contract text to summarize.

### curl

```shell

curl --fail-with-body https://api.nutrient.io/ai/v1/responses \
  -H "Authorization: Bearer $NUTRIENT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nutrient-s",
    "input": "Summarize this obligation: The supplier must deliver the report by 30 November and notify the customer of delays within two business days."
  }'

```

### JavaScript

Install the OpenAI SDK with `npm install openai`, then save this example as `gateway.mjs`. Run it with `node gateway.mjs` in the same terminal.

```javascript

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.NUTRIENT_API_KEY,
  baseURL: "https://api.nutrient.io/ai/v1",
});

try {
  const response = await client.responses.create({
    model: "nutrient-s",
    input: "Summarize this obligation: The supplier must deliver the report by 30 November and notify the customer of delays within two business days.",
  });
  console.log(response.output_text);
} catch (error) {
  console.error("AI Gateway request failed:", error.status, error.message);
  process.exitCode = 1;
}

```

### Python

Install the OpenAI SDK with `python -m pip install openai`, then save this example as `gateway.py`. Run it with `python gateway.py` in the same terminal.

```python

import os
from openai import OpenAI, APIError

client = OpenAI(
    api_key=os.environ["NUTRIENT_API_KEY"],
    base_url="https://api.nutrient.io/ai/v1",
)

try:
    response = client.responses.create(
        model="nutrient-s",
        input="Summarize this obligation: The supplier must deliver the report by 30 November and notify the customer of delays within two business days.",
    )
    print(response.output_text)
except APIError as error:
    print(f"AI Gateway request failed: {error}")
    raise

```

## 4. Read the result

Read the generated text from the OpenAI SDK’s `output_text` helper. See the [API reference](https://www.nutrient.io/api/reference/ai-gateway/public/) for the full response. Generated wording varies between requests. Review the result before using it in an automated workflow.

If the request fails, use [errors and limits](https://www.nutrient.io/guides/dws-ai-gateway/errors.md) to interpret the status and error code. A `403` can indicate a key without AI Gateway permission; a `404` can indicate unavailable account access or an unknown model.

## Next steps

- [Choose a model and API](https://www.nutrient.io/guides/dws-ai-gateway.md#choose-a-model) — Pick a model, and Responses or Chat Completions.

- [API reference](https://www.nutrient.io/api/reference/ai-gateway/public/) — Request and response schemas, limits, and error codes.

- [Decision API](https://www.nutrient.io/guides/dws-ai-gateway/system-one.md) — Get probabilities for structured decisions.

- [Pricing](https://www.nutrient.io/guides/dws-ai-gateway/pricing.md) — Estimate token costs and review plan options.
---

## Related pages

- [DWS AI Gateway API](/guides/dws-ai-gateway.md)
- [AI Gateway errors and limits](/guides/dws-ai-gateway/errors.md)
- [AI Gateway pricing](/guides/dws-ai-gateway/pricing.md)
- [AI Gateway security and privacy](/guides/dws-ai-gateway/security-and-privacy.md)
- [Make decisions with the decision API](/guides/dws-ai-gateway/system-one.md)

