Authentication

Olyx uses two authentication paths with different jobs:

  • API keys authenticate backend services that create traces and run model executions.
  • Dashboard sessions authenticate people who manage projects, keys, billing settings, and team access.

Most application integrations only need API keys. Session endpoints exist for the dashboard and selected control-plane automation, but day-to-day model traffic should go through SDK clients configured with an Olyx API key.


Which Auth Should I Use?

Start with the identity that matches the actor. A service should use an API key; a person should use a session.

flowchart TD START[WHAT IS CALLING OLYX?] SERVICE[BACKEND SERVICE OR WORKER] PERSON[DASHBOARD USER] SDK[USE API KEY WITH SDK] SESSION[USE DASHBOARD SESSION] TRACE[TRACES AND EXECUTIONS] CONTROL[PROJECTS SETTINGS TEAM BILLING] START --> SERVICE START --> PERSON SERVICE --> SDK --> TRACE PERSON --> SESSION --> CONTROL
ScenarioUse
Backend service calling executeAPI key
Worker creating traces or replaysAPI key
CI job running integration checksAPI key with test-project scope
Human using the dashboardSession
Internal admin script managing projectsSession or a dedicated administrative flow, depending on the task

If the code sends prompts or creates traces, use an API key. If the code manages account configuration for a human user, use a session.


API Keys

API keys are bearer tokens for backend systems. A key identifies the customer and, when project-scoped, the project whose model registry, budget settings, trace history, and routing settings apply to the request.

Generate keys in the dashboard and store the full value in a secrets manager. The secret portion is shown once at creation.

Key Format

ak_<key_id>.<secret>

Keys are two-part tokens joined by a dot.

PartPurpose
key_idIdentifies the key in logs and trace attribution. Safe to display in administrative UIs.
secretAuthenticates the request. Treat it like a password and never expose it client-side.

If a key is compromised, revoke that key and rotate the affected service. Keeping one key per service or environment makes that response much smaller.


SDK Configuration

Every SDK reads the API key from configuration and attaches it to requests for you. Prefer environment variables or a secrets manager over hard-coded values.

import Olyx from "@olyx-labs/olyx";

const client = new Olyx({
  apiKey: process.env.OLYX_API_KEY!,
});
import os
import olyx

client = olyx.Olyx(
    api_key=os.environ["OLYX_API_KEY"],
    mock=False,
)
client = Olyx.new(
  api_key: ENV.fetch("OLYX_API_KEY")
)

For local development, use a test project key. For production, use project-scoped keys per service and rotate them on a schedule.


What Keys Enforce

A key is more than a password. It ties requests to a project context, which gives Olyx enough information to apply project settings and attribute usage.

CapabilityWhat it means
Project scopeA project key can only act within the project it belongs to.
Trace attributionExecutions can be traced back to the key that created them.
Spend capsOptional limits can stop runaway usage for a service or environment.
Key statusRevoked or paused keys are rejected before model execution.

Use API Keys for key creation, rotation, spend limits, and project-scoping details.


Dashboard Sessions

Sessions authenticate people using the dashboard. They are established by logging in with email and password. During closed beta, MFA is an email one-time code flow when it is enabled for the account.

sequenceDiagram participant User participant Dashboard participant Olyx participant Email User->>Dashboard: email and password Dashboard->>Olyx: login alt MFA disabled Olyx-->>Dashboard: session cookie else MFA enabled Olyx->>Email: send one-time code Olyx-->>Dashboard: MFA challenge User->>Dashboard: code Dashboard->>Olyx: verify code Olyx-->>Dashboard: session cookie end

Use sessions for dashboard activity: managing projects, inviting team members, changing account settings, or reviewing billing setup. Do not put session cookies into backend workers or model-calling services.


MFA and Email Verification

MFA protects dashboard sessions. When enabled, Olyx sends a short-lived email code during login. The code completes the login challenge and establishes the session.

Email verification is separate. New accounts must verify their email before they can use most dashboard features. If a verification link expires, request a new link from the dashboard.

ControlPurpose
Email verificationConfirms the user owns the email address used for signup.
MFA email codeAdds a second step before a dashboard session is established.
Session revocationSigns out other active browser sessions after sensitive account changes.

This guide focuses on the application integration path. For backend services, API keys are the right credential in every case.


Failure Behavior

Authentication failures stop before model execution. This is important: an unauthenticated request should not be routed to a provider, recorded as a successful trace, or silently retried with a different identity.

FailureExpected outcome
Missing API keySDK/API request is rejected.
Malformed keyRequest is rejected before project lookup.
Revoked keyRequest is rejected and should be fixed by rotating configuration.
Archived projectRequest is rejected for that project context.
Expired sessionDashboard request returns to login.

For SDK applications, treat auth errors as configuration problems. Rotate or replace the key; do not fall back to a provider key outside the governed path unless you have explicitly designed a non-sensitive fail-open path.


Security Practices

Use these defaults during closed beta:

PracticeWhy it matters
Store keys in a secrets managerPrevents source-code leaks and accidental browser exposure.
Use one key per serviceLimits blast radius and makes trace attribution clearer.
Use separate keys per environmentKeeps staging load and failures away from production usage.
Set spend caps on production keysReduces damage from loops, spikes, or misconfigured jobs.
Rotate keys on a scheduleMakes stale credentials less useful if they leak.
Enable MFA for owner/admin usersProtects project, billing, and team management workflows.

Never ship Olyx API keys to browser code or mobile clients. Put AI calls behind your backend, then let the backend call Olyx with a project-scoped key.

Was this page helpful?