Skip to content

Latest commit

 

History

17 Commits

Folders and files

Repository files navigation

AI API Examples

  • simple JSON request/response
  • text streaming
  • Server-Sent Events

A companion project for the blog post https://komelin.com/blog/build-ai-powered-api

Installation

Local model

ollama run gemma4:e2b

Gemma 4 needs a recent Ollama version. If the pull fails with "requires a newer version of Ollama", update Ollama first.

Project dependencies

pnpm i

Run the server

pnpm start
# or node src/index.js

Test API

Yaak

Import Yaak config and play with the requests.

Manually

Send a POST request with the following JSON in the body:

{
  "question": "How are you?"
}

to one of the urls:

Contributors

Languages