Developers / Docs / Authentication

Authentication

Every inference request carries your API key as a bearer token. The same key works for the OpenAI- and the Anthropic-compatible API.

API keys

Your ARK Cloud key is on the dashboard of the ARK Cloud portal, where you sign in with Google. Treat it like a password: keep it in an environment variable or a secret store, never in client-side code or a repository.

Send the key as a bearer token

ARK reads one header, Authorization: Bearer <key>, on both APIs.

Header
Authorization: Bearer $ARK_API_KEY

The OpenAI SDKs send this header from api_key. The Anthropic SDKs send their key in an x-api-key header by default, which ARK does not read, so pass the key as auth_token instead:

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.ark-labs.cloud/api/v1",
    api_key=os.environ["ARK_API_KEY"],     # sent as Authorization: Bearer
)

Routes without a key

The model listings, GET /api/v1/models and GET /api/anthropic/v1/models, need no key, so tools can discover the available models before they authenticate.

Authentication errors

StatusBodyMeaning
401{"detail": "Unauthorized"}No Authorization header, an empty token, or a scheme other than Bearer.
401{"detail": "Invalid API Key"}The key is not recognised. Copy it again from the dashboard.
402error envelopeYour credit balance is used up. Buy credits on the portal.

Authentication errors use a plain {"detail": …} body on both APIs; all other errors use the OpenAI or Anthropic error envelope. See Errors.

Self-hosted deployments

An ARK Core or ARK Tailored deployment uses the identity provider you connect it to. The header stays the same; your administrator issues the keys.