Skip to content

Authentication

nxusKit supports multiple authentication methods depending on the provider. This matrix shows which methods are available for each provider and how to configure them.

ProviderAuth RequiredAPI KeyOAuthEnv VariableDashboard
OpenAI / GPTYesYesOPENAI_API_KEYplatform.openai.com/api-keys
Anthropic / ClaudeYesYesANTHROPIC_API_KEYconsole.anthropic.com/settings/keys
GroqYesYesGROQ_API_KEYconsole.groq.com/keys
Mistral AIYesYesMISTRAL_API_KEYconsole.mistral.ai/api-keys
Fireworks AIYesYesFIREWORKS_API_KEYfireworks.ai/account/api-keys
Together AIYesYesTOGETHER_API_KEYapi.together.ai/settings/api-keys
OpenRouterYesYesOPENROUTER_API_KEYopenrouter.ai/settings/keys
PerplexityYesYesPERPLEXITY_API_KEYperplexity.ai/settings/api
OllamaNoOLLAMA_HOST
LM StudioNoLMSTUDIO_HOST

Legend: Yes = supported, — = not applicable

The standard authentication method for cloud providers. Obtain a key from the provider’s dashboard, then configure via any of these methods:

Environment variable (recommended for development and CI/CD):

Terminal window
export OPENAI_API_KEY="sk-..."

Credential store (recommended for persistent local development):

Terminal window
nxuskit-cli provider set openai sk-...

This stores the key in the OS credential store (macOS Keychain, Windows Credential Manager, or Linux secret-service). Falls back to a file-based store with 0600 permissions if no system store is available.

Explicit parameter (for programmatic use):

provider = Provider.create("openai", api_key="sk-...")

OAuth support is available for providers that require browser-based authorization. The current cloud providers use API keys, so most projects will not need this flow. When a provider requires OAuth, use:

Terminal window
# Start OAuth login
nxuskit-cli provider login <provider>
# Check auth status
nxuskit-cli provider status

The OAuth flow uses:

  • PKCE (SHA-256 code challenge) for security
  • Localhost callback on an ephemeral port
  • State/CSRF validation
  • Automatic browser launch

Local providers (Ollama, LM Studio) run on the local machine and do not require authentication. The host env variable is optional and defaults to localhost on the provider’s default port.

When multiple credential sources exist, the SDK uses this precedence order:

PrioritySourceExample
1 (highest)Explicit API parameterProvider.create("openai", api_key="sk-...")
2Environment variableOPENAI_API_KEY=sk-...
3 (lowest)OS credential storeVia nxuskit-cli provider set

View authentication status for all providers:

Terminal window
nxuskit-cli provider status

For a specific provider:

Terminal window
nxuskit-cli provider status openai

JSON output (for scripts):

Terminal window
nxuskit-cli provider status --json

Example output:

Provider Status Source Auth Methods
─────────────────────────────────────────────────────────────
openai Authenticated env api_key
claude Authenticated store api_key
groq Not authenticated — api_key
ollama Not required — —
lm-studio Not required — —
Terminal window
# Store a credential
nxuskit-cli provider set <provider> <api-key>
# Remove a stored credential
nxuskit-cli provider remove <provider>
# View status
nxuskit-cli provider status [provider]
use nxuskit::{auth_status, auth_set_credential, auth_resolve};
// Check status
let status = auth_status("openai")?;
// Store credential
auth_set_credential("openai", "sk-...")?;
// Resolve credential (follows precedence chain)
let resolution = auth_resolve("openai", None)?;
import "github.com/nxus-SYSTEMS/nxuskit-go"
// Check status
status, err := nxuskit.AuthStatus("openai")
// Store credential
err = nxuskit.AuthSetCredential("openai", "sk-...")
// Resolve credential
resolution, err := nxuskit.AuthResolve("openai", "")
from nxuskit import auth_status, auth_set_credential, auth_resolve
# Check status
status = auth_status("openai")
# Store credential
auth_set_credential("openai", "sk-...")
# Resolve credential
resolution = auth_resolve("openai")