-
Notifications
You must be signed in to change notification settings - Fork 17
feat(cookbooks): add cookbook for building an ai chat app #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(cookbooks): add cookbook for building an ai chat app #114
Conversation
WalkthroughAdds a new Developer Resources cookbook MDX tutorial that documents building an AI chat app with usage-based billing (Dodo Payments + AI SDK), including backend and frontend code samples, env/config snapshots, and troubleshooting. Updates Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Frontend as Frontend UI
participant Server as Backend (/chat)
participant AI as AI SDK / Model
participant Dodo as Dodo Ingestion (ai_chat_usage)
User->>Frontend: Type message & customerId, send
Frontend->>Server: POST /chat { message, customerId }
Note over Server: Validate input\nInit AI client with metering
Server->>AI: Generate response (stream or sync)
AI-->>Server: Response + tokens_used
Server->>Dodo: Ingest meter event `ai_chat_usage` (token_count)
Server-->>Frontend: 200 { reply, tokenUsage }
Frontend-->>User: Show reply and per-message tokens
alt Invalid input
Server-->>Frontend: 400 Bad Request
Frontend-->>User: Validation error
else Server/AI error
Server-->>Frontend: 500 Server Error
Frontend-->>User: API error
end
Estimated code review effortπ― 3 (Moderate) | β±οΈ ~20 minutes Poem
Pre-merge checks and finishing touchesβ Passed checks (3 passed)
β¨ Finishing touches
π§ͺ Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
β Files ignored due to path filters (8)
images/cookbooks/ai-chat-app/aggregation.png
is excluded by!**/*.png
images/cookbooks/ai-chat-app/ai-chat-demo.png
is excluded by!**/*.png
images/cookbooks/ai-chat-app/create-meter.png
is excluded by!**/*.png
images/cookbooks/ai-chat-app/first-message.png
is excluded by!**/*.png
images/cookbooks/ai-chat-app/free-tier-test.png
is excluded by!**/*.png
images/cookbooks/ai-chat-app/meter-configuration.png
is excluded by!**/*.png
images/cookbooks/ai-chat-app/meter-event.png
is excluded by!**/*.png
images/cookbooks/ai-chat-app/product-pricing.png
is excluded by!**/*.png
π Files selected for processing (2)
developer-resources/build-an-ai-chat-app-with-usage-based-billing.mdx
(1 hunks)docs.json
(1 hunks)
π§° Additional context used
π Path-based instructions (2)
**/*.{md,mdx}
π CodeRabbit inference engine (.cursor/rules/mintlify.mdc)
Every documentation page must begin with YAML frontmatter containing title and description
Files:
developer-resources/build-an-ai-chat-app-with-usage-based-billing.mdx
**/*.mdx
π CodeRabbit inference engine (.cursor/rules/mintlify.mdc)
**/*.mdx
: Use clear, direct language appropriate for technical audiences
Write instructions in second person (you)
Use active voice over passive voice
Use present tense for current states and future tense for outcomes
Maintain consistent terminology across documentation
Keep sentences concise while preserving necessary context
Use parallel structure in lists, headings, and procedures
Lead sections with the most important information (inverted pyramid)
Use progressive disclosure: introduce basics before advanced topics
Break complex procedures into numbered steps using /
Include prerequisites and context before instructions
Provide expected outcomes for each major step
End sections with next steps or related information
Use descriptive, keyword-rich headings for navigation and SEO
Focus on user goals and outcomes rather than system features
Anticipate common questions and address them proactively
Include troubleshooting for likely failure points
Provide multiple pathways (beginner vs advanced) when appropriate, with an opinionated recommended path
Use for supplementary information that supports main content
Use for expert advice, shortcuts, or best practices
Use for critical cautions, breaking changes, or destructive actions
Use for neutral background or contextual information
Use for success confirmations or achievement indicators
Use to present the same concept in multiple languages
Provide complete, runnable code examples with language specified and filename when relevant
Include RequestExample/ResponseExample blocks for API endpoint docs
Document API parameters using (path, query, header, body) with types and required/defaults
Document API responses using with names, types, and required flags
Use for nested object properties or hierarchical information
Use / for platform-specific or alternative approaches
Use / for suppl...
Files:
developer-resources/build-an-ai-chat-app-with-usage-based-billing.mdx
π Description
Added a cookbook for building an AI chat app using AI-SDK and LLM Blueprint
π― Type of Change
π What documentation does this PR affect?
β Checklist
mintlify dev
docs.json
(if applicable)π§ͺ Testing
πΈ Screenshots (if applicable)
π Related Issues
Closes #
π Additional Notes
π₯ Reviewers
@dodopayments/documentation-team
Summary by CodeRabbit