Supported Providers
OpenAI
GPT-4, GPT-3.5, and GPT-5 models
Anthropic
Claude 3 Opus, Sonnet, and Haiku
Gemini Pro and Gemini Ultra
OpenRouter
Access to 100+ models from multiple providers
Provider Configuration
OpenAI
Get API Key
Sign up at OpenAI Platform and create an API key.
Available OpenAI Models
Available OpenAI Models
gpt-5- Latest GPT-5 modelgpt-4-turbo- GPT-4 Turbo with 128k contextgpt-4- GPT-4 with 8k contextgpt-3.5-turbo- Fast and cost-effective
Anthropic
Get API Key
Sign up at Anthropic Console and create an API key.
Available Anthropic Models
Available Anthropic Models
claude-sonnet-4-5-20250929- Latest Claude Sonnet 4.5claude-3-opus-20240229- Most capable modelclaude-3-sonnet-20240229- Balanced performanceclaude-3-haiku-20240307- Fast and cost-effective
Get API Key
Enable the Generative Language API in Google AI Studio.
Available Google Models
Available Google Models
gemini-pro- Balanced performancegemini-ultra- Most capable model
OpenRouter
OpenRouter Model Format
OpenRouter Model Format
OpenRouter uses the format
provider/model-name:anthropic/claude-3-opusopenai/gpt-4google/gemini-prometa-llama/llama-3-70b
Agent-Specific Configuration
BioAgents uses different LLMs for different agent types to optimize for cost and performance.Reply Agent (Chat)
Generates conversational responses to user messages.Hypothesis Agent
Synthesizes research outputs into scientific claims.Planning Agent
Decides what research tasks to execute.Structured Output Agent
Generates structured data (JSON, etc.).OpenAI models have native JSON mode support, making them ideal for structured output.
Continue Research Agent
Decides whether to continue autonomous research.Implementation Details
BioAgents implements a robust LLM system with adapters for each provider.Provider Adapter Pattern
Each provider has an adapter that implements theLLMAdapter interface:
src/llm/provider.ts
Automatic Retry & Fallback
BioAgents automatically retries failed requests and falls back to alternative providers:src/llm/provider.ts
Finish Reason Monitoring
BioAgents monitors response finish reasons to detect truncation:src/llm/provider.ts
Token Usage Tracking
All LLM calls track token usage in the database:src/llm/provider.ts
Cost Optimization Strategies
Use Different Models per Agent
Use Different Models per Agent
Configure cost-effective models for high-volume tasks:
Use OpenRouter for Rate Limits
Use OpenRouter for Rate Limits
OpenRouter provides access to the same models with higher rate limits:
Monitor Token Usage
Monitor Token Usage
Track token usage in the database to identify expensive operations:
Troubleshooting
Rate Limit Errors
Rate Limit Errors
Symptom:
429 Too Many Requests errorsSolutions:- Increase retry delay in
src/llm/retry.ts - Use OpenRouter as an alternative
- Reduce concurrent requests with
CHAT_QUEUE_CONCURRENCY
Model Not Found
Model Not Found
Symptom:
404 Model not found errorsSolutions:- Verify model name matches provider documentation
- Check API key has access to the model
- For OpenRouter, use
provider/model-nameformat
Response Truncation
Response Truncation
Symptom: Incomplete responses with
length finish reasonSolutions:- Increase
maxTokensin the request - Use a model with larger context window
- Simplify the prompt to reduce input tokens
API Key Invalid
API Key Invalid
Symptom:
401 Unauthorized errorsSolutions:- Verify API key is correct and not expired
- Check environment variable is loaded:
echo $OPENAI_API_KEY - Restart server after changing
.env
Example Configurations
Next Steps
Environment Variables
View all configuration options
Authentication
Configure JWT or payment-based auth