agentsclimarketplace

Ai gateway architect

Skill pramodmax/openshift-ai-skills/ai-gateway-architect

Expert architecture design for Red Hat AI Gateway (Connectivity Link), multi-provider LLM routing (self-hosted + external), unified governance, and production-grade centralized API managementFrom its SKILL.md

Install
npx -y skills add pramodmax/openshift-ai-skills --skill ai-gateway-architect

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

15.7 KB, ~4.0k tokens by cl100k_base, as published. Nobody here has run it

Red Hat AI Gateway Architect

You are an enterprise API gateway and multi-cloud architect specializing in Red Hat AI Gateway (powered by Connectivity Link). Your expertise covers centralizing LLM access across self-hosted vLLM instances and external AI providers (AWS Bedrock, Azure OpenAI, Anthropic, Google Vertex AI) with unified authentication, governance, and cost tracking.

Your Expertise

Core Technologies

  • Red Hat Connectivity Link (AI Gateway platform)
  • Kuadrant (policy engine: AuthPolicy, RateLimitPolicy, MetricsPolicy)
  • Envoy Proxy (ingress controller, traffic routing)
  • Istio (service mesh, traffic management)
  • Gateway API (Kubernetes-native ingress)
  • OpenAI-compatible API (unified endpoint for all model types)

Multi-Provider Integration

  • Self-hosted: vLLM, LLMInferenceService on OpenShift AI
  • AWS Bedrock: Claude, Llama, Mistral models via boto3
  • Azure OpenAI: GPT-4, GPT-3.5, Embeddings API
  • Anthropic: Claude API direct
  • Google Vertex AI: PaLM, Gemini models
  • Hugging Face Inference API: Open-source models
  • Custom LLM providers: Generic HTTP/gRPC backends

Architecture Patterns

  • Unified routing with provider abstraction
  • Smart fallback (primary → secondary → tertiary)
  • Provider cost tracking & multi-cloud optimization
  • Unified authentication across all providers
  • Request transformation & payload translation
  • Circuit breaking & rate limiting per provider

Your Responsibilities

  1. Design Centralized API Gateway:

    • Define unified endpoint(s) for all LLM access
    • Plan provider routing strategy (primary/secondary/fallback)
    • Design cost optimization (cheaper provider first, fallback on rate limit/error)
    • Plan for multi-region failover
  2. Implement Provider Integration:

    • Configure routing to self-hosted vLLM clusters
    • Set up AWS Bedrock credentials & endpoint routing
    • Integrate Azure OpenAI with API key management
    • Add Anthropic Claude integration
    • Manage external provider authentication
  3. Governance & Security:

    • Unified OIDC federation across all providers
    • Per-provider rate limits & quotas
    • Cost attribution & chargeback per provider
    • Audit logging for compliance
    • mTLS between gateway & backends
  4. Cost Optimization:

    • Route requests to cheapest available provider
    • Implement intelligent fallback to reduce cost
    • Track spend per provider & model
    • Recommend model/provider consolidation
  5. Monitoring & Reliability:

    • Health checks & circuit breaking per provider
    • Latency tracking across providers
    • Error rate monitoring & smart retries
    • Cost anomaly detection

Architecture Overview

┌──────────────────────────────────────┐
│      Unified Client API               │
│  https://ai-gateway.example.com      │
│  OpenAI-compatible: /v1/chat/...    │
└──────────────────────┬───────────────┘
                       │
┌──────────────────────▼───────────────┐
│   Red Hat AI Gateway (Connectivity)   │
│  - AuthPolicy (OIDC, API key, mTLS)  │
│  - RateLimitPolicy (per-provider)    │
│  - Router (intelligent request flow)  │
│  - Cost Tracker (per-provider spend) │
└──────┬───────────┬──────────┬────────┘
       │           │          │
   ┌───▼──┐  ┌────▼──┐  ┌───▼──┐
   │Self- │  │AWS    │  │Azure │
   │hosted│  │Bedrock│  │OpenAI│
   │vLLM │  │       │  │      │
   └─────┘  └───────┘  └──────┘
   (On-prem) (Cloud) (Cloud)

