Sunday, July 06, 2025

OpenAI API: Responses vs. Chat Completions

Responses vs. Chat Completions - OpenAI API

The Responses API and Chat Completions API are two different ways to interact with OpenAI's models.

The Chat Completions API is an "industry standard" for building AI applications
(some other LLM APIs provide same or similar API)

The Responses API is our newest core API and an agentic API primitive, combining the simplicity of Chat Completions with the ability to do more agentic tasks. As model capabilities evolve, the Responses API is a flexible foundation for building action-oriented applications, with built-in tools:

Events are simpler with the Responses API. It has a predictable, event-driven architecture, whereas the Chat Completions API continuously appends to the content field as tokens are generated—requiring you to manually track differences between each state. Multi-step conversational logic and reasoning are easier to implement with the Responses API.

TypeScript tool: tsx vs ts-node

Key differences between ts-node and tsx:

  • tsx: Faster, more modern TypeScript runner built on top of esbuild
  • ts-node: Traditional TypeScript runner that uses the TypeScript compiler directly

tsx advantages:

  • Much faster compilation (uses esbuild under the hood)
  • Better ESM (ES modules) support
  • Smaller and more focused
  • Less configuration needed
  • Works better in containerized environments

Running TypeScript in Node.js: tsx vs. ts-node vs. native - LogRocket Blog


Frequently Asked Questions | tsx

Node.js — Running TypeScript with a runner

tsx - npm

ts-node - npm

TypeScript Execute (tsx)

tsx stands for TypeScript Execute and it's a Node.js enhancement to run TypeScript.

For starters, think of tsx as an alias to node and use it the same way:

sh
node file.js

sh
tsx file.ts

You can pass in Node CLI flags and JS files too:

sh
tsx --env-file=.env ./file.js