Skip to content

LLM Layer: Decouple Protocols from Providers #781

Description

@lmorchard

Concept from opencode:
opencode strictly decouples API connection configuration from the message payload structure. Protocols handle the wire format (openai-chat, anthropic-messages), while Providers act as thin facades for Base URLs and Auth headers.

How decafclaw could implement this:
decafclaw currently conflates connection setup and wire format inside each provider class (e.g., in src/decafclaw/llm/providers/openai_compat.py).

Proposed Implementation:

  • Separate the "Wire Protocol" (formatting messages to Anthropic XML vs OpenAI JSON) from the "Connection Provider" (URL, Auth, Rate Limits).
  • This separation allows decafclaw to easily support numerous OpenAI-compatible APIs (Groq, Together, vLLM) by simply instantiating new provider facades that reuse the core openai_compat protocol logic.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions