Overview
Beacon’s API authentication model is designed to be simple yet flexible. The API endpoints themselves do not require authentication, but AI provider API keys must be configured on the server side to enable inference capabilities.API Endpoint Authentication
The Beacon REST API endpoints (
/generate, /validate, /health) do not require API keys, tokens, or other authentication headers from clients.AI Provider Configuration
While the API endpoints are open, Beacon requires AI provider API keys to perform repository analysis and capability inference. These keys must be configured server-side as environment variables.Supported AI Providers
Beacon supports multiple AI providers:Google Gemini
Default provider - Fast and reliable
Anthropic Claude
High-quality analysis
OpenAI
GPT-4 powered inference
Beacon Cloud
Hosted service with payment
Environment Variables
Configure AI provider keys on the server running Beacon:.env
Selecting a Provider
Clients specify which provider to use via theprovider field in the request body:
Beacon Cloud Payment
When using thebeacon-ai-cloud provider, requests require cryptocurrency payment verification. This is handled through special HTTP headers.
Payment Flow
- Initial Request - Make a request without payment headers
- Payment Required Response - Server returns 402 with payment details
- Complete Payment - Send USDC to the provided wallet address
- Retry with Headers - Include payment verification headers
Payment Headers
After completing payment on-chain, include these headers in your request:| Header | Type | Required | Description |
|---|---|---|---|
x-payment-txn-hash | string | Yes | Blockchain transaction hash of the USDC payment |
x-payment-chain | string | Yes | Blockchain network used ("base" or "solana") |
x-payment-run-id | string | Yes | Unique run ID from the initial 402 response |
Payment Example
Receive Payment Details
The server responds with Response headers:
402 Payment Required and payment information:Complete Payment
Send the specified amount of USDC to one of the wallet addresses on your preferred chain.
Payment Verification
The server verifies payments by:- Checking the transaction hash hasn’t been used before
- Querying the blockchain to confirm the transaction
- Validating the payment amount matches the required USDC amount
- Verifying the payment was sent to the correct wallet address
- Recording the payment to prevent reuse
Security Best Practices
Protect AI Provider Keys
Protect AI Provider Keys
- Store API keys in environment variables, never in code
- Use
.envfiles for local development (add to.gitignore) - Use secret management systems in production (AWS Secrets Manager, HashiCorp Vault, etc.)
- Rotate keys periodically
Server Deployment
Server Deployment
- Run the Beacon server behind a reverse proxy (nginx, Caddy)
- Use HTTPS/TLS in production
- Implement additional authentication if exposing publicly
- Monitor rate limits and unusual usage patterns
Payment Security
Payment Security
- Always verify transaction hashes on-chain before trusting
- Never skip payment verification in production
- Monitor wallet addresses for unexpected transactions
- Keep payment amount environment variables up to date
Rate Limiting
Rate limiting is IP-based and applies to/generate and /validate endpoints:
Limit: 20 requests per 60-second window per IP address
Next Steps
API Overview
Learn about the Beacon API fundamentals
Generate Endpoint
Start generating AGENTS.md files
Environment Setup
Configure your Beacon server
AI Providers
Compare AI provider options