> For the complete documentation index, see [llms.txt](https://docs.tensorx.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tensorx.ai/chat-interfaces/librechat.md).

# LibreChat

Connect LibreChat to TensorX.ai and access leading open-source models like DeepSeek, Llama, Qwen, and GLM through a single self-hosted interface.

***

## What is LibreChat?

[LibreChat](https://www.librechat.ai/) is an open-source ChatGPT alternative that supports multiple AI providers through OpenAI-compatible APIs. With TensorX, you get a privacy-focused, self-hosted chat interface with access to all our models.

{% hint style="success" %}
**Why LibreChat + TensorX?**

* 🔒 **Self-hosted** - Your conversations stay on your infrastructure
* 🌍 **EU-hosted models** - Privacy-focused European hosting
* 🚀 **Multiple models** - DeepSeek, Llama, Qwen, GLM, and more
* 💰 **Simple pricing** - One API key, transparent costs
  {% endhint %}

***

## Prerequisites

* LibreChat installed and running (follow the [official LibreChat installation guide](https://www.librechat.ai/docs/configuration/docker_override))
* A TensorX API key ([sign up here](https://app.tensorx.ai))

***

## Configuration

### Step 1: Add Your API Key

Add your TensorX API key to LibreChat's `.env` file:

```bash
TENSORX_API_KEY=your-tensorx-api-key-here
```

### Step 2: Configure the TensorX Endpoint

Create or edit your `librechat.yaml` file:

```yaml
version: 1.1.7
cache: true

endpoints:
  custom:
    - name: "TensorX AI"
      apiKey: "${TENSORX_API_KEY}"
      baseURL: "https://api.tensorx.ai/v1"
      models:
        default:
          - "deepseek/deepseek-chat-v3.1"
          - "deepseek/deepseek-r1-0528"
          - "z-ai/glm-5.1"
          - "meta-llama/llama-3.3-70b-instruct"
          - "meta-llama/llama-4-maverick"
          - "qwen/qwen3-235b-a22b-2507"
          - "openai/gpt-oss-120b"
          - "minimax/minimax-m2.5"
        fetch: false
      titleConvo: true
      titleModel: "deepseek/deepseek-chat-v3.1"
      summarize: false
      summaryModel: "deepseek/deepseek-chat-v3.1"
      forcePrompt: false
      modelDisplayLabel: "TensorX AI"
      dropParams: ["user"]
```

### Step 3: Mount the Configuration

Add this to your `docker-compose.override.yml`:

```yaml
services:
  api:
    volumes:
      - ./librechat.yaml:/app/librechat.yaml:ro
```

### Step 4: Restart LibreChat

```bash
docker compose restart api
```

***

## Using TensorX in LibreChat

1. Open LibreChat in your browser
2. Start a new conversation
3. Click the model selector dropdown
4. Select **TensorX AI** as the provider
5. Choose your preferred model

***

## Available Models

| Model                         | Features             | Best For                       |
| ----------------------------- | -------------------- | ------------------------------ |
| `z-ai/glm-5.1` ⭐              | Functions, Reasoning | Coding, reasoning, general use |
| `minimax/minimax-m2.5`        | Functions, Reasoning | Reasoning, general purpose     |
| `moonshotai/kimi-k2.5`        | Vision, Functions    | Vision, long context           |
| `deepseek/deepseek-chat-v3.1` | Functions, Reasoning | General chat, fast reasoning   |
| `deepseek/deepseek-r1-0528`   | Functions, Reasoning | Complex reasoning tasks        |
| `minimax/minimax-m2`          | Coding, Functions    | Coding, fast responses         |
| `meta-llama/llama-4-maverick` | Functions            | Long context, multimodal       |
| `openai/gpt-oss-120b`         | Functions, Reasoning | GPT-4 alternative              |

{% hint style="info" %}
**View full model list and pricing**: [tensorx.ai/models](https://tensorx.ai/models)
{% endhint %}

***

## Model Recommendations

| Task                  | Recommended Models                                                 |
| --------------------- | ------------------------------------------------------------------ |
| **General chat**      | `deepseek/deepseek-chat-v3.1`, `meta-llama/llama-3.3-70b-instruct` |
| **Complex reasoning** | `deepseek/deepseek-r1-0528`, `openai/gpt-oss-120b`                 |
| **Coding**            | `z-ai/glm-5.1`, `minimax/minimax-m2`                               |
| **Vision tasks**      | `moonshotai/kimi-k2.5`, `meta-llama/llama-4-maverick`              |
| **Multilingual**      | `z-ai/glm-5.1`                                                     |

***

## Advanced Configuration

### Auto-Fetch All Models

To automatically discover all available TensorX models:

```yaml
models:
  fetch: true
  default:
    - "deepseek/deepseek-chat-v3.1"
```

### Custom Parameters

```yaml
endpoints:
  custom:
    - name: "TensorX AI"
      apiKey: "${TENSORX_API_KEY}"
      baseURL: "https://api.tensorx.ai/v1"
      models:
        default:
          - "deepseek/deepseek-chat-v3.1"
        fetch: false
      default: ["max_tokens", "temperature", "top_p"]
      additionalParameters:
        max_tokens: 4000
        temperature: 0.7
        top_p: 0.9
```

### Organize by Category

Create multiple endpoints for different model types:

```yaml
endpoints:
  custom:
    - name: "TensorX - Reasoning"
      apiKey: "${TENSORX_API_KEY}"
      baseURL: "https://api.tensorx.ai/v1"
      models:
        default:
          - "deepseek/deepseek-r1-0528"
          - "openai/gpt-oss-120b"
    
    - name: "TensorX - General"
      apiKey: "${TENSORX_API_KEY}"
      baseURL: "https://api.tensorx.ai/v1"
      models:
        default:
          - "meta-llama/llama-3.3-70b-instruct"
          - "z-ai/glm-5.1"
```

***

## Configuration Options

| Option           | Description                                        |
| ---------------- | -------------------------------------------------- |
| `apiKey`         | Your TensorX API key from environment variables    |
| `baseURL`        | TensorX API endpoint (`https://api.tensorx.ai/v1`) |
| `models.default` | List of models shown in the dropdown               |
| `fetch`          | Set `true` to auto-fetch available models          |
| `titleConvo`     | Auto-generate conversation titles                  |
| `titleModel`     | Model used for titles (use a fast model)           |
| `dropParams`     | Remove parameters that may cause issues            |

***

## Troubleshooting

### Models Not Appearing

1. Verify your API key is set in `.env`
2. Check that `librechat.yaml` is properly mounted
3. Restart the API container: `docker compose restart api`
4. Check logs: `docker compose logs api`

### Test Your API Key

```bash
curl https://api.tensorx.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "deepseek/deepseek-chat-v3.1",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```

### Configuration Not Loading

* Use proper YAML indentation (2 spaces)
* Verify quotes around strings
* Check version number matches your LibreChat version

***

## Best Practices

1. **Use fast models for titles** - Set `titleModel` to `deepseek/deepseek-chat-v3.1`
2. **Limit your model list** - Only include models you actually use
3. **Secure your API key** - Never commit `.env` files to version control
4. **Monitor usage** - Track API usage in your [TensorX dashboard](https://app.tensorx.ai/dashboard)

***

## Resources

* [LibreChat Documentation](https://www.librechat.ai/docs)
* [LibreChat Custom Endpoints Guide](https://www.librechat.ai/docs/configuration/librechat_yaml/ai_endpoints/custom)
* [TensorX Models & Pricing](https://tensorx.ai/models)
* [TensorX API Examples](https://github.com/Tensorix-ai/tensorix-docs/blob/main/api-examples/README.md)

***

## Need Help?

* 📧 **Email**: <support@tensorx.ai>
* 💬 **Contact Support**: [Contact page](https://github.com/Tensorix-ai/tensorix-docs/blob/main/support/support/README.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://docs.tensorx.ai/chat-interfaces/librechat.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.
