"Empty Response from Chat Model Call" Error with Custom OpenAI-Compatible Endpoint on Latest LibreChat Image #8435
-
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 1 reply
-
Same problem. |
Beta Was this translation helpful? Give feedback.
-
It works with many different custom endpoints just as before (ollama, together.ai, openrouter) but I can see it doesn’t in your case. Which API/provider are you using? Are you using a proxy (litellm, etc)? Does your API support streaming? can you share your exact config in the librechat.yaml file? Any information to this end will help me resolve this for you, especially if I can reproduce this exactly how you have it setup. |
Beta Was this translation helpful? Give feedback.
-
I'm using a custom OpenAI-compatible API server (not ollama, together.ai, or openrouter). It's a self-hosted endpoint that returns properly formatted OpenAI chat completion responses. I have provided example of response above. No proxy - direct connection to the custom API endpoint. Streaming is not supported. The API only returns complete responses, not streaming chunks. librechat.yaml configuration: custom:
- name: 'Craza'
apiKey: '${CRAZA_API_KEY}'
baseURL: 'https://{custom_url}/v1/'
headers:
x-user-id: "{{LIBRECHAT_USER_ID}}"
x-user-email: "{{LIBRECHAT_USER_EMAIL}}"
models:
default:
- 'craza'
fetch: false
titleConvo: false
modelDisplayLabel: 'Craza'
iconURL: https://icon.png
dropParams: ["stream"] The same configuration works perfectly with the older image (a823d7f5bfc2, 3 months ago) You can reproduce it with the following simple python server: from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
import time
import uuid
app = FastAPI()
@app.post("/v1/chat/completions")
async def chat_completions(request: Request):
body = await request.json()
# You can inspect the incoming request here if needed
# For now, we return a static response
response = {
"id": f"chatcmpl-{uuid.uuid4().hex}",
"object": "chat.completion",
"created": int(time.time()),
"model": "craza",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I assist you today?",
"name": None,
"tool_calls": []
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 100,
"completion_tokens": 50,
"total_tokens": 150
}
}
return JSONResponse(content=response) |
Beta Was this translation helpful? Give feedback.
-
it works! Thank you so much for helping and your time |
Beta Was this translation helpful? Give feedback.
-
@danny-avila Is there a same configuration for titleModel? API returns JSON in the same format but I'm getting: |
Beta Was this translation helpful? Give feedback.
-
Still getting the same error. Here is the relevant part from my librechat.yaml
Error from console output:
|
Beta Was this translation helpful? Give feedback.
Try adding under the custom endpoint definition
https://www.librechat.ai/docs/configuration/librechat_yaml/object_structure/custom_endpoint#addparams
we are adding a UI toggle for this setting soon, as well as information on this specific setting in the docs.