Skip to content

Authentication

The MLdebugger SDK requires authentication to the API server. This page explains how to obtain and configure authentication credentials.

Obtaining Authentication Credentials

1. Sign Up

Visit app.adansons.ai and create an account.

  1. Enter your email address and password to sign up sign_up

  2. Receive a confirmation email and verify your email address

  3. After logging in, access the tutorial at app.adansons.ai/tutorial (you are automatically redirected on first login). sign_in

2. Generate API Key

Generate an API Key from the tutorial.

URL: https://app.adansons.ai/tutorial

  1. Go to the tutorial page
  2. Click "Generate API Key"
  3. Copy the generated API Key

api_key

Handling API Key

The API Key is confidential information. Do not hard-code it or commit it to public repositories.

Setting Authentication Credentials

Authentication credentials can be configured in the following three ways.

Log in once with the bundled Terminal App, and the SDK (Tracer / Evaluator / DataFilter / Logger) uses the same credentials. No per-code or per-shell setup needed afterwards.

mldebugger login
#  API endpoint [https://api.adansons.ai]:        ← Enter for the default
#  API key (paste — input hidden): ****
#  ✓ Logged in as you@example.com · profile <org> · https://api.adansons.ai

To switch between multiple organizations (API keys), use mldebugger profile add / use. See Terminal App (mldebugger).

Method 2: Environment Variables

Suited to CI, containers, and other environments where interactive login is unavailable. Environment variables take precedence over the active profile.

export MLD_API_ENDPOINT="https://api.adansons.ai"
export MLD_API_KEY="mldbg_*************"
import os

os.environ["MLD_API_ENDPOINT"] = "https://api.adansons.ai"
os.environ["MLD_API_KEY"] = "mldbg_*************"
# .env
MLD_API_ENDPOINT=https://api.adansons.ai
MLD_API_KEY=mldbg_*************
# Load in Python
from dotenv import load_dotenv
load_dotenv()

Method 3: Direct Specification in Arguments

You can also specify directly in arguments when initializing SDK classes.

from ml_debugger.training import ClassificationTracer

tracer = ClassificationTracer(
    model,
    model_name="my_model",
    version_name="v1",
    api_endpoint="https://api.adansons.ai",
    api_key="mldbg_*************",
)

Priority

Authentication credentials are applied in the following priority:

  1. Direct specification in arguments - Highest priority
  2. Environment variables (MLD_API_ENDPOINT / MLD_API_KEY)
  3. Active profile (saved by mldebugger login; endpoint and key are adopted as a pair)
  4. Packaged default settings
# Example: Only api_key specified in argument, endpoint uses environment variable
tracer = ClassificationTracer(
    model,
    model_name="my_model",
    version_name="v1",
    api_key="mldbg_different_key",  # This value is used
    # api_endpoint uses environment variable MLD_API_ENDPOINT
)

Environment Variable List

Environment Variable Description Required
MLD_API_ENDPOINT API server URL No (not needed once logged in)
MLD_API_KEY Authentication API Key No (not needed once logged in)

Note

If you have run mldebugger login, environment variables are unnecessary. When set, they take precedence over the profile.

Troubleshooting

If Authentication Errors Occur

  1. Check connection state: mldebugger whoami shows the current profile, endpoint, and verification status
  2. Verify API Key: Confirm the API Key is correctly copied
  3. Check environment variables: Confirm environment variables are correctly set (they override the profile, so watch out for stale values)
  4. Check network: Confirm the API server is accessible
# Check environment variables
import os
print(f"Endpoint: {os.environ.get('MLD_API_ENDPOINT', 'Not set')}")
print(f"API Key: {os.environ.get('MLD_API_KEY', 'Not set')[:10]}...")

Using in Offline Environments

In environments where API access is not possible, you can use the Tracer.export method to export data.

tracer.export("export_data.zip")

You can request evaluation by sending the exported file to the Adansons team.

Next Steps