Skip to content

Authentication & Tokens

All endpoints authenticate with a Bearer Token. Include your API token in the HTTP header of every request.

Header format

http
Authorization: Bearer sk-xxxxxxxx

Creating a token

  1. Sign in to the console
  2. Open the Tokens page
  3. Click New Token, give it a name, and configure the options below:
OptionDescription
NameA recognizable label, e.g. production, staging
Quota limitThe maximum quota this token may spend (unlimited if unset)
ExpiryWhen the token automatically becomes invalid (never, if unset)
Model groupRestrict this token to a specific group of models
IP restrictionAllow only specific IPs or subnets to use this token

Token security

Security tips

  • Do not hard-code tokens in front-end code or public repositories
  • Do not commit tokens into configuration files
  • If a token leaks, delete it in the console Tokens page immediately and create a new one

Recommended practice:

bash
# Pass the token via an environment variable
export IDREAME_API_KEY="sk-xxxxxxxx"
python
import os
from openai import OpenAI

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

Token states

StateMeaning
ActiveUsable normally
ExpiredPast the configured expiry time; recreate it
DisabledManually deactivated
Quota exhaustedReached its quota limit; raise the limit or recreate it

Managing multiple tokens

Create a separate token per project or environment so you can:

  • Track API spend per project independently
  • Revoke one project's access without affecting others
  • Set different quota limits for different environments

OpenAI-compatible · Multimodal AI gateway