---
title: Using Generative APIs
description: This page explains how to use Generative APIs
tags: generative-apis ai-data embeddings-api
dates:
  validation: 2025-09-03
  posted: 2024-08-28
---

## Access

- A valid [API key](/iam/how-to/create-api-keys/) is needed.

## Authentication

All requests to the Scaleway Generative APIs must include an `Authorization` HTTP header with your API key prefixed by `Bearer`.

We recommend exporting your secret key as an environment variable, which you can then pass directly in your curl request as follows. Remember to replace the example value with *your own API secret key*.

```
export SCW_SECRET_KEY=720438f9-fcb9-4ebb-80a7-808ebf15314b
```

Run the following curl request once you have exported your environment variable:

```
curl -X GET \
    -H "Authorization: Bearer ${SCW_SECRET_KEY}" \
    "https://api.scaleway.ai/v1/models"
```

When using the OpenAI Python SDK, the API key is set once during client initialization, and the SDK automatically manages the inclusion of the `Authorization` header in all API requests.
In contrast, when directly integrating with the Scaleway Generative APIs, you are responsible for manually setting the `Authorization` header with the API key for each request to ensure proper authentication.

## Content types

Scaleway Generative APIs accept JSON in request bodies and returns JSON in response bodies.
You will want to send the `Content-Type: application/json` HTTP header in your POST requests.

```
curl --request POST \
     --url https://api.scaleway.ai/v1/chat/completions \
     --header "Authorization: Bearer ${SCW_SECRET_KEY}" \
     --header "Content-Type: application/json" \
     --data '{}'
```

## Permissions

Permissions define the actions a user or an application can perform on Scaleway Generative APIs. They are managed using Scaleway’s [Identity and Access Management](/iam/quickstart/) interface.

[Owner](/iam/concepts/#owner) status or certain [IAM permissions](/iam/concepts/#permission) allow you to perform actions in the intended Organization.

Querying AI models hosted by Scaleway Generative APIs will require any of the following [permission sets](/iam/concepts/#permission-set):

- **GenerativeApisModelAccess**
- **GenerativeApisFullAccess**
- **AllProductsFullAccess**

<Message type="important">
  Due to a product name change, the permission set names `InferenceFullAccess` and `InferenceReadOnly` are also changing. If you are automatically provisioning IAM policies (using Terraform, CLI, or APIs) with permission sets `InferenceFullAccess` and `InferenceReadOnly`, then you should edit your existing scripts and replace these permissions with `GenerativeApisFullAccess` and `GenerativeApisModelAccess`, respectively. 

  For now, both `InferenceFullAccess` and `InferenceReadOnly` will remain available at least until 1 June 2026. If you may be impacted by the permission set name update, you will receive a dedicated communication including the definitive End Of Life date for these permission sets.
</Message>

## Projects

You can scope your Generative APIs consumption to a [Project](/iam/concepts/#project). This is helpful to restrict IAM users’ access to only the Project they are working on, or to isolate your bills between Projects.

1. Find your Project ID in your [Project settings](https://console.scaleway.com/project/settings).
2. Insert your Project ID in the Generative APIs service URL, for example:

```
https://api.scaleway.ai/78e655b5-feb0-417c-bb3f-8c448bd0e8da/v1
```

The Project ID is hidden for the default Project.




