# API_TIMEOUT_MS

> It sets how long an API request waits for its reply to start.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** API_TIMEOUT_MS environment variable

## Think of it like

It is like how long you wait for someone to pick up the phone.

## Definition

API_TIMEOUT_MS sets how long each API request waits for its reply to begin. The value is in milliseconds, and the default is 600,000, which is 10 minutes. It does not limit how long a streamed reply runs after that. Set 0 to remove the limit, which needs version 2.1.305 or later.

## Example

Emma's requests go through a slow company proxy and keep timing out. She raises the wait, and they get through.

## Example code

```bash
export API_TIMEOUT_MS=900000
claude
```

Wait up to 15 minutes for a reply to start.

## Why it matters

On a slow network, a short wait turns a working request into an error.

## Common mistake

Raising it to stop long replies being cut. It only covers the wait for the reply to begin.

## Three principles

- **Wait for the start.** Not the whole reply.
- **Default 10 minutes.** 600,000.
- **0 removes it.** 2.1.305 or later.

## Related terms

- [CLAUDE_CODE_MAX_RETRIES](https://learn.benibix.com/term/ai/claude-code-max-retries-variable)
- [ANTHROPIC_BASE_URL](https://learn.benibix.com/term/ai/anthropic-base-url-variable)

---

Source: https://learn.benibix.com/term/ai/api-timeout-ms-variable
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
