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

# Timeouts

`start_within` bounds when your request starts, not how long the response takes. We hold the HTTP response open until a tier commits, so your client has to wait out your window plus the answer.

The OpenAI and Anthropic SDKs both allow 10 minutes by default, which matches the longest duration we accept. Raise that setting when a long window and a slow answer could add up past it.

<CodeGroup>
  ```python Python (openai SDK) theme={null}
  client = OpenAI(
      base_url="https://api.flexinference.com/v1",
      api_key="flex_live_...",
      timeout=900,  # seconds, longer than your start_within plus the answer
  )
  ```

  ```typescript Node (openai SDK) theme={null}
  const client = new OpenAI({
    baseURL: "https://api.flexinference.com/v1",
    apiKey: "flex_live_...",
    timeout: 900_000, // ms, longer than your start_within plus the answer
  });
  ```

  ```python Python (anthropic SDK) theme={null}
  client = anthropic.Anthropic(
      base_url="https://api.flexinference.com",
      auth_token="flex_live_...",
      timeout=900,  # seconds, longer than your start_within plus the answer
  )
  ```

  ```typescript Node (anthropic SDK) theme={null}
  const client = new Anthropic({
    baseURL: "https://api.flexinference.com",
    authToken: "flex_live_...",
    timeout: 900_000, // ms, longer than your start_within plus the answer
  });
  ```
</CodeGroup>

A client that gives up early returns `499 client_closed_request`. When the provider never starts, we cancel the upstream and return `504 upstream_timeout`. When the provider stops feeding an open stream, we cancel it and end the response with `504 stream_idle_timeout`, and whatever text you received is the whole answer.
