Configuring Providers¶
This guide covers setting up LLM providers for GIANT.
Overview¶
GIANT currently supports these LLM providers:
| Provider | Model | Status |
|---|---|---|
| OpenAI | gpt-5.2 |
Default |
| Anthropic | claude-sonnet-4-5-20250929 |
Supported |
gemini-3-pro-preview is present in the model registry for future work, but the Google/Gemini provider is not implemented in the CLI yet.
API Key Configuration¶
Environment Variables¶
Create a .env file in the project root:
Load before running:
Shell Export¶
Alternatively, export directly:
Security Notes¶
- Never commit
.envfiles - Add to.gitignore - Avoid placeholder values - Keys containing
your-keyorchangemeare treated as not configured - Use environment-specific keys - Separate keys for dev/test/prod
- Rotate compromised keys - If exposed, regenerate immediately
OpenAI Setup¶
Getting an API Key¶
- Go to OpenAI Platform
- Create an account or sign in
- Navigate to API Keys
- Create a new secret key
- Copy and save securely
Configuration¶
Usage¶
Pricing¶
| Model | Input (per 1M) | Output (per 1M) |
|---|---|---|
| gpt-5.2 | $1.75 | $14.00 |
Target Image Size¶
OpenAI provider uses 1000px target size for higher resolution analysis.
Anthropic Setup¶
Getting an API Key¶
- Go to Anthropic Console
- Create an account or sign in
- Navigate to API Keys
- Create a new key
- Copy and save securely
Configuration¶
Usage¶
Pricing¶
| Model | Input (per 1M) | Output (per 1M) |
|---|---|---|
| claude-sonnet-4-5-20250929 | $3.00 | $15.00 |
Target Image Size¶
Anthropic provider uses 500px target size (cost-optimized).
Model Registry¶
Only approved models are allowed. This ensures:
- Consistency - Reproducible results
- Cost control - Known pricing
- Compatibility - Tested integration
Approved Models¶
APPROVED_MODELS = {
"gpt-5.2", # OpenAI
"claude-sonnet-4-5-20250929", # Anthropic
"gemini-3-pro-preview", # Reserved (Google/Gemini provider not yet implemented)
}
Validation¶
Invalid models are rejected at runtime:
giant run slide.svs -q "?" --model gpt-4o
# Error: Model 'gpt-4o' is not approved. Allowed for openai approved models: gpt-5.2. See docs/models/model-registry.md.
See Model Registry for the full list.
Provider Comparison¶
| Feature | OpenAI | Anthropic |
|---|---|---|
| Default model | gpt-5.2 | claude-sonnet-4-5-20250929 |
| Target size | 1000px | 500px |
| Structured output | JSON schema via responses.create |
Tool use via submit_step |
| Image cost model | Flat per image | Pixel-based |
Troubleshooting¶
"API key not set"¶
Fix: Ensure the key is exported:
"Invalid API key"¶
Fix: Check your key is correct and has not expired.
"Placeholder key treated as not configured"¶
If your key contains obvious placeholder strings (e.g., your-key, changeme), GIANT treats it as missing and raises the same configuration error as an unset key.
"Model not approved"¶
Fix: Use an approved model from the registry.
Rate Limits¶
If you hit rate limits:
- Reduce concurrency:
--concurrency 1 - Add delays between requests (not currently configurable)
- Upgrade your API tier
Programmatic Usage¶
from giant.llm import create_provider
# OpenAI
provider = create_provider("openai", model="gpt-5.2")
# Anthropic
provider = create_provider("anthropic", model="claude-sonnet-4-5-20250929")
# Use with agent
from giant.agent import GIANTAgent, AgentConfig
agent = GIANTAgent(
wsi_path="slide.svs",
question="What tissue is this?",
llm_provider=provider,
config=AgentConfig(max_steps=10),
)
result = await agent.run()
Next Steps¶
- Model Registry - All approved models
- Running Inference - Use configured provider
- LLM Integration - Technical details