# Network and error codes

## The browser opens 2api.dev, but the terminal can't connect

Errors look like `ConnectionRefused`, `ECONNRESET` or `Unable to connect to API`. A terminal doesn't necessarily use the system proxy, or its proxy variables point at a port that has been closed.

- If you can reach 2api.dev directly, make it bypass the proxy: add a direct rule for `2api.dev` in your proxy software, or set `NO_PROXY=localhost,127.0.0.1,2api.dev`.
- If you must use a proxy, set `HTTPS_PROXY` and `HTTP_PROXY` in the same terminal. For Claude Code, you can put them in `env` in `settings.json`.
- Confirm by running the [self-check command](https://docs.2api.dev/en/faq/#do-this-first) with curl in the **same terminal**.
- When you use magpie or CC Switch routing mode, your proxy software must not intercept `127.0.0.1`.

## 429 Too Many Requests

Check which kind it is from the message in the error:

| Error message | Meaning | What to do |
| --- | --- | --- |
| `Concurrency limit exceeded` | Too many requests at the same time (many sessions or sub-agents open) | Open fewer sessions and retry later |
| `requests-per-minute limit exceeded` | Too many requests per minute | Wait a while and retry |
| `All available accounts are currently rate-limited` | The upstream is rate-limiting for now | Retry later, or switch to another model |
| `daily usage limit exceeded` | The monthly card's quota for the day is used up | Wait until 00:00 the next day, or switch to balance |
| `api key 日限额已用完` (key daily limit used up), `额度已用完` (quota used up) | A limit you set on the key yourself | Change the limit in API Keys (API 密钥) |

## 503 No available accounts, or 529 Overloaded

The upstream is temporarily too busy for this model. Changing client settings won't fix it. Wait a few minutes and try again, or switch to another model with `/model`. If it lasts a long time, contact support.

## 504 or request timeout

An occasional timeout can simply be retried. If a large request returns 504 every time, it is a server-side timeout. Note the time and contact support. In Claude Code you can raise `API_TIMEOUT_MS` to `900000`. In Codex you can raise `stream_idle_timeout_ms`.