LLM APIs Work in "30 Lines of Code"
Want to embed ChatGPT or Claude into your app? The basic use actually works in 30 lines after installing each company's SDK. This article explains the first run, comparing the 2 major APIs—Claude (Anthropic) and GPT (OpenAI)—side by side.
Getting an API Key
OpenAI
- Go to platform.openai.com → "API keys"
- Create a new key → shown only once, so copy it
- Credit deposit needed (from USD 5)
Anthropic
- console.anthropic.com → "API Keys"
- Create a new key → likewise shown only once
- Credit deposit needed (from USD 5)
Environment Setup
# Node.js npm install @anthropic-ai/sdk openai # Python pip install anthropic openai
API keys in .env:
ANTHROPIC_API_KEY=sk-ant-... OPENAI_API_KEY=sk-...




