Managing Connections
This guide covers how to view, update, and troubleshoot your connections after they've been created.
Viewing Connections
Web Interface
- Log in to LangMart
- Navigate to Connections in the sidebar
- You'll see a list of all your connections with:
- Provider name and icon
- Connection status (active, inactive, error)
- Gateway type (Cloud or Self-Hosted)
- Scope (Individual or Organization)
- Number of available models
- Last health check time
API
# List all connections
curl https://api.langmart.ai/api/connections \
-H "Authorization: Bearer YOUR_LANGMART_API_KEY"Response:
{
"connections": [
{
"id": "conn-abc123",
"provider": {
"id": "prov-123",
"key": "openai",
"name": "OpenAI"
},
"endpoint_url": "https://api.openai.com/v1",
"gateway_type": 2,
"status": "active",
"scope": "individual",
"model_count": 42,
"rate_limits": {
"rpm": 60,
"tpm": 40000
},
"created_at": "2025-01-08T10:30:00Z"
}
]
}Filtering Connections
Filter by provider, gateway type, or status:
# Filter by provider
curl "https://api.langmart.ai/api/connections?provider_id=PROVIDER_UUID" \
-H "Authorization: Bearer YOUR_LANGMART_API_KEY"
# Filter by gateway type
curl "https://api.langmart.ai/api/connections?gateway_type=2" \
-H "Authorization: Bearer YOUR_LANGMART_API_KEY"
# Filter by status
curl "https://api.langmart.ai/api/connections?status=active" \
-H "Authorization: Bearer YOUR_LANGMART_API_KEY"
# Filter by scope
curl "https://api.langmart.ai/api/connections?scope=organization" \
-H "Authorization: Bearer YOUR_LANGMART_API_KEY"Updating API Keys
API keys can be rotated without deleting and recreating the connection.
Web Interface
- Find your connection in the list
- Click the menu icon (three dots)
- Select Update API Key
- Paste your new API key
- Click Update
API
curl -X POST https://api.langmart.ai/api/connections/CONN_ID/update-key \
-H "Authorization: Bearer YOUR_LANGMART_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"api_key": "sk-new-api-key-here"
}'Response:
{
"success": true,
"message": "API key updated successfully"
}Important: After updating the API key, test the connection to verify it works.
Enabling and Disabling Connections
Disable a Connection
Disabling a connection prevents it from being used for inference without deleting it.
curl -X PUT https://api.langmart.ai/api/connections/CONN_ID \
-H "Authorization: Bearer YOUR_LANGMART_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"status": "inactive"
}'Enable a Connection
curl -X PUT https://api.langmart.ai/api/connections/CONN_ID \
-H "Authorization: Bearer YOUR_LANGMART_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"status": "active"
}'Connection Health Checks
LangMart periodically checks connection health. You can also trigger manual health checks.
Manual Health Check
curl -X POST https://api.langmart.ai/api/connections/CONN_ID/test \
-H "Authorization: Bearer YOUR_LANGMART_API_KEY"Health Status Values
| Status | Description |
|---|---|
active |
Connection is working normally |
inactive |
Connection manually disabled |
error |
Connection failed health check |
rate_limited |
Provider rate limit hit |
Automatic Recovery
When a connection test passes after being in an error state:
- Connection status is updated to
active - Associated models are re-enabled
- Health check metadata is updated
Updating Rate Limits
Adjust rate limits to match your provider tier:
curl -X PUT https://api.langmart.ai/api/connections/CONN_ID \
-H "Authorization: Bearer YOUR_LANGMART_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"rate_limit_rpm": 120,
"rate_limit_tpm": 80000
}'Model Resolution Priority
Control which connection is used when multiple connections provide the same model.
Prefer Score
Higher scores are tried first. Default is 100.
curl -X PUT https://api.langmart.ai/api/connections/CONN_ID \
-H "Authorization: Bearer YOUR_LANGMART_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prefer_score": 200
}'Use cases:
- Set your fastest connection to
prefer_score: 200 - Set your backup connection to
prefer_score: 50 - Primary connection handles most traffic; backup kicks in on failures
Allow Fallback
When enabled, if this connection fails, LangMart tries other connections.
curl -X PUT https://api.langmart.ai/api/connections/CONN_ID \
-H "Authorization: Bearer YOUR_LANGMART_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"allow_fallback": true
}'Disable fallback if you want strict routing to specific connections:
{
"allow_fallback": false
}Deleting Connections
Web Interface
- Find your connection in the list
- Click the menu icon (three dots)
- Select Delete
- Confirm the deletion
API
curl -X DELETE https://api.langmart.ai/api/connections/CONN_ID \
-H "Authorization: Bearer YOUR_LANGMART_API_KEY"Warning: Deleting a connection also removes all associated models. Consider disabling instead if you might need it again.
Troubleshooting Connection Issues
Connection Shows "Error" Status
Symptoms:
- Red error indicator
- Models not available
- API requests fail
Solutions:
- Test the connection manually
- Verify your API key is still valid with the provider
- Check if the provider has any outages
- Review rate limit settings
"Authentication Failed"
Causes:
- API key has been revoked or expired
- API key was entered incorrectly
- Provider account has billing issues
Solutions:
- Log into your provider account
- Generate a new API key
- Update the connection with the new key
- Test the connection
"Rate Limit Exceeded"
Causes:
- Exceeded provider's rate limits
- Too many concurrent requests
- LangMart rate limits set higher than provider allows
Solutions:
- Wait for the rate limit window to reset
- Lower your rate limit settings in LangMart
- Upgrade your provider tier
- Add multiple connections for load balancing
"Connection Refused"
Causes:
- Incorrect endpoint URL
- Provider API is down
- Network/firewall issues
Solutions:
- Verify the endpoint URL matches the provider's documentation
- Check the provider's status page
- Try accessing the provider API directly
- Check for firewall or proxy issues
Models Not Appearing
Causes:
- Discovery hasn't been run
- API key lacks list models permission
- Connection is in error state
Solutions:
- Run model discovery manually
- Check API key permissions with provider
- Test and fix the connection first
- Some providers don't support model listing - create models manually
Self-Hosted Gateway Issues
Causes:
- Gateway service not running
- Gateway not connected to LangMart
- Network connectivity issues
Solutions:
- Check gateway logs:
tail -f /tmp/gw3.log - Verify gateway is running:
./core.sh status - Restart the gateway:
./core.sh restart 3 - Check WebSocket connection status
Connection Best Practices
1. Use Descriptive Names
Give connections clear names so you can identify them later:
- "OpenAI Production" vs "OpenAI Testing"
- "Anthropic - Team Project"
2. Set Appropriate Rate Limits
Match your rate limits to your provider tier to avoid unnecessary errors:
| Provider | Free Tier | Paid Tier |
|---|---|---|
| OpenAI | 60 RPM | 3,500+ RPM |
| Anthropic | 5 RPM | 400+ RPM |
| Groq | 30 RPM | 100+ RPM |
3. Enable Fallback for Production
For production workloads, keep allow_fallback: true so requests don't fail completely if one connection has issues.
4. Use Organization Connections for Teams
If your team shares API access, create organization connections instead of individual ones. This:
- Centralizes billing
- Simplifies key management
- Provides consistent access for all members
5. Regular Key Rotation
Rotate API keys periodically (every 90 days recommended):
- Generate new key with provider
- Update connection in LangMart
- Test the connection
- Revoke the old key with provider
6. Monitor Connection Health
Regularly check your connections dashboard for:
- Error status connections
- Connections approaching rate limits
- Unused connections that can be removed
Related Topics
- Connections Overview - Understanding connections
- Adding Connections - Initial setup guide
- API Key Security - Best practices for key management