Skip to content

Add Morph Model Router as a routing backend #18

@bhaktatejas922

Description

@bhaktatejas922

ccproxy already does "intelligent model routing using your logic or ours." Morph's Model Router is a natural "ours" backend.

It classifies a prompt in ~50ms and returns difficulty (easy/medium/hard), ambiguity, and domain (coding/data/design/general), then maps that to a model. One POST, OpenAI-compatible:

const res = await fetch("https://api.morphllm.com/v1/router/multimodel", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.MORPH_API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ input: userInput, allowed_providers: ["anthropic", "openai"], policy: "balanced" }),
});
const { model } = await res.json();

/router/multimodel takes allowed_providers and a policy (balanced, cost_efficient, capability_heavy) and returns one model name. ~180ms over HTTP/2. Wiring it into the routing hook lets users route without writing their own classifier.

Docs: https://docs.morphllm.com/sdk/components/router

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions