WorkWeave Router AI Model APIs: Complete Provider Support Guide

The WorkWeave Router supports 12+ AI model APIs—including OpenAI, Anthropic, Google Gemini, Azure OpenAI, Amazon Bedrock, Fireworks AI, OpenRouter, Together.ai, XAI, and generic OpenAI-compatible endpoints—through a unified adapter architecture defined in internal/providers/provider.go.

The WorkWeave Router acts as a unified entry point for external AI model providers, treating each API as a plugin that implements a common interface. This architecture enables the router to forward requests, translate wire formats, and apply cross-provider features like usage tracking and caching regardless of the underlying AI model API.

Supported AI Model APIs

The router defines provider constants in internal/providers/provider.go (lines 40-86), where each constant represents a distinct AI model API integration. These providers are categorized by their implementation strategy and target infrastructure.

Major Cloud Providers

OpenAI (ProviderOpenAI) implements the native OpenAI REST API using v1/chat/completions endpoints. The adapter resides in internal/providers/openai/client.go and handles standard GPT model families including gpt-4o and gpt-4o-mini.

Anthropic (ProviderAnthropic) connects to Claude models via the v1/messages API. The dedicated adapter in internal/providers/anthropic/client.go manages Anthropic's unique message format and streaming protocols.

Google (Gemini) (ProviderGoogle) interfaces with Google's Gemini models through the native v1beta/models/:modelAction endpoint. The implementation in internal/providers/google/native_client.go handles Google's distinct request/response schema separate from OpenAI compatibility layers.

Azure OpenAI (ProviderAzure) supports Azure-hosted OpenAI deployments via internal/providers/azure.go, allowing enterprise users to route through private Azure endpoints while maintaining OpenAI API compatibility.

Specialized Inference Platforms

Amazon Bedrock (ProviderBedrock), Fireworks AI (ProviderFireworks), OpenRouter (ProviderOpenRouter), Together.ai (ProviderTogether), and XAI (ProviderXAI) all leverage the generic OpenAI-compatible adapter found in internal/providers/openaicompat/client.go. These providers expose OpenAI-style endpoints but route to specialized inference infrastructure. The router distinguishes these via unique provider constants while reusing the compatibility translation layer.

Cortex and CortexAgents implement dedicated adapters in internal/providers/cortex.go and internal/providers/cortexagents/client.go for Cortex-based inference services, supporting both direct Cortex API access and agent-specific endpoints.

How the Router Manages Provider Integration

The Adapter Pattern in internal/providers/

Each AI model API lives in its own package under internal/providers/<name>/ and implements the shared Provider interface. This design keeps the routing core I/O-free and provider-agnostic. For example, internal/providers/openai/client.go and internal/providers/anthropic/client.go both satisfy the same interface but handle provider-specific authentication, path construction, and error parsing.

The internal/translate package normalizes requests to a common internal representation, then rewrites them for the target provider. This allows the router to accept OpenAI-formatted requests while internally translating them to Anthropic's v1/messages format or Google's Gemini schema when necessary.

Dynamic Provider Selection Logic

The router selects providers based on the requested model name, HTTP headers, or cluster-level overrides. When a request arrives, the catalog in internal/router/catalog/catalog.go maps model names (e.g., gpt-4o, claude-3-5-sonnet-20241022) to their respective provider constants. The router then injects the x-router-provider header into responses for observability, allowing clients to track which backend AI model API actually served the request.

Registration occurs in cmd/router/main.go, where the composition root wires all enabled providers:

// Provider registration in the router composition root
func registerProviders(r router.Builder) {
    r.RegisterProvider(providers.ProviderOpenAI, providers.NewOpenAIClient())
    r.RegisterProvider(providers.ProviderAnthropic, providers.NewAnthropicClient())
    r.RegisterProvider(providers.ProviderGoogle, providers.NewGoogleClient())
    r.RegisterProvider(providers.ProviderBedrock, providers.NewOpenAICompatClient("bedrock"))
    r.RegisterProvider(providers.ProviderFireworks, providers.NewOpenAICompatClient("fireworks"))
}

Configuration and Usage Examples

Client-Side API Calls

Clients interact with the router using standard OpenAI-compatible HTTP requests. The router handles provider selection automatically, though you can override it via headers for testing:

package main

import (
    "bytes"
    "net/http"
)

func callRouter() (*http.Response, error) {
    payload := []byte(`{
        "model": "gpt-4o",
        "messages": [{"role": "user", "content": "Explain the adapter pattern"}]
    }`)
    
    req, _ := http.NewRequest(
        "POST", 
        "https://router.workweave.com/v1/chat/completions", 
        bytes.NewReader(payload),
    )
    req.Header.Set("Content-Type", "application/json")
    
    // Optional: Force specific AI model API provider for testing
    // req.Header.Set("x-router-provider", "anthropic")
    
    return http.DefaultClient.Do(req)
}

Adding Models to the Catalog

New models are registered in internal/router/catalog/catalog.go by mapping them to their respective provider constants:

package catalog

import "github.com/workweave/router/internal/providers"

func init() {
    RegisterModel(ModelEntry{
        ModelName:  "claude-3-5-sonnet-20241022",
        Provider:   providers.ProviderAnthropic,
        Tier:       TierStandard,
        MaxTokens:  200000,
        Pricing: Pricing{
            Prompt:     0.003,
            Completion: 0.015,
        },
    })
}

Summary

  • The WorkWeave Router supports 12+ AI model APIs through constants defined in internal/providers/provider.go, including OpenAI, Anthropic, Google, Azure, Bedrock, Fireworks, OpenRouter, Together, XAI, Cortex, and generic OpenAI-compatible endpoints.
  • Provider-specific adapters live in internal/providers/<name>/ and implement a unified interface, while the internal/translate package handles wire-format conversion between OpenAI, Anthropic, and Google schemas.
  • Amazon Bedrock, Fireworks, OpenRouter, Together.ai, and XAI reuse the openaicompat adapter but maintain distinct provider constants for routing logic and observability.
  • Dynamic provider selection occurs via the catalog (internal/router/catalog/catalog.go), which maps model names to provider constants and enables cluster-level overrides through the x-router-provider header.

Frequently Asked Questions

How do I add a new AI model API to WorkWeave Router?

Create a new package under internal/providers/<providername>/ implementing the Provider interface, then add a constant like ProviderNewName to internal/providers/provider.go. Register the provider in cmd/router/main.go using r.RegisterProvider(), and add supported models to internal/router/catalog/catalog.go with the appropriate pricing and token limits.

What is the difference between ProviderBedrock and the native OpenAI provider?

ProviderOpenAI uses the dedicated internal/providers/openai/client.go adapter for native OpenAI endpoints, while ProviderBedrock uses internal/providers/openaicompat/client.go to translate requests for Amazon Bedrock's OpenAI-compatible inference endpoints. Both accept similar request formats, but Bedrock uses AWS Signature Version 4 authentication handled within the compatibility layer.

How does the router handle API format differences between Anthropic and OpenAI?

The internal/translate package converts incoming OpenAI-formatted requests to provider-native formats. For Anthropic, it transforms the messages array and model parameters to match the v1/messages schema, then converts the Claude response back to OpenAI's chat.completion format before returning to the client.

Can I force a specific AI model API provider for a request?

Yes. While the router automatically selects providers based on the model name in internal/router/catalog/catalog.go, you can override this by setting the x-router-provider header to a specific constant value (e.g., anthropic, openai, bedrock). The router will attempt to route to that provider and include the selected provider in the response headers for debugging.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →