Back to blog
Developer GuideMarch 18, 2026· 4 min read

OpenAI SDK Compatibility: Switch Models in 2 Lines

Drop-in replacement for the OpenAI SDK

If you're already using the OpenAI SDK, switching to clawfeeder.ai takes two lines:

from openai import OpenAI

client = OpenAI(
    api_key="cf-your-key-here",
    base_url="https://api.clawfeeder.ai/v1",
)

That's it. All your existing code works as-is. The chat.completions.create method, streaming, function calling, tool use — all compatible.

Accessing non-OpenAI models

The magic is in the model name. Pass any model ID from our supported list:

# Claude via Anthropic
response = client.chat.completions.create(
    model="claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Hello"}],
)

# DeepSeek
response = client.chat.completions.create(
    model="deepseek-v3",
    messages=[{"role": "user", "content": "Hello"}],
)

# Gemini
response = client.chat.completions.create(
    model="gemini-2.0-flash",
    messages=[{"role": "user", "content": "Hello"}],
)

Streaming

Streaming works exactly as you'd expect:

stream = client.chat.completions.create(
    model="claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Write a haiku about APIs"}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

Node.js

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'cf-your-key-here',
  baseURL: 'https://api.clawfeeder.ai/v1',
});

Everything else is identical to the standard OpenAI Node.js SDK usage.

What about features that don't exist in all models?

If you request a capability that a specific model doesn't support (like function calling on a model that doesn't support it), we return an appropriate error. Check our docs for a full compatibility matrix.

Try clawfeeder.ai for free

7-day free trial · 300 credits · No card required

Get started free →
OpenAI SDK Compatibility: Switch Models in 2 Lines — clawfeeder.ai