--- title: "Connect LibreChat to XiuRouter" description: "Add a LibreChat custom endpoint, save a server secret, and verify model discovery and chat requests." image: "https://docs.xiu.ai/og.png" --- > XiuAI documentation index > Full documentation index: https://docs.xiu.ai/en/llms.txt > Check the index for current pages before reading. # Connect LibreChat to XiuRouter Save a server-side secret, then add a XiuRouter OpenAI-compatible custom endpoint. Keep existing endpoints. `models.default` is a required fallback; `fetch` expands the model list through `/v1/models`. ## Choose a setup method - First setup: save the secret and add the custom endpoint. - Existing setup: append XiuRouter without replacing other endpoints. - Chat-assisted setup: unavailable; the server deployment manages configuration and secrets. ## Before you start You need access to `librechat.yaml` and the runtime environment, a dedicated XiuRouter key, and an exact model ID from the current catalog. ## Save the server secret Set this in the environment actually read by LibreChat: ```bash XIUROUTER_API_KEY=YOUR_XIUROUTER_API_KEY ``` Keep real values out of Git. For containers, use platform secrets or a controlled environment file. ## Add the endpoint Merge this entry into `librechat.yaml`: ```yaml endpoints: custom: - name: XiuRouter apiKey: "${XIUROUTER_API_KEY}" baseURL: "https://router-api.xiu.ai/v1" models: default: - "YOUR_MODEL_ID" fetch: true titleConvo: true titleModel: "current_model" modelDisplayLabel: XiuRouter ``` Append only this `endpoints.custom` entry. `fetch: true` reads `/v1/models`; `default` provides the fallback if discovery fails. `titleModel: current_model` avoids maintaining a second model ID. ## Verify 1. Restart LibreChat to load the configuration and environment. 2. Select XiuRouter and the target model. 3. Send a short text request. 4. Check the model, endpoint, and successful result in XiuRouter's request inspection view. Files, code execution, search, and agents remain controlled by LibreChat's own settings. The endpoint configures model requests. ## Troubleshoot | Symptom | Next step | | --- | --- | | XiuRouter missing from endpoints | Check YAML nesting and the active configuration path | | Model discovery returns `401` | Confirm the service process can read `XIUROUTER_API_KEY` | | Title generation fails | Use a verified `titleModel` or turn off `titleConvo` | | Chat works but agent tools fail | Check model tool support and LibreChat agent settings separately | ## Roll back Remove the XiuRouter custom endpoint, restart, and confirm the original endpoint works before revoking the dedicated key. ## Sources and review date Reviewed on 2026-08-31. This translation preserves that date. Basic setup requires a complete LibreChat reply and matching successful request record. Source: https://docs.xiu.ai/en/router/integrations/librechat/index.mdx