> For the complete documentation index, see [llms.txt](https://burp-ai-agent.six2dez.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://burp-ai-agent.six2dez.com/backends/openai-compatible.md).

# Generic (OpenAI-compatible)

Use this backend for any provider exposing an OpenAI-compatible Chat Completions API.

## Requirements

* Provider base URL.
* Model identifier.
* Optional API key/headers depending on provider.

## Setup

1. Get provider URL and model name.
2. Configure fields in **AI Backend** settings tab.
3. Validate with **Test connection**.

## Configuration

| Setting               | Value                                      |
| --------------------- | ------------------------------------------ |
| **Preferred Backend** | `openai-compatible`                        |
| **Base URL**          | provider URL                               |
| **Model**             | provider model id                          |
| **API Key (Bearer)**  | optional                                   |
| **Extra Headers**     | optional (`Header: value`)                 |
| **Timeout (seconds)** | `120` by default (accepted range: 30-3600) |

### URL Behavior

Final endpoint resolution:

* Base URL ends with `/vN` -> append `/chat/completions`.
* Base URL already ends with `/chat/completions` -> use as-is.
* Otherwise -> append `/v1/chat/completions`.

Examples:

```
https://api.example.com    -> https://api.example.com/v1/chat/completions
https://api.example.com/v1 -> https://api.example.com/v1/chat/completions
https://api.example.com/v4 -> https://api.example.com/v4/chat/completions
```

Headers example:

```
X-Org: myorg
X-Project: myproj
```

## Output Token Limits

The extension sets `max_tokens` per request type to bound output and reduce avoidable truncation:

| Request Type                 | `max_tokens` |
| ---------------------------- | ------------ |
| **Chat**                     | 4096         |
| **Scanner (single request)** | 2048         |
| **Scanner (batch analysis)** | 4096         |
| **Payload generation**       | 1024         |

## Troubleshooting

{% hint style="info" %}

* `401/403`: verify auth credentials and headers.
* `404`: verify provider supports chat completions at resolved path.
* Timeout: increase timeout or choose smaller/faster model.
  {% endhint %}

## Retry Behavior

If a request throws a classified transient transport exception, the extension makes up to 6 total attempts with five possible delays (500/1000/1500/2000/3000 ms). The connection's circuit breaker opens after 5 recorded transient failures and allows one half-open model request after 30 seconds. HTTP error responses are not retried inside the same call, although 429/5xx responses count toward the breaker. Each actual retry is logged in the [AI Request Logger](/privacy-and-logging/ai-request-logger.md). See [Backends Overview → Retry Behavior](/backends/overview.md#retry-behavior).

## Related Pages

* [Backends Overview](/backends/overview.md)
* [Troubleshooting](/reference/troubleshooting.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://burp-ai-agent.six2dez.com/backends/openai-compatible.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
