@mathewk21/crunchtimeai
v0.2.4
Published
Production-ready React SDK — chatbot UI, AI Gateway client, and React hooks.
Readme
@mathewk21/crunchtimeai
Production-ready React SDK — chatbot UI, AI Gateway client, and React hooks.
Install
npm install @mathewk21/crunchtimeai react react-domChat UI
import { ChatProvider, ChatUI } from "@mathewk21/crunchtimeai/react";
<ChatProvider apiKey="YOUR_KEY" modelSlug="gpt-4.1-nano">
<ChatUI />
</ChatProvider>;ChatClient delegates to the AI Gateway under the hood. Access the full gateway via client.aiGateway.
AI Gateway
Use the gateway directly for text, thinking, image, video, and audio generation:
import { createAIGateway } from "@mathewk21/crunchtimeai";
// or tree-shake gateway-only imports:
// import { createAIGateway } from "@mathewk21/crunchtimeai/ai-gateway";
const gateway = createAIGateway({ apiKey: "YOUR_KEY" });
const { text } = await gateway.text({ model: "gpt-4.1-nano", prompt: "Hello" });
const image = await gateway.generateImage({
model: "nano-banana",
prompt: "A mountain at sunset",
aspectRatio: "16:9"
});
const models = await gateway.listModels();React provider
import { AIGatewayProvider, useAIGateway } from "@mathewk21/crunchtimeai";
function App() {
return (
<AIGatewayProvider apiKey="YOUR_KEY">
<MyComponent />
</AIGatewayProvider>
);
}
function MyComponent() {
const gateway = useAIGateway();
// gateway.text(), gateway.generateImage(), etc.
}Build
npm run build