Prompt
llm sdk python javascript
Latest observation
Oct 8, 2026
OpenAI APIWeb search: off
If you’re looking for LLM SDKs in Python and JavaScript, here are the most common options:
Python
Popular SDKs/libraries:
- OpenAI Python SDK — for OpenAI models
pip install openai
- Anthropic SDK — for Claude
pip install anthropic
- Google Gemini SDK
pip install google-generativeai
- LangChain — orchestration framework for multiple LLMs
pip install langchain
- LlamaIndex — retrieval + LLM apps
pip install llama-index
Example (OpenAI, Python):
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY")
resp = client.responses.create(
model="gpt-4.1-mini",
input="Write a short poem about the sea."
)
print(resp.output_text)
JavaScript / TypeScript
Popular SDKs/libraries:
- OpenAI JS SDK
npm install openai
- Anthropic SDK
npm install @anthropic-ai/sdk
- Google Gemini SDK
npm install @google/generative-ai
- LangChain JS
npm install langchain
- LlamaIndex TS
npm install llamaindex
Example (OpenAI, JavaScript):
import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const resp = await client.responses.create({
model: "gpt-4.1-mini",
input: "Write a short poem about the sea."
});
console.log(resp.output_text);
If you mean “which is better?”
- Python: better for AI/ML workflows, data processing, backend pipelines
- JavaScript: better for web apps, frontends, Node.js backends
Common choices
- Direct API SDK: OpenAI / Anthropic / Gemini
- Multi-model abstraction: LangChain
- RAG/document apps: LlamaIndex
If you want, I can also give you:
- a comparison table of Python vs JavaScript LLM SDKs, or
- a minimal working example for OpenAI in both languages.