- OpenAIUpdated
- OpenAI: AdvancedNew
- AnthropicUpdated
- Anthropic: AdvancedNew
- Google GeminiUpdated
- Google Gemini: AdvancedNew
- Google Vertex AIUpdated
- OllamaUpdated
- Grok (xAI)Updated
- GroqUpdated
- MistralUpdated
- CohereUpdated
- TypeSafeUpdated
- OllayaUpdated
- ElevenLabsUpdated
- fal.aiUpdated
- ReactorUpdated
- World LabsUpdated
- OpenRouter AdapterUpdated
- OpenRouter: AdvancedNew
- Perplexity SearchUpdated
- Vercel AI GatewayUpdated
- Lovable AI GatewayUpdated
- OpenAI-CompatibleUpdated
- OpenAI-Compatible: AdvancedNew
- LLM GatewayUpdated
- CloudflareUpdated
- Claude CodeUpdated
- CodexUpdated
- OpenCodeUpdated
- Grok BuildUpdated
- ACP-CompatibleUpdated
- Amazon BedrockUpdated
- BytePlusUpdated
- BytePlus: AdvancedNew
Ollaya
The Ollaya adapter calls the laya models on your machine through decide(). It returns a typed answer. It has no chat.
1. Install#
npm i @tanstack/ai @tanstack/ai-ollayapnpm add @tanstack/ai @tanstack/ai-ollayayarn add @tanstack/ai @tanstack/ai-ollayabun add @tanstack/ai @tanstack/ai-ollaya2. Start Ollaya and pull a model#
Ollaya needs no API key. It needs a running server with a model.
- Install Ollaya:
# macOS or Linux
curl -fsSL https://ollaya.dev/install.sh | sh# Windows (PowerShell)
irm https://ollaya.dev/install.ps1 | iex- Start the server:
ollaya serve- Pull a model:
ollaya pull laya:latestThe server listens on http://127.0.0.1:11435. The adapter uses this URL by default. The download page and the desktop app are on ollaya.dev/download.
3. Ask your first questions from the server#
This route reads a support ticket and asks three questions about it:
import { decide, choice, score, boolean } from "@tanstack/ai";
import { ollayaDecider } from "@tanstack/ai-ollaya";
export async function POST(request: Request) {
const ticket = await request.text();
const result = await decide({
adapter: ollayaDecider("laya:latest"),
state: ticket,
questions: {
queue: choice({
instructions: "Which team should handle this ticket?",
options: {
billing: "Payments, invoices, refunds",
tech: "Bugs, outages, integrations",
sales: "Pricing, upgrades, new accounts",
},
}),
urgency: score({
instructions: "How urgent is this ticket?",
levels: ["low", "medium", "high"],
}),
refund: boolean({
instructions: "Is the customer asking for a refund?",
}),
},
});
return Response.json({
queue: result.queue.value,
urgency: result.urgency.value,
refund: result.refund.value,
model: result.meta.model,
});
}When you ask for laya:latest, the server picks laya:en or laya:multilingual from the text. result.meta.model tells you which one answered.
4. Call the route from the client#
The client sends the ticket text to the route:
export async function evaluateTicket(ticket: string) {
const response = await fetch("/api/evaluate", {
method: "POST",
body: ticket,
});
return response.json();
}Call evaluateTicket("Charged twice for the same invoice. Please refund the extra payment.") and you get back the queue, the urgency, and the refund answer.
For the rest of decide(), see Evaluate. For a full TanStack Start app, see Evaluate a ticket.
Models and options#
| Model | Description |
|---|---|
| laya:latest | Sends each request to laya:en or laya:multilingual. |
| laya:en | The English decision model (ModernBERT-large). |
| laya:multilingual | The decision model for 100+ languages (mmBERT-base). |
You can pass any other model tag as a string. The package exports the known tags as OLLAYA_EVALUATE_MODELS.
Advanced#
Another host, or an API key#
The adapter does not read environment variables.
- If the server is on another host, pass baseURL.
- If the server requires OLLAYA_API_KEY, pass the key as apiKey.
import { ollayaDecider } from "@tanstack/ai-ollaya";
const adapter = ollayaDecider("laya:latest", {
baseURL: "http://my-host:11435",
apiKey: "local-token",
});baseUrl and headers are aliases of baseURL and defaultHeaders. If you set both forms, baseURL and defaultHeaders win. A blank baseURL keeps the default host.
API reference#
The adapter sends POST /v1/systemone to the base URL with fetch. There is no Ollaya SDK.
ollayaDecider(model, config?) creates an evaluate adapter. The config fields:
- baseURL: the server URL. The default is http://127.0.0.1:11435. baseUrl is an alias.
- apiKey: a bearer token, for a server that requires OLLAYA_API_KEY.
- defaultHeaders: extra request headers. headers is an alias.
- fetch: your own fetch function.