TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Rust Interface for AI APIs Such as OpenAI, DeepInfra, and Google

1 pointsby huijzer3 months ago
I read about ingesting PDFs in Google Gemini here on HN last week [1]. This and some other thoughts that I had on AI [2] made me want to create a summarize PDF command line utility. Just point the utility to a PDF and get a summary back. However, I personally prefer to write CLI tools in Rust since those binaries are fast, small, and easy to distribute via `cargo install` (or `cargo binstall`). So that was a problem. I wanted to use a cloud provider since my system doesn&#x27;t have enough RAM for most state-of-the-art models, but at the same time, I didn&#x27;t want to require users of the tool to use the same API provider as me.<p>That&#x27;s why I created the `transformrs` Rust library [3]. The name is from &quot;transform&quot;, which is essentially what AI models do, and &quot;Rust&quot;. It is also a nod to the transformers algorithm.<p>To allow for proper testing in CI, I considered to make a mock endpoint that I could run my tests against. However, AI APIs are so cheap nowadays that I figured I could just as well run the tests against the actual endpoints. So that is what currently happens. Locally and in CI I have set up 5 different API keys and I run multiple tests against all of these endpoints, so that&#x27;s about 30 requests each time (tests run in 10 seconds). I change a file or each push to CI. It&#x27;s incredible how stable these endpoints have become. 18 tests check whether the prompt &quot;This is a test. Please respond with &#x27;hello world&#x27;&quot; actually responds with &quot;hello world&quot; and so far &gt;99% of the times it does. CI is way less flaky than I would have expected.<p>In any case, I hope people will find the library useful. I&#x27;m curious for feedback and suggestions.<p>[1]: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=42952605">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=42952605</a><p>[2]: <a href="https:&#x2F;&#x2F;huijzer.xyz&#x2F;posts&#x2F;ai-learning-rate&#x2F;" rel="nofollow">https:&#x2F;&#x2F;huijzer.xyz&#x2F;posts&#x2F;ai-learning-rate&#x2F;</a><p>[3]: <a href="https:&#x2F;&#x2F;github.com&#x2F;transformrs&#x2F;transformrs">https:&#x2F;&#x2F;github.com&#x2F;transformrs&#x2F;transformrs</a>

no comments

no comments