Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Knock-Knock Joke Example

Two AI models take turns telling a knock-knock joke while measuring response times.

Models Used

  • Fast model: gpt-4.1 - Delivers the joke setup and punchline
  • Smart model: claude-opus-4.5 - Responds to the joke (premium model)

Run

cd nodejs
npm install
npx tsx examples/knock-knock.ts

Sample Output

🚪 Knock-Knock Joke: Two Models Battle!

Fast model: gpt-4.1
Smart model: claude-opus-4.5

──────────────────────────────────────────────────
🏃 gpt-4.1: Knock knock!
🧠 claude-opus-4.5: Who's there?
🏃 gpt-4.1: Olive
🧠 claude-opus-4.5: Olive who?
🏃 gpt-4.1: Olive you and I miss you!
──────────────────────────────────────────────────

⏱️  Response Times:

🏃 gpt-4.1              | Knock knock  |  4490ms
🧠 claude-opus-4.5      | Who's there? |  2478ms
🏃 gpt-4.1              | Setup        |  1289ms
🧠 claude-opus-4.5      | Who?         |  2713ms
🏃 gpt-4.1              | Punchline    |  1257ms
──────────────────────────────────────────────────
🏃 gpt-4.1 total: 7035ms (3 turns)
🧠 claude-opus-4.5 total: 5191ms (2 turns)

🏆 claude-opus-4.5 was faster!

Customize

Edit the constants at the top of knock-knock.ts to try different models:

const FAST_MODEL = "gpt-4.1";
const SMART_MODEL = "claude-opus-4.5";

Available Models & Rate Limits

Model Tiers

Tier Models Notes
Free/Fast gpt-4.1, gpt-5-mini, gpt-5.1-codex-mini, claude-haiku-4.5 Cheap/fast, good for simple tasks
Standard gpt-5, gpt-5.1, gpt-5.2, claude-sonnet-4.5, gemini-3-pro-preview 1 premium request each
Premium claude-opus-4.5 Most capable, uses more quota

Rate Limiting

  • Monthly quota: Depends on your plan (Free: 50, Pro: 300, Enterprise: 1000+)
  • Burst limit: Hidden anti-abuse limit - if you spam requests too fast, you get temporarily throttled for a few minutes
  • The exact burst limit isn't disclosed publicly (by design)

TL;DR: Use gpt-4.1 or gpt-5-mini for fast/cheap stuff. Use claude-opus-4.5 when you need the big brain.