> ## Documentation Index
> Fetch the complete documentation index at: https://docs.a2agent.me/llms.txt
> Use this file to discover all available pages before exploring further.

# A2Agent API Overview: OpenAI-Compatible LLM Gateway

> A2Agent is an OpenAI-compatible API gateway for Chinese LLMs. Point any OpenAI or Anthropic client at https://api.a2agent.me/v1 to get started.

A2Agent exposes an OpenAI-compatible REST API that works with any client library supporting a custom base URL — including the OpenAI SDK, Anthropic SDK, LangChain, or a raw HTTP client — so you can switch to A2Agent without changing a single line of your existing application code.

## Base URL

All requests are routed through a single base URL:

```text theme={null}
https://api.a2agent.me
```

Every endpoint lives under the `/v1/` path prefix. When configuring an SDK, point `base_url` at `https://api.a2agent.me/v1` (OpenAI-style) or set `ANTHROPIC_BASE_URL` to `https://api.a2agent.me` (Anthropic-style). See the [Compatibility](#compatibility) section below for details.

## Compatibility

A2Agent supports both the OpenAI and Anthropic request formats. Choose the one that matches your existing setup.

### OpenAI format

Set `base_url` in the SDK constructor and pass your A2Agent key as `api_key`. No other changes are required.

```python title="OpenAI SDK — set base URL and key" theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_A2AGENT_KEY",
    base_url="https://api.a2agent.me/v1"
)

response = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[{"role": "user", "content": "Hello"}]
)
print(response.choices[0].message.content)
```

### Anthropic format

Set the `ANTHROPIC_BASE_URL` and `ANTHROPIC_AUTH_TOKEN` environment variables. The Anthropic SDK will automatically route all requests through A2Agent.

```python title="Anthropic SDK — set environment variables" theme={null}
import anthropic
import os

os.environ["ANTHROPIC_BASE_URL"] = "https://api.a2agent.me"
os.environ["ANTHROPIC_AUTH_TOKEN"] = "YOUR_A2AGENT_KEY"

client = anthropic.Anthropic()

message = client.messages.create(
    model="glm-5",
    max_tokens=256,
    messages=[{"role": "user", "content": "Hello"}]
)
print(message.content[0].text)
```

## Available Endpoints

| Method | Endpoint               | Description              |
| ------ | ---------------------- | ------------------------ |
| `POST` | `/v1/chat/completions` | Generate a chat response |
| `GET`  | `/v1/models`           | List available models    |

## Rate Limits

If you exceed your request rate, the API returns a `429 Too Many Requests` response. Build exponential back-off into your retry logic to handle these gracefully. To review your current limits or upgrade your plan, visit your [A2Agent dashboard](https://a2agent.me/login).

<Note>
  Before making your first request, you'll need an API key. See [Authentication](/api-reference/authentication) for instructions on creating and using your key.
</Note>
