This guide walks through setting up a Custom GPT that uses Coffee Engine to gate premium features.
- A Coffee Engine instance deployed (e.g., on Vercel)
- Your
COFFEE_API_KEYconfigured - A Buy Me a Coffee account and webhook configured
- Go to ChatGPT Custom GPT Builder
- Click "Create a GPT"
- Configure your GPT's name, description, and personality
- In the GPT editor, go to the "Actions" section
- Click "Create new action"
- Choose "Import from URL"
- Enter your OpenAPI spec URL:
https://your-domain.com/api/openapi
Alternatively, manually configure:
Authentication:
- Type: API Key
- Auth Type: Custom
- Custom Header Name:
X-COFFEE-API-KEY - API Key: Your Coffee Engine API key
Schema: Import from /api/openapi or paste the OpenAPI JSON
Add these instructions to your GPT's system prompt:
``` You are an AI assistant that offers both free and premium features.
Premium features require users to support the project via Buy Me a Coffee.
When a user requests a premium feature:
- Check if they've already verified in this conversation
- If not, explain they need to support and provide their transaction ID
- Use the verifyTransaction action to validate their transaction ID
- If valid, mark them as premium for this session and proceed
- If invalid, explain the issue and offer help
Premium features include:
- Deep code analysis
- Extended problem solving
- Custom implementations
- Personalized reports
Always be helpful and transparent about the premium model.
Buy Me a Coffee link: [Your BMC Link] ```
Upload the knowledge-base.md file to your GPT's knowledge base for detailed integration patterns.
- Start a conversation
- Request a premium feature
- The GPT should prompt for support
- Simulate with a test transaction ID
- Verify the premium feature executes after validation
``` User: Can you analyze my entire codebase?
GPT: I'd love to help with that deep analysis! This is a premium feature that requires supporting the project.
Please visit https://buymeacoffee.com/yourpage to buy me a coffee,
then paste your transaction ID here to unlock premium features.
User: TXN_TEST_999
GPT: [Verifies transaction via Coffee Engine API]
Thank you so much for your support! Your transaction is verified.
Let me dive into that codebase analysis for you now...
[Proceeds with premium analysis]
```
- User may have entered wrong ID
- Transaction might not have been received by webhook yet (wait 1-2 minutes)
- Check your KV storage is configured correctly
- Verify your API key is correct in the Action configuration
- Check that
COFFEE_API_KEYenvironment variable is set
- Verify your webhook URL in BMC dashboard:
https://your-domain.com/api/webhooks/bmc - Check
WEBHOOK_SECRET_BMCis configured - Use BMC's "Send test" feature to debug
- Customize premium feature definitions
- Adjust token TTL in configuration
- Add more payment providers
- Implement MCP integration for local AI clients