A production-ready API endpoint that receives project requests, generates web applications using LLMs, creates GitHub repositories, and submits evaluations automatically.
- API Endpoint: Accepts JSON POST requests with project briefs
- LLM Code Generation: Generates minimal web applications using OpenAI/Anthropic
- GitHub Integration: Automatically creates repositories and pushes code
- GitHub Pages: Enables and deploys applications to GitHub Pages
- Evaluation Submission: Posts results with exponential backoff retry logic
- Security: Secret validation and no secrets in git history
- Logging: Comprehensive logging for debugging
- Python 3.8+
- Git installed and configured
- GitHub account with Personal Access Token
- OpenAI or Anthropic API key
- Secret shared in Google Form
git clone <your-repo-url>
cd llm-code-deploymentpip install -r requirements.txtOr use a virtual environment (recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtCopy .env.example to .env:
cp .env.example .envEdit .env and fill in your credentials:
SHARED_SECRET=your-secret-from-google-form
GITHUB_TOKEN=ghp_your_github_personal_access_token
GITHUB_USERNAME=your-github-username
LLM_PROVIDER=openai
LLM_API_KEY=sk-your-openai-api-key
LLM_MODEL=gpt-4- Go to GitHub Settings β Developer settings β Personal access tokens β Tokens (classic)
- Click "Generate new token (classic)"
- Select scopes:
repo,delete_repo,admin:repo_hook - Copy the token (starts with
ghp_)
- Go to https://platform.openai.com/api-keys
- Create new secret key
- Copy the key (starts with
sk-)
mkdir logspython app.pyThe server will start on http://localhost:5000
curl http://localhost:5000/api-endpoint \
-H "Content-Type: application/json" \
-d '{
"email": "student@example.com",
"task": "captcha-solver-test-123",
"round": 1,
"nonce": "ab12-cd34-ef56",
"secret": "your-secret-from-google-form",
"brief": "Create a simple calculator web app with basic arithmetic operations",
"evaluation": {
"url": "https://evaluation-endpoint.com/submit"
}
}'curl http://localhost:5000/healthHeroku:
heroku create your-app-name
git push heroku mainRailway:
railway init
railway upRender:
- Connect your GitHub repo
- Set environment variables
- Deploy
DigitalOcean/AWS/GCP:
- Use the included
Dockerfileor deploy as a Python app - Set environment variables
- Run with gunicorn:
gunicorn app:app
- Flask web server
/api-endpoint- Main endpoint that accepts POST requests/health- Health check endpoint- Validates incoming requests and processes them asynchronously
- Configuration management using environment variables
- Validates required settings on startup
- Creates GitHub repositories
- Pushes code to GitHub
- Enables GitHub Pages
- Adds MIT LICENSE and comprehensive README
- Generates web application code using LLM APIs
- Supports OpenAI and Anthropic
- Falls back to simple template if API fails
- Submits evaluation data to specified URL
- Implements exponential backoff retry (1, 2, 4, 8 seconds)
- Returns success/failure status
- Request received β Validate secret and required fields
- Send 200 response β Immediately acknowledge request
- Generate app β Use LLM to create HTML/CSS/JS code
- Create repo β Initialize GitHub repository
- Push code β Commit and push with LICENSE and README
- Enable Pages β Activate GitHub Pages for the repo
- Submit evaluation β POST results to evaluation URL with retry logic
- Secret validation before processing
- Environment variables for sensitive data
- No secrets in git history
.gitignoreconfigured properly- HTTPS for all external communications
MIT License - See LICENSE file for details
- Verify
SHARED_SECRETin.envmatches what you submitted in Google Form
- Check
GITHUB_TOKENhas correct permissions (repo,delete_repo) - Verify token is not expired
- Check
LLM_API_KEYis valid - Verify you have API credits/quota available
- System falls back to simple template if LLM fails
- Wait 2-3 minutes for GitHub Pages to build
- Check repository settings β Pages is enabled
- Verify
index.htmlexists in repo root
For issues or questions:
- Check the logs in
logs/api.log - Verify all environment variables are set correctly
- Test individual components separately
- Review error messages in console output