FastAPI-based API service that generates custom bingo game items using multiple AI providers
Project description
Starferry Documentation
Overview
Starferry is a FastAPI-based API service that generates custom bingo game items using multiple AI providers. The service accepts prompts from users and returns 25 bingo items generated by the selected AI model (OpenAI, Google's Gemini, or Grok).
Pypi Project
https://pypi.org/project/starferry/
Features
- Multi-Provider AI Integration: Generate content using OpenAI (GPT-4o-mini), Google's Gemini (gemini-2.0-flash), or Grok (grok-2-latest)
- Standardized Output Format: Consistently delivers 25 bingo items separated by the '|' character
- Rate Limiting: Built-in IP-based rate limiting (10 requests per 30 minutes)
- API-First Design: Clean REST API with FastAPI
- Cross-Origin Resource Sharing: Configured with CORS support for frontend integration
Setup
Prerequisites
- Python 3.10+
- API keys for the AI providers you plan to use:
- OpenAI API key
- Google Gemini API key
- Grok (XAI) API key
Installation
-
Clone the repository:
git clone https://github.com/JerrySu5379/Starferry.git cd Starferry
-
Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables:
- Copy the
env.examplefile to.env - Fill in your API keys and other required configuration
cp env.example .env
- Copy the
-
Start the server:
python -m src.main
Alternative way to install and run the server
pip install starferry
starferry
The API will be available at http://localhost:8008.
API Documentation
Generate Bingo Items
Generates 25 bingo items based on the provided prompt using the specified AI service.
Endpoint: POST /api/bingo
Form Parameters:
prompt(required): The prompt describing what kind of bingo items to generateservice(required): The AI service to use (options: "openai", "gemini", "grok")
Response:
{
"items": "Item 1|Item 2|Item 3|...|Item 25",
"error": null
}
Rate Limiting: The API is limited to 10 requests per IP address per 30-minute window.
Project Structure
starferry/
├── .env # Environment variables (API keys, configuration)
├── env.example # Example environment file
├── requirements.txt # Python dependencies
├── README.md # Project documentation
├── src/
│ ├── main.py # FastAPI application entry point
│ ├── routers/
│ │ └── bingo.py # Bingo generation API endpoint
│ ├── services/
│ │ ├── openai_service.py # OpenAI integration
│ │ ├── gemini_service.py # Google Gemini integration
│ │ └── grok_service.py # Grok integration
│ └── utils/
│ └── ip_tracker.py # IP-based rate limiting
└── tests/ # Test suite
Architecture
Starferry follows a clean architecture pattern with distinct layers:
- API Layer (routers): Handles HTTP requests and responses
- Service Layer (services): Manages AI provider integrations
- Utility Layer (utils): Provides supporting functionality like rate limiting
The application is designed to be extensible, making it easy to add new AI providers or additional functionality in the future.
Environment Variables
| Variable | Description |
|---|---|
| OPENAI_API_KEY | API key for OpenAI services |
| GEMINI_API_KEY | API key for Google's Gemini services |
| XAI_API_KEY | API key for Grok services |
| SURREAL_DB_URL | SurrealDB connection URL |
| SURREAL_DB_USER | SurrealDB username |
| SURREAL_PASSWORD | SurrealDB password |
| SURREAL_NS | SurrealDB namespace |
| SURREAL_DB | SurrealDB database name |
License
MIT
Contributing
- Name: JerrySu5379
- Email: jerrysu5379@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file starferry-0.1.1.tar.gz.
File metadata
- Download URL: starferry-0.1.1.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8b1efa6efad0d83faf8bee38752126f4ebc035c3d2b2f8237d9b28b11f52aa1
|
|
| MD5 |
fc11a59ca01fa131d7954eb13f96d8d4
|
|
| BLAKE2b-256 |
afdfaea23fd22744a035c3ece0dcfb7666c4e5c93737d529d73bd678faad73a4
|
File details
Details for the file starferry-0.1.1-py3-none-any.whl.
File metadata
- Download URL: starferry-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e361e07615f628a9ad7d28b2679216f0858129e39e087d1db6d602c464406559
|
|
| MD5 |
6c46f068dd45612b49a39a36c8d850e7
|
|
| BLAKE2b-256 |
0b91a28fab94b68e109abbe66d6f7d4e98bd83811e3a6312f902798477e7cef2
|