Popular Sdks

Popular SDKs

Use the official SDKs and point their base URLs at KushRouter. Your API key is the same across providers.

Base URL: https://api.kushrouter.com

  • OpenAI-compatible routes live under /api/openai
  • Anthropic-compatible routes live under /api/anthropic

OpenAI (Node.js / TypeScript)

Install:

npm install openai

Client setup and basic chat:

import OpenAI from 'openai'
 
const client = new OpenAI({
  apiKey: process.env.KUSHROUTER_API_KEY!,
  baseURL: 'https://api.kushrouter.com/api/openai'
})
 
const result = await client.chat.completions.create({
  model: 'gpt-4o-mini',
  messages: [{ role: 'user', content: 'Hello from KushRouter!' }]
})

Anthropic (JavaScript)

Install:

npm install @anthropic-ai/sdk

Client setup and basic message:

import Anthropic from '@anthropic-ai/sdk'
 
const client = new Anthropic({
  apiKey: process.env.KUSHROUTER_API_KEY!,
  baseURL: 'https://api.kushrouter.com/api/anthropic'
})
 
const result = await client.messages.create({
  model: 'claude-3-5-sonnet-20241022',
  max_tokens: 300,
  messages: [{ role: 'user', content: 'Summarise KushRouter benefits.' }]
})

Vercel AI SDK (React/TypeScript)

Install:

npm install ai react@latest

Client configuration:

import { createOpenAI } from 'ai'
 
export const openai = createOpenAI({
  apiKey: process.env.KUSHROUTER_API_KEY!,
  baseURL: 'https://api.kushrouter.com/api/openai'
})

Python openai package

Install:

pip install openai

Client and basic chat:

from openai import OpenAI
import os
 
client = OpenAI(
    api_key=os.environ['KUSHROUTER_API_KEY'],
    base_url='https://api.kushrouter.com/api/openai'
)
 
response = client.chat.completions.create(
    model='gpt-4o-mini',
    messages=[{'role': 'user', 'content': 'Generate a product description.'}]
)

Looking for more? See the full SDK Examples page.