Set up your environment

Choose the project your calls belong to, and set up the address and API key your code uses.

Choose a project

Calls belong to a project, and count toward its units and limits. Open the project in the console and copy its ID from Settings.

export PROJECT_ID="your-project-id"

Create an API key

Every request carries an API key as a bearer token. In the console, open API keys, select Create API key, and choose the AI service. For the guides here, choose Call models and View usage and limits.

Copy the key when it is shown, then keep it in your app’s secret settings. See API keys.

export AI_API_KEY="dsk_…"

A missing, unknown, or expired key gets Authentication required. A key without the permission, or not allowed in the project, gets Forbidden.

The address

Send every request to https://ai-api.digitospace.com. Every path starts with /v1/projects/$PROJECT_ID, so the guides keep the project’s address in one variable:

export AI_URL="https://ai-api.digitospace.com/v1/projects/$PROJECT_ID"

Check your set-up by listing the models:

curl "$AI_URL/models" \
  -H "Authorization: Bearer $AI_API_KEY"

A list of models means everything works.

Last updated