AI Engineer World's Fair 2025
fun stories from building OpenRouter and where all this is going
Read the talk
Building OpenRouter: from model choice to an inference marketplace
OpenRouter grew from a question about winner-take-all AI into a marketplace whose hardest problems include provider differences, streamed middleware, and cancellation.
From a talk by Alex Atallah
Before you start: Familiarity with language-model APIs and streamed responses will help with the middleware and provider-routing examples.
Will inference be winner-take-all?
Will one company supply the intelligence behind almost every application? After ChatGPT arrived in late 2022, Alex Atallah began investigating that question. OpenAI had a commanding lead, and inference looked to him like a contender for the largest market in software. At the beginning of 2023, he started building prototypes with alternative models and exploring open source. OpenRouter began as that experiment before becoming a marketplace.
The first evidence for model choice came from moderation. In January, users wanted to understand which outputs a provider allowed and whether their application risked being deplatformed. Consider a detective novel that reaches chapter four: the detective encounters a murder involving a shooting, and OpenAI sometimes refuses to continue—or leaves the author unsure whether continuing would violate its terms. Role-play exposed the same uncertainty across a broader range of interactions. A model could lead on capability and still fail to meet a particular user's requirements.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Open weights arrive before usable infrastructure
Early alternatives included BLOOM 176B and Facebook's OPT. They attracted experimentation, but practical usefulness remained limited. Atallah's informal audience poll captures how narrow that early community was: roughly ten people raised their hands for BLOOM and five for OPT. Then Meta released LLaMA 1 in February 2023.
The LLaMA paper reported that LLaMA-13B outperformed GPT-3 175B on most benchmarks. The parameter sizes made this striking: a much smaller model offered a path toward laptop inference instead of requiring the expensive server infrastructure associated with the larger model. But benchmark performance did not make LLaMA a ready replacement for a chat assistant. It was primarily a text completion model, local execution was difficult, and the supporting infrastructure was immature.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Alpaca makes a long tail imaginable
The turning point for Atallah was Stanford's March 2023 release of Alpaca. Its recipe transferred instruction-following behavior into an already pretrained smaller model:
- Generate instruction demonstrations with
text-davinci-003, the teacher Atallah describes broadly as GPT-3. - Fine-tune LLaMA 7B on those demonstrations.
- Expose the resulting model's learned behavior through inference.
Stanford reported demonstration generation below $500 and fine-tuning below $100; the combined below-$600 figure excluded base-model pretraining. The distinction matters: this was an inexpensive way to adapt existing weights, not to train a foundation model from scratch.
Atallah saw both style and knowledge moving from a large model into a small one. Instead of assuming that creating a useful model required a $10 million training budget, developers could begin imagining their own data delivered as a language-model service. That made a future with tens or hundreds of thousands of specialized models plausible to him.
But distributing weights did not solve discovery. Seven billion floating-point numbers do not tell a developer which tasks a model handles well or how to use it. Open weights can still be opaque in behavior. Even Alpaca had reached only a small portion of this audience: Atallah counted roughly twelve raised hands. OpenRouter's initial purpose was to collect these models in one place and help people understand what they could do.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Let the user choose the intelligence
Before building the marketplace, Atallah tested a more direct question: could a user bring a preferred model to a website whose developer had never chosen that model? In April 2023, he launched Window AI, an open-source Chrome extension that let the user select the model while the web application consumed it. The demonstration used Together's deployment of GPT-NeoX to replace OpenAI inside a webpage. The application and its source of intelligence could be selected independently.
OpenRouter launched the following month. Atallah co-founded it with Louis, the founder of Plasmo, the framework used to build Window AI. It began as a collection of models and a way to understand their uses, then expanded toward better prices, better uptime, no subscription, and more choice. Atallah reports 10–100% month-over-month growth over the preceding two years, without naming the growth metric. Its public rankings also became a way to see which models developers were using and how that usage changed.
The developer proposition was one paid API with near-zero interface switching costs between models. At talk time, Atallah reported over 400 models and over 60 active providers. OpenRouter accepted multiple payment methods, including crypto, and took on the work of normalizing tool calls and caching across providers. The original collection and usage-data explorer was becoming infrastructure for using the models, not just finding them.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
The same model becomes a marketplace
Initially, an open model might have only one or two providers on OpenRouter. A primary provider handled requests; a fallback covered failures. The providers were not even named. As more companies began hosting the same weights, that arrangement stopped expressing the choices developers faced. Providers differed in both economics and supported behavior:
| Dimension | Provider differences |
|---|---|
| Price and performance | Different prices, latency, and throughput |
| Sampling | Some supported min-p; most did not |
| Caching | Available on some deployments |
| Tool calling | Supported on some deployments |
| Structured outputs | Supported on some deployments |
Selecting the model was no longer enough. A developer also needed an appropriate deployment of that model. Aggregating those deployments at different prices turned OpenRouter into a marketplace.
Atallah gives LLaMA 3.3 70B Instruct as an example with approximately 23 providers on OpenRouter. Closed models created a related opportunity when their services could not keep up with demand: aggregating providers gave developers additional routes to obtain the same model and improved availability. Real-world latency and throughput graphs helped developers evaluate the alternatives for both open and closed models.
The surrounding product made those choices easier to inspect. Developers could compare models using their own prompts with an interaction Atallah likens to texting in iMessage. Fine-grained privacy controls, API-level overrides, and consolidated usage observability brought model selection, data policy, and monitoring into the same workflow.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Different models, interchangeable supply
The platform's traffic led Atallah away from a winner-take-all forecast. Atallah reports that Google Gemini grew from roughly 2–3% to 34–35% of OpenRouter's processed tokens over about twelve months, beginning in June of the previous year. Anthropic was also highly popular, and OpenAI grew too. These are platform token shares, not global market shares: Atallah says OpenAI was underrepresented because developers often came to OpenRouter to obtain an OpenAI-like interface for other models.
Two ideas fit together here. Model choice remains diverse, while serving a particular model can become a commodity. Customers use different models for different purposes. But Claude served through Bedrock should look the same to an application as Claude served through Vertex, even when the providers offer different rates and performance. Making that interface consistent lets a developer choose inference supply without rewriting the application around the supplier.
Atallah expects inference to become a dominant operating expense, making selection and routing increasingly consequential. He also describes model usage as sticky: the number of active models kept growing rather than each new release simply replacing its predecessor. The engineering goal was therefore to make an expanding, heterogeneous ecosystem easier to use through a consistent interface.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Middleware on both sides of inference
The next problem was adding capabilities across models. OpenRouter did not have an MCP marketplace at the time of the talk, but it wanted features such as web search and PDF parsing to work across its model catalog. Atallah characterizes the MCP usage he was considering then as pre-flight access to APIs and behaviors. OpenRouter also needed to transform results on their way back to the user. That additional requirement suggested middleware, familiar from authentication and caching in web frameworks such as Next.js.
A plugin could call MCPs internally, then augment the inference result on the return path. The web-search example makes the distinction concrete: search supplies information to the model, while output processing adds web annotations to the response. Atallah describes those annotations arriving as results stream to the user, without waiting for all tokens to be generated.
In TypeScript, an asynchronous generator expresses the return-path mechanism directly. Here, a search result carries a sourceId; response chunks retain their text while middleware attaches annotations for cited sources:
typescript
type SearchResult = {
sourceId: string;
title: string;
};
type Chunk = {
text: string;
citedSourceIds: string[];
};
type AnnotatedChunk = Chunk & {
annotations: SearchResult[];
};
async function* annotateStream(
chunks: AsyncIterable<Chunk>,
results: SearchResult[],
): AsyncGenerator<AnnotatedChunk> {
const sources = new Map(
results.map((result) => [result.sourceId, result]),
);
for await (const chunk of chunks) {
const annotations: SearchResult[] = [];
for (const id of new Set(chunk.citedSourceIds)) {
const source = sources.get(id);
if (source) annotations.push(source);
}
yield { ...chunk, annotations };
}
}
This expresses the middleware pattern rather than OpenRouter's internal plugin contract. Each incoming chunk can produce an annotated outgoing chunk; the function never collects the entire response. The key architectural capability is interception on the return path as well as preparation before inference.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
A dropped stream is not necessarily canceled inference
A common interface also has to account for operational differences. Atallah reports approximately 30 ms latency after extensive custom caching, but does not specify measurement boundaries, percentile, region, or request conditions. He believes the result is industry-leading; the talk does not establish a comparative benchmark or a complete model-response latency.
Cancellation is a particularly consequential difference because stopping delivery does not necessarily stop billing. Atallah describes three reported outcomes after the client drops the stream:
- Full completion billed: the provider charges for the entire completion.
- Not the full completion: the provider does not charge for the entire completion; the talk does not specify the exact cutoff.
- Additional unseen tokens: the provider bills for tokens the client never receives—twenty in his example.
These charges do not by themselves establish whether or when generation stopped. Standardizing streaming therefore requires investigating each provider's cancellation and billing semantics, then determining when those differences matter to developers. A uniform stream format alone cannot resolve them.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Extending the interface to images
Standardizing models and providers had become a substantial architecture problem. The next planned expansion was into additional modalities, including language models that generate images. Atallah uses “transfusion” to describe a combination of transformers and diffusion, loosely invoking Stable Diffusion. The related Transfusion research combines next-token prediction and image diffusion within one transformer; the approach does not inherently require the Stable Diffusion product.
The expected benefit was richer world knowledge in generated images and the ability to converse about an image while creating or changing it. Atallah illustrates the possibility with a secondhand customer story about generating a whole menu for a delivery app. He does not identify the model or show its output. The example points toward the kind of multimodal application he expected to become significant in the coming year.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Route to the right GPU, discover the right model
More powerful routing was also on the roadmap. Geographic routing was minimal at talk time; Atallah wanted to route requests to the right GPU in the right location and add enterprise-level optimization. That extends provider selection beyond a model name and a price to the infrastructure serving the request.
Better prompt observability and finer model categorization would make selection more specific too. Instead of asking for the best model in general, a developer might ask which models best turn Japanese instructions into Python code. That is a discovery problem organized around a concrete input, task, and output.
Atallah closes with the promise of better prices and an invitation to build a durable ecosystem through collaboration. Low vendor lock-in is the connecting goal: applications should be able to choose useful intelligence, obtain it from suitable infrastructure, and keep changing those choices as models and providers evolve.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Resources
From the talk
Original LLaMA paper describing its model family and comparison with GPT-3.
Training recipe, cost breakdown, preliminary evaluation, and limitations of Alpaca 7B.
Browser extension source and integration instructions for applications using user-selected AI models.
Live model usage rankings based on tokens processed through OpenRouter, with measurement methodology.
Further reading
- TransfusionPaper
Research combining text prediction and image diffusion in a single multimodal transformer.
Updates since the talk
Current controls for provider selection, fallbacks, performance preferences, and data policies.
Current instructions for adding web search and citation annotations to model responses.
Read the complete timestamped transcript
- 0:00
[upbeat music]
- 0:25
All right. When I started OpenRouter at the beginning of 2023, I had one major question in mind. I was looking at this new market that was coming online and, and it was incredible.
- 0:38
Like, at the, the very end of, uh, 2022, we all saw ChatGPT, and I got bitten by the AI bug. Um, and I decided to look into answering this question: Will this market be winner take all?
- 0:52
Inference might be the largest market ever in software, and this seemed like a critical thing that everybody was assuming the answer to, the answer to it would be yes.
- 1:02
Um, OpenAI was just far and away the leading model. There were a few others that were coming up on its tail, and I, I built a couple prototypes to look into what they could be g- used for, and also wanted to investigate open source.
- 1:19
So in this talk, which Swix named, um, I'm gonna talk about the founding story of OpenRouter and, uh, and go through a little bit of the hoops that we jumped through and sort of the investigation that we did as we, we put together this product that started as an experiment and kind of evolved into a marketplace over
- 1:39
time. In January, we saw the first signs of people wanting other types of models, and the, the first evidence was moderation.
- 1:55
This, this was like a very clear interest from users in looking for models where they could understand why, whether they'd be deplatformed or what the, the moderation policy of the company was.
- 2:07
And, and we saw some people, like, generating novels where, like, it would be a detective story and in chapter four, um, the detective would find someone who, like, commits a murder and shoots the victim.
- 2:20
And, and OpenAI at the time sometimes refused to generate that output, or it was, like, questionably against the terms of service. And of course, we saw role play and a, and basically a big gray area emerge around what models were willing to generate.
- 2:38
So, uh, in, in the next month, we saw the open source race begin. And that... Uh, I'm gonna do a little bit of an OG test here. Uh, raise your hand if you ever used BLOOM 176B.
- 2:56
There's like... Ah, there's like 10 hands raised. Um, or OPT by Facebook. This was like one of the earliest open source language models. About five hands raised. Uh, there were a couple of these emerging, and there were some very interesting projects to help people access them.
- 3:13
And, uh, and, and early days, they weren't really useful for very much. So, uh, we kept digging and, uh, and eventually, like, the open source community, um, rou- like, ran into Meta's first launch, which was LLaMA 1 in, in February.
- 3:34
And LLaMA 1, in their abstract, advertised that it outperformed GPT-3 on most benchmarks, you can see the highlighted part here, which blew everyone away. This was huge. An open-weights model better than GPT-3.
- 3:50
And, uh, and especially a smaller model. This was the 13 billion parameter version, one that you could run on your laptop, um, outperforming a large server-only, only like, you know, tons of money required to run inference company's model.
- 4:07
It, and it was beating it on some benchmarks. Everyone lost their minds. And LLaMA kicked off a huge storm. It still was not very useful, I have to say.
- 4:18
It was like a text completion model for the most part, and it was very difficult to run locally. The infrastructure just wasn't there. Um, and people were struggling to figure out what to do with it.
- 4:29
Which is when we found, when we had the greatest moment of all, I think, for the birth of the long tail of language models, which was the first successful distillation in March of 2023: Alpaca.
- 4:45
Uh, a group at Stanford took LLaMA 1, generated a bunch of outputs on GPT-3, and fine-tuned LLaMA 1 on those outputs and created Alpaca for less than $600 in to- like, total.
- 4:59
And this was an incredible moment. It was the first time I saw the transference of both style and knowledge from a large model onto a small one. And this me- this was a huge unlock 'cause it meant that not only do you not need a $10 million training budget to create your own models, but you could also
- 5:19
for the first time make unique data available as a service in the form of a language model.
- 5:26
And I immediately began to wonder, like, well, w- what are... There's, there's gonna be tens of thousands of these, maybe hundreds of thousands. Um, and they seem incredibly important.
- 5:37
This is knowledge finally being distilled into software. Uh, there needs to be a place on the internet to discover these and understand what they do. 'Cause even this open-weights model was still closed in a way.
- 5:49
It's a black box. You get seven billion floating point numbers. You don't know what it's good at or what to do with it. Ve- uh, very few people used Alpaca.
- 5:58
Raise your hands if you used Alpaca.
- 6:02
I see about fif- maybe 12. So it's, like, only double the number of people who used the, like, almost unusable open source models on the previous slide. So OpenRouter initially started as a place to collect all these things.
- 6:20
Um, but before we got there, I wanted to check out people's willingness to bring their own model to generic websites. Like, what if the developer didn't even know which model a user wanted to use?
- 6:34
How would a user bring their choice of model to the software that they want?
- 6:40
And, uh, in April, I launched Window AI, which was a, an open source Chrome extension, uh, that let a user choose their model and let a web app just kind of suck it in.
- 6:54
And so you can see from the Chrome extension here, if you look really closely, um, this user is using Together's open source deployment of GPT-Next.
- 7:07
I can't, I can't read it from the- here. But, like, an open source model that, um, swaps out OpenAI directly inside the webpage.
- 7:17
So the next month, OpenRouter launched. And, uh, I, uh, co-founded it with the founder of the framework that, that Window AI was built on, Plasmo, um, Lewis. And we started OpenRouter as first a place to collect all the models in one spot and f- and help people figure out what to do with them.
- 7:39
And it eventually grew into a place that gives you the, like, better prices, better uptime, no subscription, and, uh, and the most choice for figuring out which intelligence your so- your, uh, software should run.
- 7:55
So let's talk a little bit about what it is, 'cause not everyone here might be familiar with it. Um, we, we have been growing ten to 100% month over month for the last two years.
- 8:09
It is an API that lets you access all language models and, uh, and it, it's also become kind of the go-to place for data about who's using which model, um, and how that is changing over time, which you can see on our public rankings page here.
- 8:26
It's a single API that you pay for once. You get near zero switching costs to go from model to model.
- 8:33
Uh, and we have about 400, over 400 models, over 60 active providers, and, uh, you can buy with lots of different payment methods, including crypto. And, and we basically do all the, the tricky work of normalizing tool calls and caching for you so that you get the best prices and the most features, uh, and you don't have
- 8:53
to worry about what the provider supports. Another story. Initially, OpenRouter was not a marketplace really. It was just kind of a collection of all the models and a way to explore data about who was using each one.
- 9:07
So how did we get here? Initially, when the first open source models emerged, uh, we only had, like, one or two providers for each one, and so we had, like, a primary provider and a fallback provider.
- 9:21
And i- initially that was it, and, and we didn't even name the providers. Um, but it became clear that there were going to be a bunch of companies that wanted to host these provi- these models and at very different prices and performances.
- 9:37
The, the number of features ballooned. Um, there were companies that supported the MinPe sampler and most didn't. There were some that supported caching, some that supported tool calling and structured outputs, and others that didn't.
- 9:49
And suddenly the ecosystem was just ballooning into this kind of out of control heterogeneous monster. And we wanted to tame the monster. So we aggregated all providers in one spot and at different price points it became a marketplace.
- 10:06
And you can see, like, this model, LLaMA 3.3 70B instruct, um, it has one of-- it, it's one of the models with the most providers on the platform. Um, and it has, like, 23.
- 10:20
Um, closed source models also had something interesting happen to them, which is that they just-- they couldn't keep up with the demand. And, uh, and, and so we helped developers basically get uptime boosting, and you can see, like, the delta, uh, and how much we can boost uptime just by aggregating lots of different providers for a model.
- 10:41
And this became really helpful for people using open sour- or closed source. And we became a marketplace for both, um, showing graphs about latency and throughput and helping people figure out using real world data what the latency and throughput is on each model.
- 10:57
Um, and that's how OpenRouter became a marketplace and an-- uh, one optimized for language models, which I thought would be proper for, for inference, po- potentially the biggest market in software.
- 11:11
Uh, you can-- obviously a couple other things that we support, comparing models w- using your own prompts with the ease of just texting an iMessage, um, fine grain privacy controls with API level overrides, the ability to see, like, your usage of all models in one place and have great observability.
- 11:30
And back to the original question here of whether will intelligence be winner take all. Uh, I, I-- we've come to the most likely bet that that is not the case.
- 11:42
Um, here's our data broken down by model author, um, how much-- how many tokens have been processed by each one. And you can see Google Gemini started pretty low, like roughly two, 3% in June of last year, and just has grown to 34, 35%, uh, pretty steadily over the last 12
- 12:06
months. Um, oh, uh, Anthropic, uh, is, is like one of the most popular models on our platform. OpenAI is a little bit underrepresented in this data, um, because a lot of developers use us to get OpenAI-like behavior for all of their models.
- 12:22
But OpenAI has, has grown a lot here as well.
- 12:27
So here's what we believe about the market after all of the, you know, backstory that I just gave you. Um, the future's gonna be multi-model. Ton-- all of our customers, tons of customers use different models for different purposes and realize they can unlock huge gains by doing so.
- 12:46
Inference is also a commodity. Claude from Bedrock, we wanna make look exactly the same as Claude from Vertex. And we do that because, like, the two hyperscalers have fundamentally, uh, you know, the same commodity being delivered at different rates, different performances, and for a developer, you just wanna be able to, like, select that without worrying about who's
- 13:09
serving it. Um, we think inference will be, like, a dominant operating expense, and selecting and routing will be crucial. Um, you can see the number of active models on OpenRouter has just steadily grown.
- 13:23
It's not the case that people just hop from model to model. Like, it tends to be sticky, and, uh, and we tr- what's-- we're trying to just make this wild ecosystem a lot more homogeneous and easier to work with as a developer.
- 13:40
Um, to honor Swyx's title for this presentation, uh,
- 13:46
let's give a technical story, um, something that we've worked on in the process of building the company, and that was our own idea for how to do an MCP within OpenRouter.
- 13:59
So we don't have MCPs. We don't have an MCP marketplace. Um, but we did run into the need to expand inference with new features and new abilities. For example, searching the web for all models, PDF parsing for all models, um, you know, other interesting things coming soon.
- 14:22
And what we really wanted to do was give these abilities to all models, but that involves not just the pre-flight work that MCPs do today, where you can kind of get in-- you know, like call another API, get a bunch of behaviors, and then have the inference process access those behaviors as it goes.
- 14:42
We also need the ability to transform the outputs on the way to the user. And so what we really, really needed was something more like middleware. Middleware, um, is kind of a common concept in web development.
- 14:57
You set up middleware when you're setting up authentication, for example, or, or, or caching for a web app. And so we came up with a type of middleware that's sort of-- that's AI native and optimized for inference, um, and that looks not totally dissimilar from the way middleware looks in, in Next.js or, or web development.
- 15:18
You know, so pardon the code on the screen, but this is a little bit about how our pl- our plug-in system looks, and it, you know, it can call MCPs from inside a plug-in.
- 15:27
But importantly, it can also augment the results on the way back to the user. So here's an example of our web search plug-in, which augments every language model with the ability to search the web.
- 15:40
Um, every language model can just kinda tap into this plug-in and get web annotations as results are being fed back to users in real time, and this all happens in a stream.
- 15:53
See? There's no kind of like, you know, requirement that you get all of the tokens at once. It can just happen in-- live in the stream.
- 16:02
We got-- We solved a bunch of other tricky problems, uh, while building OpenRouter. We, we really wanted to get extremely low latency, um, and we got it down to about thirty milliseconds, uh, the best in the industry, I believe, um, using a lot of custom cache work, and we, we also need to make streams cancelable.
- 16:23
All these different providers have completely different stream cancellation policies. Sometimes if you just drop a stream, the, the, the, the inference provider will bill you for the entire thing.
- 16:35
Sometimes it won't. Sometimes it'll bill you for the next twenty tokens that you never got. And, um, we ki- we, we work a lot to try to figure out these edge cases and understand when developers are going to care about them, too.
- 16:50
And standardizing all these providers and models, uh, became, like, a big tricky architecture problem that we spent a while working on. So here's where all this is going. Uh, we're gonna add more modalities to OpenRouter, and I think this is, like, a big change in the industry as well.
- 17:06
We're gonna start seeing LLMs generate images. We already have, uh, a few examples on the market, but tr-- like, some people call it transfusion models, a transformer mixed with stable diffusion.
- 17:20
Um, these are gonna give images way more world knowledge and the ability to have a conversation with the image, which we think is just critical for growing that industry and making it really work.
- 17:31
Imagine... I just ran into somebody today who is using a transfusion model, uh, or who told me about their customer using a transfusion model to generate menus. Imagine doing that, like, a whole menu, like, in a delivery app generated by a transfusion model.
- 17:48
Um, it's going to be really exciting and, and a big deal in the coming year.
- 17:54
We're also gonna work on much more powerful routing. Like, routing is our bread and butter. And so doing geographical routing right now, we-- it's pretty minimal, but routing people to the right GPU in the right place and doing enterprise-level optimization's coming.
- 18:09
Um, better prompt observability, better discovery of models, like really fine-grained categorization. You know, imagine being able to see, like, the best models that take Japanese and, and create Python code.
- 18:21
And of course, even better prices coming soon. So, you know, we, we believe in, in collaboration, um, and, and building an ecosystem that's durable and with low vendor lock-in.
- 18:34
So, you know, collaborate with us. Um, here's our email, and if you're interested, join us too. [outro music]