Skip to content
API Reference

API Quickstart

Version: unreleased · Docs: 3c6ab9f2Download Markdown

Make your first authenticated request to Redbelt by listing the models available to your API key. This guide uses Python’s standard library.

You need a Redbelt account, an organization with API access, and Python 3.10 or later. Creating a key requires permission to edit your organization’s admin settings. Ask your administrator for access if Developer or Create key is unavailable.

  1. Sign in to Redbelt and open Settings.
  2. Select Developer under Admin.
  3. In API keys, click Create key.
  4. Choose Service account for an integration identity, or You to make requests as your user. Enter a name you will recognize later.
  5. For a service account, review Auto share resources with creator. This shares resources created by that key with you; it does not grant the service account access to all your existing private resources.
  6. Click Create secret key. If prompted, use Sign in again and repeat the creation step.
  7. In Save your key, click Copy, store it securely, and click Done. The full key is displayed only once.

See Create and manage API keys for ownership and revocation details.

Current Create API Key form, showing ownership, name, and resource sharing options.

Set REDBELT_API_KEY in the environment where Python will run. In a terminal, this reads the value without displaying it or putting it in a literal shell command:

Terminal window
read -rs REDBELT_API_KEY
export REDBELT_API_KEY

Paste your key and press Enter. Keep it out of source files and browser code. For a self-hosted deployment, also set REDBELT_API_URL to its API base URL, including the /api path.

Save this as list_models.py:

"""List models available to the API key identity."""

import json
import os
from urllib.request import Request, urlopen

api_url = os.environ.get("REDBELT_API_URL", "https://redbelt.ai/api").rstrip("/")
request = Request(
    f"{api_url}/v1/models",
    headers={"Authorization": f"Bearer {os.environ['REDBELT_API_KEY']}"},
)
with urlopen(request, timeout=30) as response:
    models = json.load(response)
print(json.dumps(models, indent=2))

Run it:

Terminal window
python3 list_models.py

A successful request returns HTTP 200 and a JSON array. The entries depend on your organization’s configured providers and your access. An empty array is a valid response; it does not prove a model provider is configured.

  • 401: check that the key is present, belongs to this deployment, and has not been revoked.
  • 403: confirm the API key identity has the required organization access.
  • A connection or hostname error: check the API base URL and your network.
  • Missing models: ask your administrator to review model/provider configuration.

Next, make a direct AI request, run an agent, or run a workflow.