This project is an FAQ Generator API built using Next.js and GPT-4o, designed to create precise and relevant FAQs based on input topics. The API is rate-limited using the @unkey/ratelimit package, ensuring controlled access to the service.
- Generate FAQs with GPT-4o models for any topic.
- Rate-limiting with Unkey to manage API request quotas within a specific window.
- Node.js (>= 18.x.x)
- Project API Key for GPT-4o from OpenAI
- Unkey root key
Clone the repository and install the dependencies:
git clone https://github.com/Ionfinisher/askiq.git
cd askiq
npm installChange the .env.example to .env.local in the project root and set the following environment variables:
# OpenAI project API Key
OPENAI_PROJECT_KEY=your-openai-project-key
# Unkey rate-limiting secret
UNKEY_ROOT_KEY=your-unkey-root-keyAfter configuring the environment variables, start the development server:
npm run devThe API will be available at http://localhost:3000/api/v1/askiq.
Generate an FAQ for a given topic.
Method: POST
Request Body:
{
"topic": "your-topic-here"
}Response:
{
"faqs": [
{
"question": "Question 1",
"answer": "Answer 1"
},
...
]
}The API is rate-limited using unkey. Users are limited by request quotas per 10 seconds. You can customize this limit in your configuration.
The API returns the following error codes:
400 Bad Request: Missing or incorrect parameters.
429 Too Many Requests: Rate limit exceeded.
500 Internal Server Error: Server issues (e.g., OpenAI API issues).
This project is licensed under the MIT License. See the LICENCE file for details.