# AI Functions

**AI Functions** combine the power of CloudBrowser with OpenAI's artificial intelligence to process and analyze web content automatically. These functions allow you to extract HTML from any webpage and transform it using custom prompts, generating summaries, translations, format conversions, and data analysis in a single API call.

**Common use cases:**

* 🛒 Extract product prices and data
* 📝 Generate automatic content summaries
* 🌐 Translate entire web pages
* 📊 Convert HTML tables to structured formats (JSON, CSV)
* 🔍 Analyze and extract specific information with custom prompts

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>NodeJS full examples</td><td></td><td></td><td><a href="/files/y21pltD9xVVYvn3E8Tvs">/files/y21pltD9xVVYvn3E8Tvs</a></td><td><a href="https://github.com/CloudBrowser-AI/CloudBrowserAiNodeJS/tree/main/samples">https://github.com/CloudBrowser-AI/CloudBrowserAiNodeJS/tree/main/samples</a></td></tr><tr><td>.NET full examples</td><td></td><td></td><td><a href="/files/EHzFNz8DjtKxarQYrrU2">/files/EHzFNz8DjtKxarQYrrU2</a></td><td><a href="https://github.com/CloudBrowser-AI/CloudBrowserAiSharp/tree/main/samples">https://github.com/CloudBrowser-AI/CloudBrowserAiSharp/tree/main/samples</a></td></tr></tbody></table>

**Note:** Currently, only OpenAI is supported as the AI provider. In the future, we may support other providers.

#### Common Request Body

Every request must include an `openAIConfiguration` object in the body:

```json
{
  "openAIConfiguration": {
    "apiKey": "string",
    "model": "string"
  },
  // Operation-specific body below
}
```

Where:

* **`apiKey`**: Your OpenAI API key.
* **`model`**: The OpenAI model to use (e.g., `gpt-4`).

#### Response Format

All requests return a standard response structure:

```json
{
  "status": "ResponseStatus",
  "response": "string",
  "openAiError": "AIError (optional)"
}
```

* **`status`**: The request status (see the `ResponseStatus` enum).
* **`response`**: The output generated by OpenAI.
* **`openAiError`** (optional): Any OpenAI-specific error (see the `AIError` enum).

```csharp
public enum AIError : byte {
    UNKNOWN = 0,
    CONTENT_FLAGGED = 1,
    TOO_LONG = 2,
    INVALID_API_KEY = 3
}
```


---

# Agent Instructions: 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:

```
GET https://cloudbrowser.gitbook.io/docs/configurations/ai-functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
