Zack Saadioui
8/27/2024
1
2
bash
ollama serve
1
http://localhost:11434
1
http://localhost:11434
1
/api/generate
1
/api/chat
1
2
bash
curl http://localhost:11434/api/generate -d '{ "model": "llama3.1", "prompt":"Why is the sky blue?" }'
1
2
3
4
5
bash
mkdir my-ollama-api
cd my-ollama-api
npm init -y
npm install express body-parser axios
1
Server is running on http://localhost:${PORT}
1
2
bash
node app.js
1
http://localhost:3000/api/chat
1
/api/chat
1
2
3
4
5
6
7
8
9
json
{
"messages": [
{
"role": "user",
"content": "Why is the sky blue?"
}
]
}
Copyright © Arsturn 2025