# Ai configuration

## AI Configuration Guide

This document provides instructions for configuring the AI settings in the **QRexOrder** system. These settings empower features like the **Instant AI Menu Creator** and automated content generation.

***

### 🛠️ Accessing AI Settings

1. Log in to the **Admin Dashboard**.
2. Navigate to **Settings** > **AI Configuration** via the left sidebar.
3. Here you can select your preferred AI provider and manage API keys.

***

### 🔌 Supported AI Providers

{% tabs %}
{% tab title="Google Gemini" %}
**Recommended for speed and cost.**

* **API Key**: Obtain from [Google AI Studio](https://aistudio.google.com/).
* **Default Model**: `gemini-1.5-flash`
* **Pros**: High speed, massive context window, and a generous free tier.
  {% endtab %}

{% tab title="OpenAI" %}
**Industry standard for reliability.**

* **API Key**: Obtain from [OpenAI Platform](https://platform.openai.com/api-keys).
* **Default Model**: `gpt-4o-mini` or `gpt-3.5-turbo`
* **Pros**: Highly reliable and consistent formatting.
  {% endtab %}

{% tab title="Anthropic" %}
**Superior reasoning and natural language.**

* **API Key**: Obtain from [Anthropic Console](https://console.anthropic.com/).
* **Default Model**: `claude-3-5-sonnet-20240620`
* **Pros**: Excellent for creative descriptions and complex menu logic.
  {% endtab %}

{% tab title="Zhipu AI" %}
**Optimized for regional performance.**

* **API Key**: Obtain from [Zhipu AI Open Platform](https://open.bigmodel.cn/).
* **Default Model**: `glm-4`
* **Pros**: Strong multilingual support and regional availability.
  {% endtab %}
  {% endtabs %}

#### 🌐 Custom AI (OpenAI Compatible)

For providers like **Groq**, **Together AI**, or **OpenRouter**:

* **Endpoint URL**: The base URL (e.g., `https://api.groq.com/openai/v1`).
* **Extra Headers**: Optional JSON object for specific headers (e.g., `{"HTTP-Referer": "https://qrexorder.com"}`).

***

### 🖼️ Image Fallback (Unsplash)

The system uses **Unsplash** to find high-quality, relevant images for menu items if AI image generation is disabled or fails.

* **Access Key**: Obtain a developer key from the [Unsplash Developer Portal](https://unsplash.com/developers).
* **How it works**: The system searches Unsplash using keywords from the item name/description.
* **Orientation**: All images fetched are automatically filtered for **landscape** orientation to fit the UI.

***

### ⚙️ General Configuration Settings

| Setting                | Description                                                               |
| ---------------------- | ------------------------------------------------------------------------- |
| **Active AI Provider** | Choose which engine will handle requests globally.                        |
| **Model Name**         | Specify a custom model (e.g., `gpt-4o`). Leave blank for system defaults. |
| **API Key Visibility** | Use the 👁️ icon to verify your keys before saving.                       |

***

{% hint style="info" %}
**Performance Tip**: Using `gemini-1.5-flash` or `gpt-4o-mini` provides the fastest response times for menu generation. Only use higher-tier models if you require complex creative writing.
{% endhint %}

{% hint style="danger" %}
**Billing**: Ensure your API keys have active credits on the respective provider's platform to avoid **401 Unauthorized** or **Connection Error** messages.
{% endhint %}


---

# 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://phplime-envato.gitbook.io/qrexorder/ai-configuration.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.
