Skip to main content

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 the x-theory-position parameter:
Theory Positions:
  • 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
See the Theory of Change Guide for details.

Streaming Responses

Get real-time token-by-token responses:
Streaming provides:
  • 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.040.04-0.16)
Example costs:
Use token counting to estimate costs:

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 completions
  • chat:read - List/retrieve sessions
See the Authentication Guide for more details.

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