Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.axioniclabs.ai/llms.txt

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

API Keys

API keys authenticate inference requests and SDK calls to the Axionic backend. Format: ax_ followed by 48 lowercase hex characters (e.g., ax_a3f9...). Get a key from Spectra Settings → API Keys or via the CLI:
mechanex create-api-key
Set the key in code:
api_key
string
required
Your Axionic API key. Must start with ax_.
persist
boolean
default:"false"
If true, saves the key to ~/.mechanex/config.json so it is auto-loaded on every future SDK init and CLI start.
import mechanex as mx

mx.set_key("ax_your_key_here", persist=True)
persist=True writes the key to ~/.mechanex/config.json. Omit or pass False to keep the key in memory only for the current process.

Config File

The SDK and CLI auto-load credentials from ~/.mechanex/config.json at startup. Fields stored in the config file:
FieldDescription
api_keyYour API key (ax_...)
access_tokenJWT access token (set by mx.login())
refresh_tokenJWT refresh token (set by mx.login())
You can edit this file directly, but prefer using mx.set_key(persist=True) or mx.login() to populate it correctly.

JWT Authentication

Some operations — billing, account management, and organization access — require a JWT rather than an API key. Obtain one by logging in:
email
string
required
Your Axionic account email address.
password
string
required
Your account password.
mx.login(email="you@example.com", password="your_password")
Tokens are stored automatically in the config file. When a JWT expires, the SDK silently refreshes it via POST /auth/refresh and retries the original request — no manual intervention needed. For key creation, rotation, and account management (balance, user info), use the CLI.