> For the complete documentation index, see [llms.txt](https://samrel-ai.gitbook.io/samrel-ai-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://samrel-ai.gitbook.io/samrel-ai-documentation/api-documentation/initial-documentation.md).

# Initial Documentation

This feature will be enabled and updated in Q1 2025

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

**Overview**

Samrel 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**

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

**1. Initialize Configuration**

**Endpoint:**

Copy

Copy

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

**Description:**

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

**Parameters:**

Parameter

Type

Description

Required

path

string

The file path to store the configuration.

Yes

**Example Request:**

Copy

Copy

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

**Example Response:**

Copy

Copy

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

**2. Execute Prompt**

**Endpoint:**

Copy

Copy

```
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:**

Copy

Copy

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

**Example Response:**

Copy

Copy

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

**3. Retrieve Logs**

**Endpoint:**

Copy

Copy

```
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:**

Copy

Copy

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

**Example Response:**

Copy

Copy

```
[
  {
    "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:**

Copy

Copy

```
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:**

Copy

Copy

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

**Example Response:**

Copy

Copy

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

**5. Monitor System Status**

**Endpoint:**

Copy

Copy

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

**Description:**

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

**Parameters:**

None

**Example Request:**

Copy

Copy

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

**Example Response:**

Copy

Copy

```
{
  "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**

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

Copy

Copy

```
Authorization: Bearer YOUR_API_KEY
```

To obtain your API key, contact the Samrel 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@samrel.ai>**.
