Skip to content
CheapLLM

Use CheapLLM with the OpenAI SDK

Connect the official OpenAI SDK to the CheapLLM-compatible API.

15 min readUpdated Nov 2026

1. Install the SDK

In a Node.js project install the official openai package if it is not there yet. The examples use the JavaScript/TypeScript client. Note that the CheapLLM site is still a demonstration and the API does not accept requests yet; the configuration below is the target setup.

Terminal
pnpm add openai

2. Provide the key

Export the key before starting the app. The client below reads it from CHEAPLLM_API_KEY, so the value never appears in the source code.

Bash or Zsh
export CHEAPLLM_API_KEY="YOUR_CHEAPLLM_API_KEY"

3. Configure the client

Pass the CheapLLM base URL to the SDK and pick a model from the catalog. The SDK appends the Chat Completions path to that address.

client.ts
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.CHEAPLLM_API_KEY,
  baseURL: "https://api.cheapllm.com/v1",
});

4. Send a request

Call chat.completions.create for the OpenAI-compatible Chat Completions API. Replace MODEL_ID with an identifier that your key can use.

client.ts
const response = await client.chat.completions.create({
  model: "MODEL_ID",
  messages: [{ role: "user", content: "Hello!" }],
});

console.log(response.choices[0]?.message.content);

Top models to run in OpenAI SDK

All 48+ models →
ModelOfficial (in / out)CheapLLM (in / out)Savings
Claude Opus 5.5$4.00 / $20.00$2.80 / $14.00−30%
GPT-6.1 Sol$2.00 / $10.00$1.40 / $7.00−30%
Gemini 4 Argon$2.00 / $10.00$1.40 / $7.00−30%
DeepSeek V4 Pro 0813$0.11 / $4.44$0.078 / $3.11−30%
← All 54 setup guides