Chat API
AI-powered legal research assistant using Claude AI through Cloudflare AI Gateway.
Overview
The Chat API provides:
- Legal Expertise: Specialized in transparency law, FOIA, and public records
- Document Analysis: Upload and analyze legal documents
- FOIA Drafting: Assistance with request drafting
- Deadline Calculations: Automatic deadline computation
- Streaming Support: Real-time response streaming
- Conversation Memory: Multi-turn conversations with context
Features
Legal Research
- Transparency law Q&A
- FOIA exemption analysis
- Statute interpretation
- Case law research
Document Analysis
- Review public records requests
- Analyze government responses
- Identify potential exemptions
Drafting Assistance
- FOIA request templates
- Appeal letter drafting
- Response letter analysis
Deadline Management
- Calculate response deadlines
- Track appeal windows
- Monitor compliance timelines
Basic Chat
Non-Streaming
Python Example
Streaming Responses
For real-time output as the AI generates the response:
TypeScript Streaming
Python Streaming
React Component
Contextual Information
Provide Context
Pass context about current project or request:
Continue Conversation
Maintain conversation history with conversation_id:
Full Conversation
Common Use Cases
Legal Research
Document Analysis
FOIA Request Drafting
Deadline Calculation
Response Format
Non-Streaming Response
Streaming Response
Server-Sent Events (SSE) format:
Advanced Features
Multi-Turn Research Session
Automated FOIA Workflow
Error Handling
Best Practices
1. Be Specific
2. Provide Context
3. Use Conversations
4. Handle Streaming Gracefully
Rate Limits
- Free tier: 20 chat messages/day
- Standard tier: 200 messages/day
- Premium tier: 2,000 messages/day
See Rate Limits for details.
Model Information
- Model: Claude 3.5 Sonnet (via Cloudflare AI Gateway)
- Context Window: 200,000 tokens
- Specialized Training: Transparency law, FOIA, public records
- Response Time: 1-5 seconds (non-streaming), real-time (streaming)
Related Endpoints
- Vector Search - Search legal documents
- Transparency API - Browse transparency laws
- FOIA Dashboard - Manage FOIA requests
Support
- 📧 Email: api@theholefoundation.org
- 💬 Discord: Join our community
- 🐛 Issues: GitHub Issues