Skip to main content

Documentation Index

Fetch the complete documentation index at: https://budecosystem-b7b14df4.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The BudClient supports multiple authentication methods for different deployment scenarios.

Authentication Methods

Most common method for production applications:
from bud import BudClient

# Direct API key
client = BudClient(api_key="your-api-key-here")

# From environment variable
import os
os.environ["BUD_API_KEY"] = "your-api-key-here"
client = BudClient()

2. JWT Token

For server-to-server authentication:
client = BudClient(jwt_token="your-jwt-token")

3. Dapr Token

For services running in Dapr-enabled environments:
client = BudClient(dapr_token="your-dapr-token")

4. CLI Stored Credentials

After logging in with the CLI, credentials are stored locally:
bud auth login
Then use the client without explicit credentials:
# Automatically uses stored CLI credentials
client = BudClient()

5. Custom Base URL

For self-hosted or custom deployments:
client = BudClient(
    api_key="your-api-key",
    base_url="https://your-custom-domain.com"
)

Environment Variables

The SDK recognizes these environment variables:
VariableDescriptionExample
BUD_API_KEYYour API keybud_abc123...
BUD_BASE_URLCustom API endpointhttps://api.example.com
BUD_JWT_TOKENJWT authentication tokeneyJhbGc...
BUD_DAPR_TOKENDapr authentication tokendapr_xyz...

CLI Authentication

Login

Authenticate via CLI:
bud auth login
This will prompt for your credentials and store them securely.

Check Status

Verify your authentication status:
bud auth status

Logout

Remove stored credentials:
bud auth logout

Security Best Practices

Store API keys in environment variables instead of hardcoding them:
import os
client = BudClient(api_key=os.environ["BUD_API_KEY"])
Use python-dotenv for local development:
from dotenv import load_dotenv
load_dotenv()

client = BudClient()  # Reads BUD_API_KEY from .env
Regularly rotate your API keys from the Bud platform dashboard.
Maintain separate API keys for development, staging, and production.

Example: Multi-Environment Setup

import os
from bud import BudClient

def get_client():
    """Get BudClient configured for current environment"""
    env = os.environ.get("ENVIRONMENT", "development")

    if env == "production":
        return BudClient(
            api_key=os.environ["BUD_PROD_API_KEY"],
            base_url="https://gateway.bud.studio"
        )
    elif env == "staging":
        return BudClient(
            api_key=os.environ["BUD_STAGING_API_KEY"],
            base_url="https://staging.bud.studio"
        )
    else:
        return BudClient(
            api_key=os.environ["BUD_DEV_API_KEY"]
        )

# Usage
client = get_client()

Troubleshooting

If you receive authentication errors:
  • Verify your API key is correct
  • Check that the key hasn’t expired
  • Ensure you’re using the correct base URL
  • Try logging in again with bud auth login
If Python can’t find the bud module:
pip show budai-foundry-sdk
pip install --upgrade git+https://github.com/BudEcosystem/BudAIFoundry-SDK