The quick answer
- What it is. Laya is an open-source model. It picks one answer from a short list, like "billing or support?", on your own machine.
- What it is good at. Simple, repeating, clearly defined decisions. It is not for long documents, long lists of choices, or writing.
- What you get here. Setup step by step, five places to use it in your business, and three things you can build and sell.
What is Laya?
Laya is a small AI model that makes decisions. You give it a message and a question. It gives back one answer from a list you choose.
For example, the message is "I was billed twice, please refund me." The question is "billing or support?" The answer is "billing".
Illustration with an example message. Laya's logo is the real one from the Laya repository.
Here are the facts:
- It is an open-source alternative to Jev, a hosted model from TypeSafe AI that does the same kind of job. I wrote about it here: Jev explained.
- It has 31,000+ stars on GitHub.
- Its code and model are under the Apache 2.0 licence, which allows business use.
- It runs on your own machine, so your messages do not have to go to someone else's server.
- It copies Jev's API format. The README says an app built for Jev mostly just needs its address changed, and it lists the few things that differ.
What it does not do: write paragraphs. It is not a chatbot.
Why should a business care?
Most businesses have small decisions that repeat all day. Here are five:
- Is this lead qualified?
- Is this a billing or a support ticket?
- Is this email urgent or normal?
- Is this customer interested?
- Is this message genuine or spam?
Each one has two answers. Each one comes up again and again.
You do not need Claude or Codex for these. A big model can do them, but you pay for every message and wait longer than you need to. A small model that only makes decisions is the better fit.
That is my view, and the test below backs it up. Claude and Codex are still the right tools for writing, coding and hard thinking.
How fast and how accurate is Laya?
An independent test called jevbench ran Laya and Jev on the same 500 news headlines. Each headline had to go into one of 4 topics.
| AG News test | Laya | Jev |
|---|---|---|
| Time per answer (median) | 59 ms | 381 ms |
| Accuracy | 90.6% | 84.3% |
| API cost per 1,000 answers | $0.00 | $0.0184 |
Laya ran on a local machine. Jev ran through its API.
In plain words: Laya was about 6.5 times faster and scored higher on this test. Now read it honestly:
- It is not a pure speed race. Laya ran on a local machine, an Apple Silicon Mac. Jev ran through its API, so its time includes the trip over the internet.
- It was one test. News headlines, 4 labels. Your messages are different.
- Laya has seen headlines like these before. The Laya README says this news data is part of its own training mix. Expect lower scores on messages it has never seen.
- Jev won the other two tests. On short movie reviews (good or bad), Jev scored 95.4% and Laya 92.0%. On bank questions sorted into 77 types, Jev scored 76.4% and Laya 38.2%.
- No per-token bill is not the same as free. Your computer and your power are your cost. In the same file, Jev cost between $0.0148 and $0.0831 per 1,000 answers across the three tests. Laya's API fee was $0.00.
- Laya is a good choice, not the only cheap one. On the news test, Claude Sonnet 5 scored 89.6% in about 2 seconds per answer, at $1.0408 per 1,000 answers. A small DistilBERT model, trained for about 10 minutes on this kind of data, scored 91.0% in 6 ms.
What is the catch?
You cannot use Laya for every task. Skip it when:
- The text is long. By default Laya reads about one page. The rest is cut off. (That is 512 tokens for the English model and 1,024 for the multilingual one. The README shows how to raise it, but test it on your own data.)
- You have many categories. With 77 choices it scored 38.2%. Keep your list to a handful.
- You need writing. Laya picks an answer. It does not write one.
- You have not tested it on your own messages. On the README's own test of 2,000 business-style decisions, the untrained model scored 36%. A random guess scores 32%. After training on that kind of data it scored 77%.
So the rule is simple. Simple, repeating, clearly defined decisions are Laya's job. Everything else goes to a bigger model or a person.
How do you set up Laya?
What you need
- A Mac with Apple Silicon, or a computer with an NVIDIA graphics card. Intel Mac? The README has a special install line for you.
- Python 3.10 or newer.
- About 1 GB of free space for the English model. All three models together take about 2.3 GB.
- Internet on the first run. The model downloads once from Hugging Face.
- Not a weak server with no graphics card. One test on a 4-core server took about 49 seconds per answer (an older Laya version).
Step 1. Install it
Open a terminal. Make a folder and install Laya inside it:
mkdir laya-test && cd laya-test
python3 -m venv .venv
.venv/bin/python -m pip install laya
.venv/bin/python -I -c "import laya; print(laya.__version__)"The last line prints the version number. If you see it, Laya is installed. On Windows, the README has the same steps for PowerShell.
Step 2. Run your first decision
.venv/bin/laya "My payment failed twice" --preset triage--preset triage is a ready-made set of support questions: what the customer wants, if it is urgent, how frustrated they sound, if they want money back, and if they might leave. Laya also has email, guard, moderation and router presets.
The first run downloads the model, so it can take a few minutes. After that it is fast.
Step 3. Ask your own question
Save this as lead.py. The message is an example. Put your own in.
from laya import Router
router = Router() # downloads the model on first use
lead = "Hi, I need pricing for 3 seats. Can we talk this week?"
questions = {
"lead": {
"type": "choice",
"instructions": "Is this lead ready to talk to sales?",
"criteria": {
"hot": "asks about price, a demo or a start date",
"cold": "just looking, no clear need",
},
}
}
result = router.predict(lead, questions)
print(result["answers"]["lead"]["choice"])Run it with .venv/bin/python lead.py. You write the question and describe each answer in plain words. Use clear words like hot and cold. Do not use yes and no. The README warns that yes and no labels can confuse the model.
Step 4. Run it as a small server
Now your forms, inbox tools or own code can ask Laya questions over the web. Install the server part and start it:
.venv/bin/python -m pip install "laya[serve]"
LAYA_HOST=127.0.0.1 LAYA_MODELS=english .venv/bin/laya-serveLeave it running. In a second terminal, send it a question:
curl -s localhost:8000/v1/systemone -H 'content-type: application/json' -d '{
"state": {"body": "I was billed twice, please refund me."},
"questions": {"dept": {"type": "choice", "instructions": "which team?",
"criteria": {"billing": "refunds", "tech": "bugs"}}}
}'Keep LAYA_HOST on 127.0.0.1 so only your own computer can call it. If other computers must call it, set LAYA_API_KEY. Then every caller has to send that key.
Step 5. Test it on 20 of your own messages
- Take 20 real messages. Remove names and phone numbers.
- Write the right answer next to each one.
- Run them through Laya and count the matches.
Decide your passing score before you test. Example: 18 out of 20 may be fine for sorting leads, and 19 out of 20 for a spam filter. Twenty messages is a quick check. Use 100 or more before you sell it to anyone.
Step 6. Train it if the score is low
Laya can learn from your own examples. Put them in a CSV file with two columns, text and label. First check that it reads the file right:
.venv/bin/laya-train --data tickets.csv --out ./my-checkpoint --dry-runThe dry run only prints counts. Remove --dry-run to train for real. The README says this is where most of the value is. It also says to test on messages the model did not train on.
Do not skip that test. One user reported that training on about 1,100 examples left the model no better than a random guess with the default settings. That issue is still open (#963).
Where can you use Laya in your business?
Here are the five decisions again, with what happens next. The "what happens next" column is an example.
| Decision | The two answers | What happens next (example) |
|---|---|---|
| Is this lead qualified? | Hot or cold | Hot: alert sales and offer a call. Cold: add to the newsletter. |
| Billing or support? | Billing or support | Send it to the right inbox. |
| Urgent or normal email? | Urgent or normal | Urgent: ping the team now. Normal: reply within a day. |
| Is this customer interested? | Interested or not | Interested: send the price list and follow up. Not: stop messaging. |
| Genuine or spam? | Genuine or spam | Genuine: carry on. Spam: hide it. |
Billing or support, urgent email and spam have ready-made presets in Laya that come close (triage, email and moderation). Lead and interest you write yourself, like in Step 3.
One rule: when Laya is unsure, send it to a human
Laya gives a confidence number with every answer. Set a cut-off. Below it, a person decides.
res = router.predict(lead, questions, min_confidence=0.85)
ans = res["answers"]["lead"]
if ans.get("low_confidence"):
send_to_a_human(lead) # your own function
else:
act_on(ans["choice"]) # your own function0.85 is the README's example. Pick your own number from your own test. The README says Laya is over-confident as shipped, so a guessed cut-off will not hold.
One more thing. Let Laya route a refund request. Do not let it approve the refund. Keep big actions with a person or your own rules.
What can you build and sell to clients?
This is how I use Laya now: I build systems like these for clients and sell them. I have delivered this kind of work for real estate, telecom and fintech clients. Here are three you can package.
1. Lead qualifier
- What it does. Reads every new enquiry from a form, WhatsApp or DM. Marks it hot or cold. Alerts sales about the hot ones.
- Who buys it. Any business with more enquiries than the team can read quickly, like real estate teams and agencies.
2. Ticket router
- What it does. Reads each support message. Sends billing to accounts and problems to support. Flags angry customers first.
- Who buys it. Support teams with a busy inbox, like telecom, fintech and software companies.
3. Spam filter
- What it does. Hides junk and fake enquiries from contact forms, inboxes and communities.
- Who buys it. Any business with an open contact form, plus marketplaces and community managers.
How to package it
Sell it in two parts: setup once, then monthly care.
- Setup. Connect it to the client's form or inbox. Write the questions in plain words. Test on 20 to 100 of their real messages. Set the "send to a human" rule. Show them how it works.
- Monthly care. Check the human queue. Fix wrong answers. Test again when their business changes. Keep the machine running.
| Package | Setup, one time | Monthly care |
|---|---|---|
| Lead qualifier | Rs 20,000 | Rs 4,000 |
| Ticket router | Rs 25,000 | Rs 5,000 |
| Spam filter | Rs 10,000 | Rs 2,000 |
These are example numbers. They are not a price list and not client results. Change them to fit your market.
Example math. A team spends 2 hours a day sorting messages. At Rs 300 an hour, that is Rs 600 a day, or about Rs 15,600 over 26 working days. A Rs 4,000 monthly care plan costs about a quarter of that.
Two selling points are real. There is no per-token bill, so your cost does not grow with every message. And the model runs on a machine you control, so client messages do not have to go to an outside AI service.
Sell the result, not the model. Your client does not care what is inside. They care that every lead gets a reply in seconds.
FAQ
Does Laya replace Claude or Codex?
No. Use Laya for small decisions that repeat all day. Keep Claude and Codex for writing, coding and hard thinking.
Is Laya really free?
The code and the model are open source under Apache 2.0, and there is no per-token bill. You still pay for the computer, the power and your own time.
Can I run Laya on a laptop?
Yes, on a Mac with Apple Silicon or a laptop with an NVIDIA graphics card. In the jevbench test, Laya ran on an Apple Silicon Mac. A weak server with no graphics card is very slow, about 49 seconds per answer in one test.
Is Laya better than Jev?
Not always. Laya was about 6.5 times faster and scored higher on news headlines. Jev won the other two tests, including the 77-category one.
Does Laya work in Hindi?
The README says Laya handles 100+ languages and shows a Hindi example. English is stronger in its own benchmark. Test it on real messages in your language first.
What if Laya gets one wrong?
Set a confidence cut-off from your own test. Below the cut-off, send the message to a person. Never let one decision approve a refund or delete data on its own.
Want this built for your business? I design and build systems like these. Book an AI Strategy Call and bring your messy inbox.
Sources
- Laya repository and README. Licence, setup commands, presets, confidence cut-off, limits and the training notes. Checked 7 October 2026, version 0.3.28, 31,000+ stars.
- Laya model on Hugging Face. The English model that downloads on first use.
- jevbench results. Time, accuracy and cost on AG News, SST-2 and Banking77, 500 examples each.
- Flowtivity's test of Laya. About 49 seconds per answer on a 4-core server with no graphics card.
- Laya issue #963. Training on a small data set can end at a random guess.
- TypeSafe's Jev introduction. What Jev is.
Checked 7 October 2026. The example messages and the example prices are illustrations, not client results. I did not run my own benchmark for this guide.
// Free newsletter
I send out guides like this every week
Real setups, real sources, no hype. Drop your email and I'll send you the next one.