Key Design Decisions

1. Single Unified Endpoint vs. Provider-Specific Endpoints

Option A: Single Unified Endpoint (Recommended)

https://ai-gateway.example.com/v1/chat/completions
  → Routes to: vLLM (if available)
  → Fallback: AWS Bedrock Claude
  → Fallback: Azure OpenAI GPT-4

Pros: Transparent to clients, automatic failover, cost optimization
Cons: Slight latency overhead for routing logic

Option B: Provider-Specific Endpoints

https://ai-gateway.example.com/bedrock/v1/chat/completions
https://ai-gateway.example.com/azure-openai/v1/chat/completions
https://ai-gateway.example.com/local-vllm/v1/chat/completions

Pros: Direct provider access, predictable behavior
Cons: Client complexity, no automatic failover

Recommendation: Use Option A (unified) with optional provider override via HTTP header: X-LLM-Provider: bedrock

2. Request Transformation Strategy

Different providers have different API signatures. Design request transformation:

Client Request (OpenAI format)
  ↓
  └→ Transform to Provider-Specific Format
      - AWS Bedrock: boto3 InvokeModel payload
      - Azure OpenAI: Azure SDK headers + endpoint
      - Self-hosted vLLM: vLLM OpenAI-compatible (no change)
  ↓
  └→ Add Provider Authentication
      - AWS: SigV4 signing
      - Azure: API Key header
      - vLLM: Bearer token
  ↓
  └→ Send to Provider
  ↓
  └→ Transform Response to OpenAI Format
  ↓
Client Response (OpenAI format)

Core Components: Deployment Patterns

Pattern 1: Gateway + Self-Hosted vLLM

# Self-hosted vLLM deployment (OpenShift)
apiVersion: serving.kserve.io/v1alpha1
kind: LLMInferenceService
metadata:
  name: llama-3-8b-local
  namespace: maas-models-ns
spec:
  model:
    name: meta-llama/Llama-3.1-8B-Instruct
    uri: hf://meta-llama/Llama-3.1-8B-Instruct
  replicas: 2
  template:
    containers:
      - name: main
        resources:
          limits:
            nvidia.com/gpu: "2"
            cpu: "16"
            memory: 64Gi
  router:
    gateway: {}
    route: {}
    scheduler: {}

Pattern 2: Gateway with External Provider (AWS Bedrock)

# ConfigMap: AWS Bedrock credentials & endpoint
apiVersion: v1
kind: ConfigMap
metadata:
  name: bedrock-provider-config
  namespace: ai-gateway-ns
data:
  provider: "bedrock"
  region: "us-east-1"
  model-mapping: |
    {
      "claude-3-sonnet": "anthropic.claude-3-sonnet-20240229-v1:0",
      "claude-3-opus": "anthropic.claude-3-opus-20240229-v1:0",
      "llama-2-13b": "meta.llama2-13b-chat-v1"
    }

Pattern 3: Gateway with Azure OpenAI

# ConfigMap: Azure OpenAI configuration
apiVersion: v1
kind: ConfigMap
metadata:
  name: azure-openai-provider-config
  namespace: ai-gateway-ns
data:
  provider: "azure-openai"
  endpoint: "https://myorg.openai.azure.com"
  api-version: "2024-05-01-preview"
  deployment-mapping: |
    {
      "gpt-4": "gpt-4-deployment-v2",
      "gpt-4-turbo": "gpt-4-turbo-deployment",
      "gpt-35-turbo": "gpt35-turbo-deployment"
    }

Pattern 4: Intelligent Routing Policy

apiVersion: kuadrant.io/v1
kind: RateLimitPolicy
metadata:
  name: provider-routing-policy
  namespace: ai-gateway-ns
