# Endpoints

> Source: https://docs.xycai.us/endpoints.html  
> XycAi Developer Docs · Markdown edition for AI / LLM readers. Site index: https://docs.xycai.us/llms.txt

Every endpoint fronts the same service, account and keys — only the network route differs. **Use the primary endpoint from mainland China**; switch to another one from overseas or whenever the primary misbehaves. Nothing else in your configuration changes.

## 1. Endpoint list

| Endpoint | Role | Route | Recommendation |
|---|---|---|---|
| `https://cn.chatapi.app` | Primary · China direct | CN2 + 163 + 163 | **Default**; all docs and client guides use it |
| `https://jp.chatapi.app` | Global · Global CDN | CN2 + 9929 + CMIN2 | Best from overseas, Hong Kong, Taiwan and cross-border teams |
| `https://apicdn.xycai.us` | Backup | Cloudflare proxied | Switch here if the primary is unreachable |
| `https://apicdn.xyc.ai` | Overseas direct | Direct | For servers outside China; needs a proxy from the mainland |

> **Old address still works**
>
> `https://apicdn.xyc.ai` from earlier docs and client configs keeps working — no forced migration. DNS for `xyc.ai` is unreliable inside mainland China, so users there should move to `https://cn.chatapi.app`.

## 2. Base URL per protocol

Different SDKs expect the base URL in different shapes. Pick the endpoint and protocol, then copy:

| Where | Value |
|---|---|
| OpenAI SDK `base_url` / `OPENAI_BASE_URL` | `https://cn.chatapi.app/v1` |
| Anthropic SDK / Claude Code `ANTHROPIC_BASE_URL` | `https://cn.chatapi.app` |
| Codex (Responses API) `base_url` | `https://cn.chatapi.app/v1` |
| Gemini SDK `http_options.base_url` / `GOOGLE_GEMINI_BASE_URL` | `https://cn.chatapi.app` |
| Gemini native full path | `https://cn.chatapi.app/v1beta/models/{model}:generateContent` |
| curl / any HTTP client | `https://cn.chatapi.app/v1/chat/completions` |

## 3. Paths at a glance

| Capability | Method & path | Docs |
|---|---|---|
| Chat Completions (all vendors) | `POST /v1/chat/completions` | [Chat Completions](https://docs.xycai.us/chat.html) |
| Responses API (GPT / Codex) | `POST /v1/responses` | [Responses API](https://docs.xycai.us/responses.html) |
| Claude native | `POST /v1/messages` | [Claude Messages](https://docs.xycai.us/messages.html) |
| Gemini native | `POST /v1beta/models/{model}:generateContent` | [Gemini native](https://docs.xycai.us/gemini.html) |
| Image generation / edit | `POST /v1/images/generations` · `POST /v1/images/edits` | [Image generation](https://docs.xycai.us/images.html) |
| Video generation (async) | `POST /v1/video/generations` → `GET /v1/videos/{task_id}` → `GET /v1/videos/{task_id}/content` | [Video generation](https://docs.xycai.us/video.html) |
| Text-to-speech | `POST /v1/audio/speech` | [Text-to-speech](https://docs.xycai.us/speech.html) |
| Embeddings | `POST /v1/embeddings` | [Embeddings](https://docs.xycai.us/embeddings.html) |
| Jev decision model | `POST /v1/decisions` (alias `/v1/systemone`) | [Jev decision model](https://docs.xycai.us/jev.html) |
| Model list | `GET /v1/models` | [Models](https://docs.xycai.us/models.html) |

## 4. Connectivity check

Run this against any endpoint; a JSON model list means both the route and your key work. It also lets you compare latency and pick the fastest endpoint:

```
for h in cn.chatapi.app jp.chatapi.app apicdn.xycai.us apicdn.xyc.ai; do
  curl -s -o /dev/null -w "$h  %{http_code}  %{time_total}s\n" \
    -H "Authorization: Bearer sk-xxxxxxxx" https://$h/v1/models
done
```

PowerShell:

```
Invoke-RestMethod -Uri "https://cn.chatapi.app/v1/models" -Headers @{ Authorization = "Bearer sk-xxxxxxxx" }
```

## 5. Notes

- **Stream long requests** (`stream: true`). A non-streaming call that stays silent for minutes may be cut by idle timeouts on intermediate network gear.
- **WebSocket**: Codex's `wss://…/v1/responses` is supported on every endpoint.
- The console ([www.xycai.us](https://www.xycai.us)) and the API endpoints are different hosts; keys work on all API endpoints alike.
