AI Provider Configuration
How to configure OpenAI, Anthropic, Google, and other AI providers in Fabric AI.
Fabric AI supports multiple AI providers through the Vercel AI SDK. This guide shows you how to configure your preferred provider.
Supported Providers
OpenAI
GPT-4, GPT-4 Turbo, GPT-3.5 Turbo
Best for: Complex reasoning, code generation
Anthropic
Claude 3.5 Sonnet, Claude 3 Opus, Claude 3 Haiku
Best for: Long context, nuanced understanding
Gemini Pro, Gemini Ultra
Best for: Multimodal tasks, general purpose
Others
Mistral, Llama, Cohere, and more
Available through custom configuration
Configuration Methods
Method 1: Through the UI (Recommended)
The easiest way to configure AI providers is through the Fabric UI:
Navigate to Settings
Click your profile icon in the top right, then select Settings.
Open AI Gateway
In the settings sidebar, click AI Gateway.
Add Provider
Click Add Provider and select your AI provider from the list.
Enter API Key
Paste your API key from your provider's dashboard:
- OpenAI: Get your key at platform.openai.com
- Anthropic: Get your key at console.anthropic.com
- Google: Get your key at aistudio.google.com
Test Connection
Click Test Connection to verify your API key works correctly. You should see a success message.
Save
Click Save to store your configuration. Your AI provider is now ready to use!
Method 2: Organization Configuration
For teams and organizations, you can configure AI providers at the organization level:
Switch to Organization
Use the organization switcher in the top bar to select your organization.
Open Organization Settings
Click Settings → Organization Settings → AI Gateway.
Configure Provider
Add your organization's API key. All organization members will use this configuration by default.
Priority Order:
- Organization configuration (if member of an organization)
- Personal account configuration
- Environment variable fallback
Method 3: Environment Variables (Self-Hosted)
For self-hosted deployments, you can configure providers via environment variables:
# Primary AI Gateway key
AI_GATEWAY_API_KEY="your-api-key"
# Or provider-specific keys
OPENAI_API_KEY="sk-..."
ANTHROPIC_API_KEY="sk-ant-..."
GOOGLE_AI_API_KEY="..."Provider-Specific Setup
OpenAI
- Go to platform.openai.com
- Navigate to API Keys
- Click Create new secret key
- Copy the key (you won't see it again!)
- Paste in Fabric Settings → AI Gateway
OPENAI_API_KEY="sk-..."Available Models:
gpt-4— Most capable, best for complex tasksgpt-4-turbo— Faster, good balance of speed and capabilitygpt-4o— Latest model with vision capabilitiesgpt-3.5-turbo— Fast and cost-effective
Anthropic
- Go to console.anthropic.com
- Navigate to Settings → API Keys
- Click Create Key
- Copy the key
- Paste in Fabric Settings → AI Gateway
ANTHROPIC_API_KEY="sk-ant-..."Available Models:
claude-3-5-sonnet-20241022— Best balance of capability and speedclaude-3-opus-20240229— Most capable, best for complex analysisclaude-3-haiku-20240307— Fastest, great for simple tasks
Google (Gemini)
- Go to aistudio.google.com
- Click Get API Key
- Create a new key or select existing
- Copy the key
- Paste in Fabric Settings → AI Gateway
GOOGLE_AI_API_KEY="..."Available Models:
gemini-pro— General purpose, good for textgemini-pro-vision— Multimodal with image understanding
Using Vercel AI Gateway
For production deployments, we recommend using Vercel AI Gateway for:
- Unified API — Single endpoint for all providers
- Cost tracking — Monitor usage across providers
- Rate limiting — Protect against runaway costs
- Caching — Reduce costs with intelligent caching
- Fallbacks — Automatic provider failover
Setup
- Go to vercel.com/dashboard/ai/gateway
- Create a new gateway or select existing
- Add your provider API keys
- Copy the Gateway API key
- Paste in Fabric Settings → AI Gateway
# Environment variable for Vercel AI Gateway
AI_GATEWAY_API_KEY="vck_..."Choosing the Right Model
| Use Case | Recommended Model | Why |
|---|---|---|
| Complex PRDs | GPT-4 or Claude 3 Opus | Best reasoning capabilities |
| Quick drafts | Claude 3.5 Sonnet | Fast with good quality |
| Long documents | Claude 3.5 Sonnet | 200K token context |
| Code generation | GPT-4 | Strong code understanding |
| Cost-sensitive | GPT-3.5 Turbo or Claude Haiku | Lower cost per token |
| Multimodal | GPT-4V or Gemini Pro Vision | Image understanding |
Model Settings
When using agents, you can customize model settings:
Temperature
Controls randomness in outputs:
- 0.0 — Deterministic, consistent outputs
- 0.7 — Balanced creativity (default)
- 1.0 — More creative, varied outputs
Max Tokens
Maximum length of the response:
- 1024 — Short responses
- 4096 — Medium documents (default)
- 8192+ — Long documents
System Prompt
Instructions that guide the model's behavior. Fabric provides optimized system prompts for each agent type.
Troubleshooting
"Invalid API Key"
- Double-check the key is copied correctly (no extra spaces)
- Verify the key hasn't been revoked
- Make sure you're using the right key format for the provider
"Rate Limited"
- You've exceeded your provider's rate limits
- Wait a few minutes and try again
- Consider upgrading your provider plan
"Model Not Available"
- The selected model may not be available in your region
- Check your provider's model availability
- Try a different model
"Insufficient Credits"
- Your provider account has run out of credits
- Add payment method or purchase more credits
- Check usage in your provider's dashboard
Security Best Practices
- Never share your API keys
- Rotate keys periodically
- Use organization keys for team deployments
- Monitor usage to detect anomalies
- Set spending limits with your provider