Chat API Overview
Create theory-aware conversations with AI that understands activist strategy.Overview
The Chat API provides conversational AI optimized for activists, organizers, and change-makers. Unlike generic chatbots, Outcry AI understands strategic frameworks through Theory of Change positioning.Key Features
- Theory of Change Integration - Align responses with your strategic approach
- Streaming Responses - Real-time token-by-token output
- Session Management - Multi-turn conversations with context
- Token-Based Billing - Pay only for what you use ($0.08 per 1K tokens)
- OpenAI Compatible - Works with OpenAI SDK
Model
Quick Example
Theory of Change Positioning
Align AI responses with your strategic framework using thex-theory-position parameter:
- Voluntarism
{x: -1, y: -1}- Grassroots mobilization - Structuralism
{x: 1, y: -1}- Policy/systems change - Subjectivism
{x: -1, y: 1}- Cultural transformation - Theurgism
{x: 1, y: 1}- Faith-based activism
Streaming Responses
Get real-time token-by-token responses:- Lower perceived latency
- Better UX for long responses
- Progress indication
Multi-Turn Conversations
Maintain conversation context across multiple requests:Method 1: Send Full History
Method 2: Use Session ID
Pricing
Chat is billed per token at $0.08 per 1,000 tokens. Token Estimation:- ~750 words = 1,000 tokens
- Average message: 50-200 tokens
- Typical conversation: 500-2,000 tokens (0.16)
Endpoints
Response Format
Rate Limits
Best Practices
1. Use System Messages
Set context with system messages:2. Manage Context Window
Keep conversations under 128K tokens:3. Handle Long Responses
Set max_tokens to control response length:4. Use Streaming for UX
Stream responses for better perceived performance:Required Scopes
Chat endpoints require the following API key scopes:chat:write- Create completionschat:read- List/retrieve sessions
Next Steps
Create Completion
Create your first chat completion
Streaming
Use streaming for real-time responses
Theory of Change
Align AI with your strategic approach
Error Handling
Handle errors gracefully