# Initial Documentation

Welcome to the **Strata AI API Documentation**, designed to help you understand and integrate the core features and capabilities of Strata AI into your applications.

### **Overview**

Strata AI offers a comprehensive framework to streamline AI-based workflows by optimizing prompt handling across multiple Large Language Models (LLMs). Its modular and extensible design allows developers to create sophisticated solutions that leverage the power of multiple LLMs efficiently.

### **Endpoints**

Strata AI provides a set of APIs to interact with the system. Below are the details of the primary endpoints:

#### **1. Initialize Configuration**

**Endpoint:**

```
POST /api/v1/config/init
```

**Description:**

Generates a configuration file for Strata AI to initialize environment and tool settings.

**Parameters:**

| Parameter | Type   | Description                               | Required |
| --------- | ------ | ----------------------------------------- | -------- |
| path      | string | The file path to store the configuration. | Yes      |

**Example Request:**

```
{
  "path": "~/.strata/config.yaml"
}
```

**Example Response:**

```
{
  "message": "Configuration file initialized at ~/.strata/config.yaml."
}
```

#### **2. Execute Prompt**

**Endpoint:**

```
POST /api/v1/prompt/execute
```

**Description:**

Processes a user prompt by selecting the best LLM for the task and returning the optimized response.

**Parameters:**

| Parameter   | Type   | Description                                      | Required |
| ----------- | ------ | ------------------------------------------------ | -------- |
| prompt      | string | The user-provided prompt to process.             | Yes      |
| context     | object | Additional context or metadata for the prompt.   | No       |
| model\_hint | string | Suggests a specific LLM model to use (optional). | No       |

**Example Request:**

```
{
  "prompt": "What is the capital of France?",
  "context": {
    "user": "test_user",
    "session_id": "12345"
  },
  "model_hint": "gpt-4-turbo"
}
```

**Example Response:**

```
{
  "response": "The capital of France is Paris.",
  "model_used": "gpt-4-turbo",
  "latency": "1.24s"
}
```

#### **3. Retrieve Logs**

**Endpoint:**

```
GET /api/v1/logs
```

**Description:**

Fetches execution logs for debugging and monitoring purposes.

**Parameters:**

| Parameter   | Type   | Description                                    | Required |
| ----------- | ------ | ---------------------------------------------- | -------- |
| session\_id | string | Filter logs by a specific session ID.          | No       |
| limit       | int    | The maximum number of log entries to retrieve. | No       |

**Example Request:**

```
GET /api/v1/logs?session_id=12345&limit=10
```

**Example Response:**

```
[
  {
    "timestamp": "2024-12-20T10:15:30Z",
    "session_id": "12345",
    "log_level": "INFO",
    "message": "Prompt executed successfully."
  },
  {
    "timestamp": "2024-12-20T10:15:31Z",
    "session_id": "12345",
    "log_level": "DEBUG",
    "message": "Selected model: gpt-4-turbo."
  }
]
```

#### **4. Configure Tools**

**Endpoint:**

```
POST /api/v1/tools/configure
```

**Description:**

Configures external tools such as web searching APIs or text-to-speech engines.

**Parameters:**

| Parameter     | Type   | Description                        | Required |
| ------------- | ------ | ---------------------------------- | -------- |
| tool\_name    | string | The name of the tool to configure. | Yes      |
| configuration | object | Key-value pairs for tool settings. | Yes      |

**Example Request:**

```
{
  "tool_name": "web_search",
  "configuration": {
    "api_type": "google",
    "api_key": "YOUR_API_KEY",
    "cse_id": "YOUR_CSE_ID"
  }
}
```

**Example Response:**

```
{
  "message": "Web search tool configured successfully."
}
```

#### **5. Monitor System Status**

**Endpoint:**

```
GET /api/v1/status
```

**Description:**

Retrieves the current status of the system, including API health and active LLMs.

**Parameters:**

None

**Example Request:**

```
GET /api/v1/status
```

**Example Response:**

```
{
  "system_status": "operational",
  "active_llms": ["gpt-4-turbo", "claude-2"],
  "uptime": "48 hours"
}
```

***

### **Error Codes**

| Code | Message               | Description                       |
| ---- | --------------------- | --------------------------------- |
| 200  | OK                    | Request was successful.           |
| 400  | Bad Request           | Invalid parameters were provided. |
| 401  | Unauthorized          | API key is missing or invalid.    |
| 404  | Not Found             | Resource not found.               |
| 500  | Internal Server Error | An unexpected error occurred.     |

***

### **Authentication**

Strata AI uses API keys for authentication. Include your API key in the `Authorization` header of each request:

```
Authorization: Bearer YOUR_API_KEY
```

To obtain your API key, contact the Strata AI support team or follow the onboarding process.

***

### **Rate Limits**

Default rate limits:

* **Standard Plan**: 250 requests per minute
* **Enterprise Plan**: 1000 requests per minute

Contact support for custom rate limits.

For additional support contact us at **<support@strata.ai>**.


---

# 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://strata-ai.gitbook.io/strata-ai/api-documentation/initial-documentation.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.