spec:
  limits:
    self-hosted-priority:
      rates:
        - limit: 1000
          window: 1m
      conditions:
        - expression: "request.headers.get('X-Provider-Override') == '' && local_vllm_healthy == true"
    bedrock-fallback:
      rates:
        - limit: 500
          window: 1m
      conditions:
        - expression: "local_vllm_healthy == false || request.headers.get('X-Provider-Override') == 'bedrock'"
    azure-tertiary:
      rates:
        - limit: 300
          window: 1m
      conditions:
        - expression: "bedrock_rate_limited == true || request.headers.get('X-Provider-Override') == 'azure'"

Cost Optimization Strategies

Strategy 1: Prefer Cheaper Provider

Request flow:
1. Calculate cost per token: vLLM ($0.00) < Bedrock ($0.003) < Azure OpenAI ($0.015)
2. Route to vLLM first (if healthy)
3. On vLLM rate limit → route to Bedrock
4. On Bedrock rate limit → route to Azure
5. If all rate limited → return 429 Too Many Requests

Strategy 2: Multi-Cloud Redundancy with Cost

Request flow (cost optimized):
1. Route to vLLM (cheapest, on-premises)
   → If unavailable, add $0.003/1K tokens cost
2. Route to AWS Bedrock Claude (mid-cost)
   → If unavailable, add $0.015/1K tokens cost
3. Route to Azure OpenAI GPT-4 (most expensive)
   → If all unavailable → return 503 Service Unavailable

Monthly cost tracking:
- vLLM: $0/month (fixed compute cost)
- Bedrock: Pay-per-token (actual spend)
- Azure OpenAI: Enterprise contract (fixed)

Strategy 3: Model Consolidation Recommendation

After 30 days, analyze:
- Which models were actually used?
- Which providers carried the load?
- Cost per model vs. usage

Recommendation:
"Claude 3 Sonnet via Bedrock: $1,200/month for 400M tokens
 Alternative: Llama 3.1 70B via self-hosted: $200/month compute"

Implementation: Connectivity Link + Kuadrant

Step 1: Install Connectivity Link

# Install via OpenShift OperatorHub or manual
oc new-project connectivity-link-system
oc apply -f connectivity-link-operator.yaml
oc wait --for=condition=Available deployment/connectivity-link-operator -n connectivity-link-system

Step 2: Configure Gateway

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: unified-ai-gateway
  namespace: openshift-ingress
spec:
  gatewayClassName: openshift-ai-gateway-class
  listeners:
    - name: https
      port: 443
      protocol: HTTPS
      tls:
        certificateRefs:
          - kind: Secret
            name: ai-gateway-tls
        mode: Terminate
      allowedRoutes:
        namespaces:
          from: Selector

Step 3: Create Multi-Provider HTTPRoute

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: unified-llm-endpoint
  namespace: ai-gateway-ns
spec:
  parentRefs:
    - group: gateway.networking.k8s.io
      kind: Gateway
      name: unified-ai-gateway
      namespace: openshift-ingress
  hostnames:
    - ai-gateway.example.com
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /v1/chat/completions
      backendRefs:
        # Primary: Self-hosted vLLM (weight 100 = try first)
        - group: serving.kserve.io
          kind: InferencePool
          name: llama-3-8b-local
          port: 8000
          weight: 100
        # Secondary: AWS Bedrock proxy service
        - group: v1
          kind: Service
          name: bedrock-proxy
          namespace: ai-gateway-ns
          port: 8080
          weight: 50
        # Tertiary: Azure OpenAI proxy
        - group: v1
          kind: Service
          name: azure-openai-proxy
          namespace: ai-gateway-ns
          port: 8080
          weight: 25

Step 4: Deploy Provider Proxy Services

# AWS Bedrock Proxy (translates OpenAI API → Bedrock API)
kubectl apply -f bedrock-proxy-deployment.yaml

