> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vrin.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# VRINClient

> Core client class for all Vrin operations

`VRINClient` is the single entry point for queries, knowledge management, file uploads, conversations, auth, and health checks.

## Constructor

```python theme={null}
from vrin import VRINClient

client = VRINClient(
    api_key="vrin_live_your_api_key",
    timeout=120.0,      # default request timeout in seconds
    max_retries=2,      # retries on 5xx / connection errors
)
```

### Parameters

<ParamField body="api_key" type="string" required>
  Your Vrin API key. Keys starting with `vrin_` route to Vrin shared infrastructure.
  Keys starting with `vrin_ent_` route to your enterprise AWS account (use
  VRINEnterpriseClient for those).
</ParamField>

<ParamField body="timeout" type="float" default="120.0">
  Default timeout in seconds for all HTTP requests. Individual methods may override this.
</ParamField>

<ParamField body="max_retries" type="int" default="2">
  Number of retries on server errors (5xx) and connection failures. Client errors
  (401, 429) are never retried. Uses exponential backoff (2^attempt seconds).
</ParamField>

## Context manager

`VRINClient` implements the context manager protocol. The underlying HTTP session is closed on exit.

```python theme={null}
with VRINClient(api_key="vrin_live_abc123def456ghi789jkl012mno345pq") as client:
    result = client.query("What is ACME's revenue?")
# session closed automatically
```

## Properties

<ResponseField name="current_session_id" type="Optional[str]">
  The active conversation session ID, or `None` if no conversation is in progress.
</ResponseField>

<ResponseField name="conversation_history_ids" type="List[str]">
  List of ended conversation session IDs from this client instance.
</ResponseField>

## Auto-detection

If you are not sure whether a key is standard or enterprise, use the factory helper:

```python theme={null}
from vrin import get_enterprise_client

# Returns VRINEnterpriseClient for vrin_ent_* keys, VRINClient otherwise
client = get_enterprise_client(api_key=my_key)
```

## Methods overview

| Method                                                                  | Description                            |
| ----------------------------------------------------------------------- | -------------------------------------- |
| [`query()`](/sdk/querying)                                              | Query the knowledge base               |
| [`query_facts()`](/sdk/querying#query_facts)                            | Fast fact retrieval without AI summary |
| [`insert()`](/sdk/knowledge)                                            | Insert text content                    |
| [`upload_file()`](/sdk/file-upload)                                     | Upload a file                          |
| [`upload_bytes()`](/sdk/file-upload#upload_bytes)                       | Upload raw bytes                       |
| [`start_conversation()`](/sdk/conversations)                            | Start a conversation session           |
| [`continue_conversation()`](/sdk/conversations#continue-a-conversation) | Query with conversation context        |
| [`specialize()`](/sdk/specialization)                                   | Set AI persona                         |
| [`login()`](/sdk/auth)                                                  | Authenticate (static)                  |
| [`register()`](/sdk/auth)                                               | Create account (static)                |
| [`health_check()`](#health-check)                                       | Check service health                   |

## Health check

```python theme={null}
status = client.health_check()
# {"status": "healthy", "version": "..."}
```

Returns service health information. Useful for connectivity validation and monitoring.

## Retry behavior

The client automatically retries on:

* HTTP 5xx responses
* `requests.ConnectionError`
* `requests.Timeout`

It does **not** retry on:

* HTTP 401 (`AuthenticationError`)
* HTTP 429 (`RateLimitError`)
* `ValidationError`

Backoff is exponential: 1s, 2s, 4s for retries 1, 2, 3.
