Zack Saadioui
8/27/2024
1
2
bash
ollama serve1
http://localhost:114341
http://localhost:114341
/api/generate1
/api/chat1
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 axios1
Server is running on http://localhost:${PORT}1
2
bash
node app.js1
http://localhost:3000/api/chat1
/api/chat1
2
3
4
5
6
7
8
9
json
{
  "messages": [
    {
      "role": "user",
      "content": "Why is the sky blue?"
    }
  ]
}Copyright © Arsturn 2025