惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
N
Netflix TechBlog - Medium
V
Visual Studio Blog
博客园 - Franky
小众软件
小众软件
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享
量子位
大猫的无限游戏
大猫的无限游戏
人人都是产品经理
人人都是产品经理
V
V2EX
The Cloudflare Blog
月光博客
月光博客
Last Week in AI
Last Week in AI
雷峰网
雷峰网
WordPress大学
WordPress大学
博客园 - 【当耐特】
博客园 - 聂微东
IT之家
IT之家
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

Thoughts while building

OpenFreeMap survived 100,000 requests per second Investigating AI Manipulation in Viral Chinese Paraglider Video The curious case of the packageManager field in package.json 2nd stage of the AI age: AI Labs Need Your Data TIL: Get file list from eslint, biome and ruff TIL: CSS-in-JS modules for SolidJS TIL: Auth provider updates Understanding Round Robin DNS First month of OpenFreeMap Is there now a generation of users who never worked with files? Comparing Auth from Supabase, Firebase, Auth.js, Ory, Clerk and others
TIL: Vercel AI SDK - the bloat king
Zsolt Ero · 2024-12-11 · via Thoughts while building

I was looking for a simple universal JS lib that could handle OpenAI/Anthropic/Google responses without having to install each client lib. Considering all these do is JSON requests, those client libs are actually quite big - for example, OpenAI is 87 kB on its own (bundled with Vite), though Google is only 25 kB.

From what I've seen, there's one universal library from Vercel called AI SDK. It has 870k weekly downloads on NPM and a fancy package name: just "ai" (I wonder how much that one cost).

It's split into 2 packages, and the "Core" one sounds promising! So how much does this "Core" add to the bundle when using it for just a single OpenAI request?

A whopping 186 kB! For a tool that simply calls an OpenAI endpoint. What is basically just a JSON request.

I really don't get Vercel and the whole ecosystem they built with VC money. Everything they do is the most overcomplicated, architecture-astronaut level stuff. Like here, just the "packages" subdir is 73 thousand lines of code. For a JSON API wrapper!

I mean, the "bad guys" story would be: let's create extremely bloated JS libs so that you'll pick our solutions which allow you to run these on our servers. But I really don't think this is the case - it's just that Vercel's company culture is all about overcomplicating everything.

I've read from many devs that you choose Vercel for the amazing DX, but I just really don't see that DX. Luckily, I haven't had to refactor Next.js codebases every year, but even from what I've seen, everything they do is the opposite of great DX.

Anyway, back to my original quest - I haven't found any minimalistic, universal JS lib that supports streaming from multiple providers, so I'll be writing it myself using the low-level "eventsource-parser" lib.

Has anyone found anything for this purpose?

Discussion about this post

Ready for more?