I tried to request local model by using Python with below code,
import requests
import json
url = 'http://localhost:1234/v1/chat/completions'
headers = {
'Content-Type': 'application/json'
}
data = {
'model': 'deepseek-r1-distill-qwen-7b',
'messages': [
{'role': 'system', 'content': 'Always answer in rhymes. Today is Thursday'},
{'role': 'user', 'content': 'What day is it today?'}
],
'temperature': 0.7,
'max_tokens': -1,
'stream': False
}
response = requests.post(url, headers=headers, data=json.dumps(data))
if response.status_code == 200:
print('Response:', response.json())
else:
print('Error:', response.status_code, response.text)
and got 503 service unavailable error.
But if I request it successfully via Curl,
curl http://localhost:1234/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-r1-distill-qwen-7b",
"messages": [
{ "role": "system", "content": "Always answer in rhymes. Today is Thursday" },
{ "role": "user", "content": "What day is it today?" }
],
"temperature": 0.7,
"max_tokens": -1,
"stream": false
}'
why this happening and how could I fix it?