Skip to main content
Every request to the A2Agent API must be authenticated with an API key. Keys are created in the console, scoped to your account, and billed against your prepaid balance. You can create multiple keys — for example, one per project or environment — and revoke any of them independently at any time.

Creating an API Key

1

Log In

Sign in to your account at https://a2agent.me/login.
2

Navigate to API Keys

In the console sidebar, click API Keys to open the key management page.
3

Create a New Key

Click Create Key. Optionally enter a descriptive label (for example, production or dev-laptop) to help you identify the key later.
4

Copy the Key Value

The full key is displayed exactly once immediately after creation. Copy it to a secure location such as a password manager or environment variable file. You will not be able to retrieve the full value again after closing this dialog.
5

Note the Base URL

Your base URL is the same for all keys and all models:
https://api.a2agent.me
Save this alongside your key so you can configure clients in one go.

Using Your API Key

Pass your API key in the Authorization header as a Bearer token on every request.
curl https://api.a2agent.me/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-chat",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

OpenAI-Compatible Clients

If you use the OpenAI Python or Node.js SDK, set the base_url (or baseURL) and api_key (or apiKey) constructor arguments, or export the corresponding environment variables:
export OPENAI_API_KEY="YOUR_API_KEY"
export OPENAI_BASE_URL="https://api.a2agent.me/v1"
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.a2agent.me/v1",
)
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "YOUR_API_KEY",
  baseURL: "https://api.a2agent.me/v1",
});

Anthropic-Compatible Clients

If you use an Anthropic-compatible client — such as Claude Code or any tool that reads ANTHROPIC_AUTH_TOKEN — your A2Agent key works there too. Set the following environment variables:
export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
export ANTHROPIC_BASE_URL="https://api.a2agent.me"
Most OpenAI SDK clients accept an OPENAI_API_KEY environment variable and a OPENAI_BASE_URL (or base_url constructor argument). Set both to your A2Agent credentials and no other code changes are needed.

Copying Connection Info

On the API Keys page, each row in the key list has a Copy Connection Info button. Clicking it copies your key name, key value, and base URL together in a single formatted block — handy when configuring AI coding clients or sharing setup instructions with a teammate. You never need to hunt for the base URL separately.

Rotating and Revoking Keys

You can delete any API key from the API Keys page at any time. Deletion is immediate — any request using that key will return a 401 Unauthorized error after deletion. To rotate a key, create a new one first, update your clients, and then delete the old key once traffic has migrated. There is no automatic expiry on keys; they remain valid until you delete them.
Never share your API key publicly or commit it to source control. If a key is exposed, delete it immediately from the API Keys page and create a replacement. All charges incurred before deletion are your responsibility.

Authentication Errors

HTTP StatusMeaningCommon Cause
401 UnauthorizedThe request could not be authenticated.Missing, malformed, or deleted API key. Verify the Authorization: Bearer … header is present and the key value is correct.
403 ForbiddenThe request was authenticated but not authorized.Your account has been suspended or your balance has reached zero. Check your balance on the Billing page or contact support.