Prerequisites

  • An Adaline account
  • Your Adaline API key, project ID and prompt ID

Setup Workspace API key

  • In the sidebar, click Settings → API keys.
  • Click on Create API key.
Open API keys
  • Rename the API key to something meaningful.
  • Click on the generated API key to copy and paste in a secure location. It will not be visible again.
  • Click on Create key.
Create API key

Get Project ID and Prompt ID

  • In the sidebar, select your project.
  • On the top bar, click on Monitor
  • On the top right, click on Copy Project ID.
Get Project ID
  • In the sidebar, select your prompt.
  • On the top bar, click on Monitor
  • On the top right, click on Copy Prompt ID.
Get Prompt ID

Update your SDK configuration

The Proxy base URL follows this pattern:
https://gateway.adaline.ai/v1/{provider}/
from openai import OpenAI

# Before: Direct provider call
# client = OpenAI(api_key="your-openai-key")

# After: Route through Proxy
client = OpenAI(
    api_key="your-openai-key",  # Your actual OpenAI key
    base_url="https://gateway.adaline.ai/v1/openai/"
)

# Add Adaline headers to your requests
headers = {
    "adaline-api-key": "your-adaline-api-key",
    "adaline-project-id": "your-project-id",
    "adaline-prompt-id": "your-prompt-id"
}

# Make your API call as usual
response = client.chat.completions.create(
    model="gpt-4",
    messages=[ { "role": "user", "content": "What is Adaline in AI?" } ],
    extra_headers=headers
)

View your traces and spans

Proxy will automatically calculate status, latency, token usage, cost, etc. for your requests.
  • Navigate to the project’s Monitor tab to view your traces and spans.
Trace Table
  • Navigate to the prompt’s Monitor tab to view your spans.
Span Table Proxy heavily relies on headers to mutate traces and spans created in Adaline. Refer to the Headers Reference for more details. Enhance your telemetry with additional context by adding the following headers:
headers = {
    "adaline-api-key": "your-adaline-api-key",
    "adaline-project-id": "your-project-id",
    "adaline-prompt-id": "your-prompt-id",
    "adaline-trace-name": "user-onboarding-flow",  # Optional: Custom trace name
    "adaline-span-name": "generate-response",  # Optional: Custom span name
    "adaline-trace-session-id": "session-123",  # Optional: Session tracking
    "adaline-span-attributes": '{"user_type": "premium", "feature": "chat"}',  # Optional: Span metadata
    "adaline-span-tags": '["production-v1.3"]',  # Optional: Span tags
}