Skip to main content
Version: v2.0

API keys

API keys authenticate your applications against aixplain. One key lets you run and create agents, models, and tools through the SDK, the REST API, or the OpenAI-compatible API.

Manage keys at app.aixplain.com/team/settings?tab=api-keys (Team settings → API keys). Each workspace can hold up to 10 keys.

warning

Keys are workspace-specific and cannot be moved between workspaces. To use a key elsewhere, create a new one in that workspace.


Create a key​

  1. Go to Team settings → API keys and click Create API key.
  2. Give it a descriptive name, for example Production web app.
  3. Optionally set an expiration date; leave it blank for a key that never expires.
  4. Click Create, then copy the key immediately — the full secret is shown only once.

If you lose a key, delete it and create a new one; the secret cannot be retrieved again. Each key row shows its name, creator, created and expiration dates, status, and the last few characters for identification.


Use a key​

aixplain SDK (Python)​

from aixplain import Aixplain

aix = Aixplain(api_key="YOUR_API_KEY")

# Run an agent
agent = aix.Agent.get("agent-id")
print(agent.run(query="What is the weather today?").data.output)

# Run a model
model = aix.Model.get("model-id")
print(model.run(text="Translate to French: Hello").data)

# Create and save a new agent
new_agent = aix.Agent(
name="Support agent",
description="Answers customer questions",
instructions="Be concise and helpful.",
).save()
print(new_agent.id)

REST API​

Pass the key in the x-api-key header (see Integration):

curl -X POST "https://platform-api.aixplain.com/v2/agents/AGENT_ID/run" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "What is the weather today?"}'

OpenAI-compatible API​

For models that support the OpenAI format:

from openai import OpenAI

client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.aixplain.com/v1")

response = client.chat.completions.create(
model="model-id",
messages=[{"role": "user", "content": "Hello!"}],
)

Rate limits​

Standard keys run inference. Admin keys (Owners and Admins only) do not run inference — they set per-model rate and usage limits on LLMs, whether a model is called directly or used inside an agent. Creating, updating, monitoring, and enforcing those limits is covered in Rate limiting.


Security​

  • Never commit a key to version control — use environment variables or a secrets manager (AWS Secrets Manager, Azure Key Vault, HashiCorp Vault, CI/CD secrets).
  • Use a separate key per application, so you can revoke one without affecting the others.
  • Rotate keys periodically and delete keys for retired applications.
  • Never put a key in client-side code (for example, browser JavaScript).

Deleting a key revokes it immediately and cannot be undone — any application still using it will get authentication errors. In a personal workspace only you can delete a key; in a team workspace, Admins and Owners can.


Troubleshooting​

ErrorLikely causeFix
Invalid API keyKey deleted, expired, mistyped, or from another workspaceConfirm the key is active in the correct workspace and copied in full
Rate limit exceededAdmin-key limits, or too many concurrent requestsCheck the key's limits; add exponential backoff; reduce request frequency
Insufficient creditsWorkspace is out of creditsAdd credits (see Credits and billing) and set a low-credit alert