Menu

1 / 2

I built react-native-llm-meter, LLM cost tracking for Expo apps

DEV Community·Ankit Virdi·6 months ago
#1ZSJewzq
#reactnative#llm#ai#meter#react
Reading 0:00
15s threshold

If you ship Claude, GPT, or Gemini calls from a React Native app, you have a problem nobody's solved well, you don't know what's happening on the device.

Server-side observability is excellent. Langfuse, Helicone, LangSmith, Stripe's token-meter all work amazingly for Node backends. None of them work cleanly in an Expo app they assume a server, they pull Node only APIs they don't ship AsyncStorage adapters and streaming breaks under Hermes.

So I built it.

react-native-llm-meter is on npm. Currently three providers, two storage adapters, streaming TTFT, dev overlay, budget alerts, optional remote sink.

npm install react-native-llm-meter @react-native-async-storage/async-storage

Enter fullscreen mode

Exit fullscreen mode

import { Meter , MeterProvider } from " react-native-llm-meter " ; import Anthropic from " @anthropic-ai/sdk " ;

const anthropic = new Anthropic ({ apiKey : process . env . EXPO_PUBLIC_ANTHROPIC_API_KEY }); const meter = new Meter (); const client = meter .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.