# Create an upstream with semantic load balancing
curl -X POST http://localhost:8080/api/v1/gateways/{gateway-id}/upstreams \
-H "Content-Type: application/json" \
-d '{
"name": "ai-providers-semantic-upstream",
"algorithm": "semantic",
"embedding_config": {
"provider": "openai",
"model": "text-embedding-ada-002",
"credentials": {
"header_name": "Authorization",
"header_value": "Bearer your-openai-key"
}
},
"targets": [
{
"path": "/v1/chat/completions",
"provider": "openai",
"description": "Specialized in creative writing, storytelling, and content generation. Good for marketing copy, blog posts, and creative fiction.",
"default_model": "gpt-4",
"models": ["gpt-3.5-turbo", "gpt-4", "gpt-4o-mini"],
"credentials": {
"header_name": "Authorization",
"header_value": "Bearer your-openai-key"
}
},
{
"path": "/v1/messages",
"provider": "anthropic",
"description": "Excels at technical documentation, code explanation, and scientific content. Ideal for programming help and technical problem-solving.",
"default_model": "claude-3-5-sonnet-20241022",
"models": ["claude-3-5-sonnet-20241022"],
"headers": {
"anthropic-version": "2023-06-01"
},
"credentials": {
"header_name": "x-api-key",
"header_value": "your-anthropic-key"
}
},
{
"path": "/v1/chat/completions",
"provider": "openai",
"description": "Specialized in data analysis, mathematical reasoning, and logical problem-solving. Best for analytical tasks and structured data processing.",
"default_model": "gpt-4-turbo",
"models": ["gpt-4-turbo"],
"credentials": {
"header_name": "Authorization",
"header_value": "Bearer your-openai-key"
}
}
],
"health_checks": {
"passive": true,
"threshold": 3,
"interval": 60
}
}'