OpenRouter AI
Overview
What it does: Integrates any AI model from the OpenRouter.ai library directly into your HubSpot workflows, enabling AI-powered content generation, analysis, and decision-making.
When to use it: When you need AI assistance for content creation, data analysis, lead scoring, email personalization, or any task that benefits from advanced language models like GPT-4, Claude, or specialized AI models.
Business value: Automates complex reasoning tasks, generates personalized content at scale, provides intelligent insights, and enables sophisticated AI-driven workflows without requiring separate AI integrations.
Quick Setup
Prerequisites
Basic Configuration
- Set up your OpenRouter.ai API key in the app settings
- Add the "OpenRouter AI" action to your workflow
- Select an AI model from the available options
- Write your prompt with any HubSpot property tokens
- Test with a few records to validate responses
Input Fields
Required Fields
AI Model
- Type: Dynamic Dropdown (populated from OpenRouter.ai)
- Description: The specific AI model to use for processing your prompt
- Example:
gpt-5, claude-4.5-sonnet, llama-2-70b-chat
- Notes: Options include GPT models, Claude, Llama, and many specialized models
Prompt
- Type: Text Area
- Description: The instruction or question you want the AI to process
- Example:
Write a personalized follow-up email for {{contact.firstname}} who downloaded our {{recent_content_title}} guide
- Notes: Can include HubSpot property tokens and complex instructions
Optional Fields
Provider
- Type: Dynamic Dropdown (populated based on selected model)
- Description: Specific AI provider to use when multiple providers offer the same model
- Default:
Default (automatically balances across providers)
- Example:
OpenAI, Anthropic, Together AI
- Notes: Useful for consistency or when you prefer specific providers
Web Search
- Type: Boolean Checkbox
- Description: Enables the AI to search the web for current information before responding
- Default:
false
- Cost: Additional $0.10 USD per request
- Example:
true for current events, market data, or recent information
- Notes: Provides more accurate and up-to-date responses
Output Fields (Action Outputs)
Response Fields
Response
- Type: Text
- Description: The AI's response in plain text format
- Use: Store in HubSpot properties, use in subsequent workflow actions
- Example: Raw text response from the AI model
Response HTML
- Type: Text (HTML formatted)
- Description: The AI's response formatted as HTML (useful for rich content)
- Use: Email templates, rich text properties, web content
- Example: Formatted response with headings, lists, and styling
Citations
- Type: Text
- Description: Source citations when web search is enabled
- Use: Track information sources, validate AI responses
- Example:
wikipedia.org, company-website.com or "No citations"
Common Use Cases
Use Case 1: Personalized Email Generation
Scenario: Generate custom follow-up emails based on contact behavior and properties
Setup:
- Model:
gpt-4
- Prompt:
Write a personalized follow-up email for {{contact.firstname}} who works at {{company.name}} in the {{contact.industry}} industry. They recently {{recent_activity}}. Keep it professional and under 150 words.
- Web Search:
false
Result: Personalized emails for each contact based on their specific context
Use Case 2: Lead Scoring Analysis
Scenario: Use AI to analyze lead quality based on multiple data points
Setup:
- Model:
claude-3-sonnet
- Prompt:
Analyze this lead: Company: {{company.name}}, Industry: {{company.industry}}, Size: {{company.numberofemployees}}, Recent Activity: {{recent_page_views}}. Provide a lead score from 1-10 and explain why.
- Web Search:
false
Result: AI-generated lead scores with reasoning for sales team prioritization
Use Case 3: Content Summarization
Scenario: Summarize long-form content or meeting notes for quick review
Setup:
- Model:
gpt-4
- Prompt:
Summarize the following meeting notes in 3 bullet points: {{meeting.notes}}
- Web Search:
false
Result: Concise summaries for easy consumption and follow-up
Use Case 4: Market Research Integration
Scenario: Get current market insights for deals in specific industries
Setup:
- Model:
gpt-4
- Prompt:
What are the current market trends and challenges in the {{company.industry}} industry that might affect a {{deal.dealtype}} deal worth {{deal.amount}}?
- Web Search:
true
Result: Current market context to inform sales strategies
Advanced Configuration
Model Selection Strategy
Choose models based on your specific needs:
- GPT-4: Best for complex reasoning, creative tasks, and general intelligence
- Claude: Excellent for analysis, writing, and following detailed instructions
- Llama: Cost-effective for simpler tasks and high-volume processing
- Specialized Models: Task-specific models for coding, math, or domain expertise
Prompt Engineering Best Practices
- Be Specific: Clear, detailed instructions produce better results
- Use Examples: Show the AI what you want with examples
- Set Constraints: Specify length, format, tone, and style requirements
- Include Context: Provide relevant background information
- Test Iteratively: Refine prompts based on actual results
Cost Management
- Model Costs: Different models have different pricing (check OpenRouter.ai)
- Web Search: Adds $0.10 per request but provides current information
- Token Usage: Longer prompts and responses cost more
- Provider Selection: Some providers may be more cost-effective
API Behavior Details
- Request Timeout: Requests timeout after 60 seconds if the AI model doesn't respond
- Retry Logic: Failed requests are automatically retried once before failing the workflow
- Rate Limiting: OpenRouter.ai handles rate limiting - workflows will wait and retry if limits are hit
- Token Limits: Each model has maximum token limits for input + output combined
- Response Streaming: Large responses are streamed back to prevent timeouts
- Error Propagation: API errors from OpenRouter.ai are passed through to help with debugging
How It Works
- Model Selection: Choose from 100+ AI models available on OpenRouter.ai
- Prompt Processing: Your prompt is processed with HubSpot property values
- API Request: Secure request sent to OpenRouter.ai with your API key
- AI Processing: Selected model processes your prompt (with web search if enabled)
- Response Formatting: AI response converted to both text and HTML formats
- Output Generation: Results available for use in subsequent workflow actions
Troubleshooting
Common Issues
Issue: "App account isn't available" error
Symptoms: Workflow fails immediately with account error
Solution: Ensure your OpenRouter.ai API key is properly configured in app settings
Issue: AI responses are inconsistent or poor quality
Symptoms: Responses don't match expectations or vary widely
Solution: Refine your prompt with more specific instructions and examples
Issue: Responses are cut off or incomplete
Symptoms: AI responses end abruptly or seem truncated
Solution:
- The model may have hit its token limit - try a model with higher limits or shorter prompts
- Some models have built-in response length limits - specify desired length in your prompt
- Check if the response is actually complete but formatted unexpectedly
- HubSpot properties also have a character limit that you may be hitting
Issue: High costs from AI usage
Symptoms: Unexpected charges from OpenRouter.ai
Solution: Monitor usage, choose cost-effective models, and avoid web search when not needed
Last updated: November 23, 2025