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

# API Domain Migration: Use api2.laozhang.ai as the Default Endpoint

> The default LaoZhang API domain is now api2.laozhang.ai because api.laozhang.ai is affected by DNS attacks and pollution. API keys, paths, parameters, and request formats stay unchanged.

* **Published**: July 23, 2026
* **Last verified**: July 23, 2026
* **Current status**: `api2.laozhang.ai` is active and is now the documentation default; `api-vip.laozhang.ai` and `api-cf.laozhang.ai` are available as fallback routes

The previous domain, `api.laozhang.ai`, is affected by DNS attacks and pollution. Users may see DNS resolution failures, connection errors, or request timeouts. If this happens, replace the request host with `https://api2.laozhang.ai`. **Your API key, endpoint path, request parameters, and integration method do not change.**

<Warning>
  If requests fail to resolve, connect, or time out, switch to `api2.laozhang.ai` now. Do not disable HTTPS certificate verification, pin an unknown IP address, or use an untrusted DNS service to bypass the connection problem.
</Warning>

## Which API domain should I use?

| Domain                | Current status                   | Recommended use                                               | Important limit                                                                    |
| --------------------- | -------------------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| `api2.laozhang.ai`    | Active and documentation default | Affected networks and general global traffic                  | Preferred for new integrations and migrations                                      |
| `api-cf.laozhang.ai`  | Active behind Cloudflare         | Global fallback and normal synchronous requests               | May return 524 if the origin does not respond within the default 120-second window |
| `api-vip.laozhang.ai` | Active direct overseas route     | Europe/US users, non-CDN traffic, and long-running requests   | No acceleration CDN; users in Asia may receive responses more slowly               |
| `api.laozhang.ai`     | Legacy compatibility domain      | Europe/US servers where the legacy route still works normally | Affected by DNS attacks and pollution; resolution or connection may fail           |

## How do I migrate?

Replace only the hostname. Keep the protocol, endpoint path, payload, and API key unchanged.

### OpenAI-compatible API

Before:

```text theme={null}
https://api.laozhang.ai/v1/chat/completions
```

After:

```text theme={null}
https://api2.laozhang.ai/v1/chat/completions
```

Minimal request:

```bash theme={null}
curl https://api2.laozhang.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.6-flash",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
```

### Python SDK

```python theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api2.laozhang.ai/v1",
)
```

### Environment variable

```bash theme={null}
export OPENAI_BASE_URL="https://api2.laozhang.ai/v1"
```

For the Gemini native protocol, image APIs, video APIs, or balance queries, replace the domain in the same way:

```text theme={null}
https://api2.laozhang.ai/v1beta/models/{model}:generateContent
https://api2.laozhang.ai/v1/images/generations
https://api2.laozhang.ai/v1/videos
https://api2.laozhang.ai/api/user/self
```

## The 120-second limit on the Cloudflare route

`api-cf.laozhang.ai` is proxied through Cloudflare. Cloudflare documents a default 120-second `Proxy Read Timeout`. If Cloudflare has connected to the origin but the origin does not respond within that period, the request may receive `524 A timeout occurred`. This is not an API-key error and does not necessarily prove that the upstream task failed.

For image, video, or complex agent requests that may run for a long time, prefer asynchronous tasks, polling, or streaming instead of one synchronous connection with no response data. `api-vip.laozhang.ai` connects directly to a server in Europe or the United States without an acceleration CDN, so Cloudflare's default 120-second proxy read timeout does not apply. Client, origin, or other load-balancer timeouts may still apply.

## Frequently asked questions

### Do I need to create a new API key after changing the domain?

No. Your existing API key, model ID, endpoint path, request parameters, and billing account remain unchanged. Replace only the hostname in the request URL.

### Must Europe/US servers migrate immediately?

No. Calls from Europe/US servers are theoretically unaffected and may continue using the legacy domain while it works normally. New projects and documentation now use `api2.laozhang.ai`. If the legacy domain also fails from a Europe/US server, switch to `api2.laozhang.ai` or `api-cf.laozhang.ai`.

### Can I access the console through `api2.laozhang.ai`?

Yes. Console, model-pricing, and account pages now use `api2.laozhang.ai`; your account and sign-in details do not change.

### Is 120 seconds a fixed total duration for every `api-cf.laozhang.ai` request?

More precisely, it is Cloudflare's default read timeout to the origin. After the origin connection is established, Cloudflare may return 524 if it receives no response within about 120 seconds. Client, origin, load-balancer, and endpoint timeouts may also apply.

### Which domain should I use for long-running requests?

Prefer asynchronous tasks, polling, or streaming. Europe/US users, or synchronous requests that need to avoid Cloudflare's 120-second proxy read timeout, can use `api-vip.laozhang.ai`. Users in Asia should normally prefer `api2.laozhang.ai`, because the direct overseas route has no CDN acceleration and may respond more slowly.

### Who should use `api-vip.laozhang.ai`?

The route is intended for servers in Europe or the United States, users who want a direct overseas origin connection, and requests that need to avoid Cloudflare's proxy read timeout. It has no acceleration CDN, so network round trips and response delivery are usually slower from Asia; `api2.laozhang.ai` remains the preferred route for Asia and general use.

## Related resources

* [LaoZhang API quickstart](/en/getting-started)
* [OpenAI SDK integration guide](/en/api-capabilities/openai-sdk)
* [Model information and selection guide](/en/api-capabilities/model-info)
* [Cloudflare: Error 524](https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-524/)
* [Cloudflare: Connection limits](https://developers.cloudflare.com/fundamentals/reference/connection-limits/)
* [Open the LaoZhang API console](https://api2.laozhang.ai/account/profile)
