This project provides a simple API wrapper for interacting with the Gemini Flash model. It's designed to be easy to use and integrate into your applications.
To get started, clone this repository and install the dependencies:
git clone https://github.com/asraf/gemini-flash-api.gitAnd then install the required by running this command:
npm install
You can run the API using TS Node JS:
npm run devThe API will then be accessible at http://127.0.0.1:3000.
This endpoint allows you to send a prompt to the Gemini Flash model and receive a generated response.
Request Body:
{
"prompt": "Your prompt goes here."
}Response:
{
"response": "The generated text from the Gemini Flash model."
}Example using curl:
curl -X POST -H "Content-Type: application/json" -d '{"prompt": "Tell me a short story about a brave knight."}' http://127.0.0.1:3000/generate-textThe API uses environment variables for configuration, particularly for your Gemini API key.
GEMINI_API_KEY: Your Gemini API key for accessing the Gemini model.
You can set this in your environment or create a .env file by running this command:
cp .env.example .env
And then, fill the GEMINI_API_KEY with your own Gemini API key
GEMINI_API_KEY=YOUR_GEMINI_API_KEY_HERE