UNPKG

ai-server

Version:

An OpenAI and Claude API compatible server using node-llama-cpp for local LLM models

17 lines (14 loc) 421 B
const response = await fetch('http://localhost:3000/v1/messages', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'llama-local', messages: [ { role: 'human', content: 'Tell me a little bit about TypeScript' } ], max_tokens: 500, temperature: 0.7 }) }); const data = await response.json(); console.log(JSON.stringify(data, null, ' '));