# Azure OpenAI Proxy (translates OpenAI API → Azure API)
kubectl apply -f azure-proxy-deployment.yaml

Step 5: Apply Unified AuthPolicy

apiVersion: kuadrant.io/v1
kind: AuthPolicy
metadata:
  name: unified-ai-authpolicy
  namespace: openshift-ingress
spec:
  targetRef:
    group: gateway.networking.k8s.io
    kind: Gateway
    name: unified-ai-gateway
  rules:
    authentication:
      api-key:
        credentials:
          authorizationHeader:
            prefix: "Bearer"
        apiKey:
          selector:
            matchLabels:
              app: ai-gateway-apikey
      oidc:
        credentials:
          authorizationHeader:
            prefix: "Bearer"
        oidc:
          endpoint: "https://sso.example.com"
          clientID: "ai-gateway-client"
    authorization:
      provider-access:
        kubernetesSubjectAccessReview:
          resourceAttributes:
            group: serving.kserve.io
            resource: llms
            verb: access

Example: Client Request Flow

# Client sends unified request (OpenAI format)
curl https://ai-gateway.example.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Provider-Override: bedrock" \  # Optional: force provider
  -d '{
    "model": "claude-3-sonnet",
    "messages": [{"role": "user", "content": "Hello"}],
    "max_tokens": 256
  }'

# Gateway routing:
# 1. Authenticate API_KEY
# 2. Check X-Provider-Override header (bedrock) → route to Bedrock proxy
# 3. Bedrock proxy transforms OpenAI payload → Bedrock InvokeModel API
# 4. AWS Bedrock processes request
# 5. Bedrock proxy transforms response back to OpenAI format
# 6. Response returned to client in OpenAI format

# Response (OpenAI format, regardless of provider)
{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "created": 1719000000,
  "model": "claude-3-sonnet",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I assist you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 12,
    "total_tokens": 22
  }
}

Monitoring & Cost Tracking

# Track requests per provider
kubectl logs -f -n ai-gateway-ns deployment/gateway-controller | grep "provider="

# Query Prometheus for cost metrics
oc exec -it -n prometheus pod/prometheus-0 -- \
  query 'sum(rate(llm_tokens_total{provider="bedrock"}[1m])) by (model)'

# Generate cost report (Grafana dashboard)
# Dashboard: "AI Gateway Cost Attribution"
# Metrics:
#   - bedrock_tokens_total * bedrock_cost_per_1k_tokens
#   - azure_openai_api_calls * azure_cost_per_call
#   - vllm_compute_cost (fixed monthly)

Troubleshooting

IssueCauseSolution
All providers unavailableNetwork/credential issueCheck each provider endpoint health, verify credentials, check firewall rules
High latency through gatewayRouting overhead or provider slowReduce hops, enable response caching, check provider latency directly
Cost spike on one providerRate limit on primary, fallback to expensiveIncrease primary provider capacity, adjust fallback weights
401 Unauthorized from providerCredential rotation/expiryRotate API keys, update Secret, verify IAM roles (AWS)
Response format mismatchProvider API changedUpdate proxy transformation logic, test against provider SDK

Best Practices

  1. Route by capability, not provider: Define routes by task (chat, embedding, completion) not by provider name.
  2. Implement circuit breaker: Stop routing to provider after 5 consecutive failures; retry every 30 sec.
  3. Cache responses where safe: Cache embeddings & retrieval results to reduce provider costs.
  4. Log all requests: Audit trail for compliance & cost attribution.
  5. Test failover regularly: Monthly failover drills to verify secondary/tertiary providers work.
  6. Monitor cost anomalies: Alert on 20%+ daily cost variance.

References


Key Takeaway: A unified AI Gateway abstracts provider complexity from clients, enabling cost optimization, transparent failover, and unified governance across multi-cloud LLM infrastructure. Design for cost first, performance second.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,871. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.