Input
Profile
What are credits?
- 1 credit = 1 weather report generation
- Credits refresh monthly based on your plan
- Org members share the organization's credit pool
API Keys
Save this key — it will not be shown again
Usage
Files
Organization Feed
External apps (e.g. GRN player) use this URL to consume your forecasts. Authenticate with X-API-Key header.
Loading...
Loading...
Webhook
Configure a URL where notifications are sent when weather reports are completed or fail.
Organization
Create an organization to share credits with your team.
Members
System Overview
High-level architecture and how each layer connects
Galactic Radio Weather is a production FastAPI service that generates broadcast-quality AI weather reports with natural-sounding TTS audio. It serves three types of clients simultaneously:
Generation Pipeline
How a weather report goes from request to broadcast-ready audio
Request Received
User submits location, time of day, voice, duration, and optional DJ personality. Credit is deducted (1 credit per generation).
POST /api/v1/weather/generateFetch Weather Data
Calls Open-Meteo API with geocoded coordinates. Returns current conditions, today/tomorrow forecast, hourly data, and alerts.
WeatherService.fetch_full(location, date)LLM Script Generation
Sends weather data + system prompt + user prompt to Gemini 2.5 Pro. The LLM writes a broadcast-ready weather script.
LLMService.generate_weather_report()Text-to-Speech
Converts the script to natural-sounding audio. Supports Gemini TTS (default) and ElevenLabs.
TTSProvider.generate_audio(text, voice_id)Audio Processing
Uses FFmpeg to process the raw audio. Handles format conversion and quality optimization.
AudioProcessingService.process_audio_for_duration()Upload to Cloud Storage
Final MP3 is uploaded to Google Cloud Storage with a signed URL.
StorageService.upload_audio() → signed_urlAuthentication
Three auth methods serving different client types
Firebase OAuth
Google Sign-In popup via Firebase Auth SDK. The frontend sends the Firebase ID token as a Bearer token.
Uses a separate Firebase project (grn-weather-auth-only) dedicated to authentication.
API Key
User API keys (prefixed grw_) generated at signup. Sent via X-API-Key header.
Service API Keys
For service-to-service communication. Configured in SERVICE_API_KEYS env var. Grants SERVICE role.
require_admin() dependency.Credit System
Usage-based billing with tiered subscription plans
1 credit = 1 weather report generation. Getting weather data alone is free. Credits are deducted before generation and refunded on failure.
Organizations share a credit pool among members.
A2A Protocol (Agent-to-Agent)
Google's open protocol for AI agents to discover and use our service
The A2A layer runs alongside the existing REST API. Any A2A-compatible agent can discover our service via the Agent Card, then interact using JSON-RPC messages.
Agent Skills
JSON-RPC Methods
| Method | Description |
|---|---|
message/send | Send a message to the agent, returns task result |
message/stream | Send + stream progress via SSE events |
tasks/get | Get current status and artifacts of a task |
tasks/cancel | Cancel a running generation task |
AP2 Payments (Agent Payment Protocol)
How AI agents pay for weather report generation
AP2 is Google's protocol for agent-to-merchant payments using cryptographic IntentMandates. Agents include a payment mandate in the A2A message DataPart.
Agent Sends IntentMandate
Included as a DataPart with key ap2.mandates.IntentMandate in the A2A message.
Validate Mandate
Check expiry timestamp and verify merchant name matches.
AP2PaymentHandler.validate_mandate()Authorize & Generate
If valid, authorize 1 credit and proceed with generation.
Return PaymentReceipt
On success, a ap2.PaymentReceipt DataPart is returned.
MCP Server (Model Context Protocol)
Streamable HTTP tool server for remote agent access
The MCP server exposes weather generation operations as tools that remote agents can discover and call using the standard MCP protocol.
Available Tools (10)
Connection Config
{
"mcpServers": {
"galactic-radio-weather": {
"type": "http",
"url": "https://galactic-radio-weather-355622637773.us-central1.run.app/api/v1/weather-mcp",
"headers": { "X-API-Key": "${GRW_SERVICE_API_KEY}" }
}
}
}
Protocol Details
| Property | Value |
|---|---|
| Transport | Streamable HTTP |
| Protocol Version | 2025-11-25 |
| Format | JSON-RPC 2.0 |
| Auth | X-API-Key header (service keys) |
| Session | Mcp-Session-Id returned on initialize |
| Env Variable | GRW_SERVICE_API_KEY |
Prompt Engineering
How the AI generates weather scripts
Prompt Architecture
Defines the AI's personality and output format.
The request template with placeholders for location, time, etc.
15s: Quick headline · 30s: Brief overview · 60s: Full report
Weather data, location, date, time, voice info, and DJ traits are appended automatically.
Customization
Users can override prompts per-session via the "Style" button. Custom prompts can be fetched from an external URL. Changes are browser-session only.
API Reference
REST endpoints and their purpose
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /api/v1/health | Health check | None |
| POST | /api/v1/weather/generate | Generate weather report | Required |
| GET | /api/v1/weather/status/{id} | Poll job status | Required |
| GET | /api/v1/weather/voices | List available voices | Required |
| GET | /api/v1/forecast/{location}/weather | Get weather data (free) | Required |
| POST | /api/v1/dj/generate | Generate DJ weather report | Required |
| GET | /api/v1/dj/list | List DJ personalities | Required |
| POST | /api/v1/users/oauth-signin | Create/get user profile | Firebase |
| GET | /api/v1/users/me | Get current user profile | Required |
| POST | /api/v1/users/api-keys | Generate new API key | Required |
| GET | /api/v1/files | List user's audio files | Required |
| MCP Server Endpoints | |||
| POST | /api/v1/weather-mcp | MCP JSON-RPC endpoint | Service key |
| A2A Protocol Endpoints | |||
| GET | /.well-known/agent.json | Agent Card discovery | None |
| POST | /a2a | A2A JSON-RPC endpoint | Required |
CLI Tool (grw)
Command-line interface for power users and automation
Install: pip install -e ".[cli]" — then use grw from the terminal.
Weather Generation
grw generate "Beverly Hills, CA"Generate a weather report for a location
grw generate "NYC" --voice Kore --duration 30 --tod morningGenerate with specific voice, duration, and time of day
grw generate "Tokyo" --dj <uuid>Generate with a DJ personality
Utilities
grw voicesList all available voices
grw status <job_id>Check generation job status
grw djsList available DJ personalities
A2A Agent Commands
grw agent cardFetch and display the Agent Card
grw agent send "Beverly Hills, CA" --streamSend an A2A message with SSE streaming
Deployment
Cloud Build, Docker, and Cloud Run configuration
--set-env-vars flag replaces ALL env vars on deploy. All env vars must be in cloudbuild.yaml.Tech Stack
Every tool and service in the system