This repository contains the core engine powering the Askblocks AI Q&A widget. It is a serverless Cloudflare Worker API that takes a prompt and returns a concise answer using a selected AI model.
| Method | Endpoint | Description | Body (JSON) | Response (JSON) |
|---|---|---|---|---|
| POST | /ask |
Sends a prompt to the AI | { "prompt": "your question" } |
{ "answer": "AI-generated response" } |
| GET | /health |
Health check endpoint | β | OK (plain text) |
A demo deployment of this API is available at:
https://api.askblocks.ai
To check if itβs running, call the health endpoint:
GET https://api.askblocks.ai/health
Expected response:
{ "status": "ok" }
π οΈ Note: Only maintainers can deploy to this production endpoint. Contributors donβt need to deployβjust fork, develop, and test locally.
We welcome contributions! Follow these steps to contribute to the Askblocks Core API project:
Fork the repository on GitHub, then clone it to your local machine:
git clone https://github.com/YOUR_USERNAME/askblocks-core.git
cd askblocks-coreUse npm ci to install exact versions from package-lock.json:
npm ci
This project uses the Groq API to power the /ask endpoint via Meta's llama3 model.
- Visit https://console.groq.com/keys (sign in with Google or GitHub).
- Click "Generate API Key" and copy the token.
You can either add the token directly in your wrangler.jsonc file:
Or store it securely using Wrangler secrets:
npx wrangler secret put GROQ_API_KEY
This ensures your API key is not exposed in version control.
To start the local development server on port 8000:
npm run dev
You can now test your changes via:
POST http://localhost:8000/askGET http://localhost:8000/health
Make sure all tests pass before committing:
npm run test
This will lint your code and run unit tests (Jest).
Before creating a pull request, ensure your fork is up to date:
npm run sync
Once you're happy with your changes:
- Push to your forkβs
mainbranch - Open a Pull Request to
askblocks/askblocks-corevia GitHub UI - Make sure the CI passes and follow the PR template
{ "vars": { "GROQ_API_KEY": "your-groq-api-key-here" } }