All integrations
🔗

LangChain

ChatOpenAI / ChatAnthropic with base URL pointed at clawfeeder

Protocol: BothLast verified 2026-05-19

LangChain's chat model abstractions accept base_url, so any chain / agent / RAG pipeline built on LangChain works against clawfeeder without changing higher-level code. Both Python (langchain-openai, langchain-anthropic) and TS (@langchain/openai, @langchain/anthropic) are supported.

Prerequisites

Python 3.9+ or Node 18+, langchain core + provider package installed, a clawfeeder API key.

Steps

1Install packages

Install the provider package for whichever model family you'll use most.

pip install langchain langchain-openai langchain-anthropic
# or:
npm install langchain @langchain/openai @langchain/anthropic

2Python: ChatOpenAI for any clawfeeder model

ChatOpenAI's `base_url` param redirects requests. clawfeeder's OpenAI-compatible endpoint accepts claude-* and gemini-* IDs as well — keeping you on a single class for the whole catalog.

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    base_url="https://clawfeeder.ai/v1",
    api_key="cf-sk-***your_key***",
    model="gpt-5.2",
    temperature=0.7,
)

resp = llm.invoke("What is the capital of France?")
print(resp.content)

3Python: ChatAnthropic for native Anthropic flow

If you need Anthropic-specific features (cache_control hints, fine-grained content blocks), use ChatAnthropic with base_url override.

from langchain_anthropic import ChatAnthropic

# anthropic_api_url is the bare host (no /v1) — same as the Anthropic SDK.
llm = ChatAnthropic(
    anthropic_api_url="https://clawfeeder.ai",
    api_key="cf-sk-***your_key***",
    model="claude-opus-4-7",
    max_tokens=1024,
)

resp = llm.invoke("Explain MVCC in one paragraph.")
print(resp.content)

4TypeScript: same pattern

TS uses configuration objects to BaseChatModel constructors.

import { ChatOpenAI } from "@langchain/openai";

const llm = new ChatOpenAI({
  configuration: { baseURL: "https://clawfeeder.ai/v1" },
  apiKey: "cf-sk-***your_key***",
  model: "gpt-5.2",
  temperature: 0.7,
});

const resp = await llm.invoke("Hello!");
console.log(resp.content);

Verify

One-liner that mounts ChatOpenAI against clawfeeder and roundtrips a tiny request.

from langchain_openai import ChatOpenAI; print(ChatOpenAI(base_url="https://clawfeeder.ai/v1", api_key="cf-sk-***", model="gpt-5.2").invoke("reply READY").content)

Expected response includes: READY

FAQ

Should I prefer ChatOpenAI or ChatAnthropic for Claude models?

ChatOpenAI is simpler — one class for the whole catalog. ChatAnthropic gives you native Anthropic content blocks (image, tool_use), better when you build a Claude-only pipeline that uses those features intentionally.

Streaming with LangChain — supported?

Yes. Use llm.stream() or set streaming=True on the constructor. clawfeeder forwards SSE chunks; LangChain reassembles them into AIMessageChunk yields.

LangGraph / agents — anything special?

No. Agents do many short calls; budget credits accordingly (a 10-step agent loop ~= 10 chat completions). For development use claude-haiku-4-5-20251001 or gpt-5.2; switch flagship only for production where step quality dominates step count.

Why does my custom callback never see usage data?

Streaming responses populate `response_metadata.token_usage` only on the final chunk. Use a `BaseCallbackHandler` with on_llm_end (not on_llm_new_token) to capture totals. clawfeeder always returns usage in the final chunk's frame.

Don't have an API key yet?

Sign up for 300 free credits, 7-day trial, all models

Get started free →
LangChain × clawfeeder.ai — Integration Guide