Environment Setup: SDK, Auth, Dev Environment

AI Navigate Original / 5/16/2026

共有:

Key Points

  • Set up a minimal LLM-API environment for Node.js/Python
  • Install runtime, create project, .env + dotenv, first code
  • Pass keys via env vars; abstract providers with Vercel AI SDK
  • Use debug tools; know 401/429/400/500 common errors

Setting Up the Dev Environment

Here are the steps to set up a minimal environment for using LLM APIs, for Node.js / Python each.

Node.js Environment

1. Install Node.js

  • LTS version (v24+ recommended) from nodejs.org
  • Or version-manage with nvm / volta / fnm

2. Create a Project

mkdir my-ai-app && cd my-ai-app
npm init -y
npm install @anthropic-ai/sdk openai @google/genai
npm install -D typescript tsx @types/node
npx tsc --init

3. .env and dotenv

npm install dotenv

# .env
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=AIza...

4. First Code (TypeScript)

// index.ts
import "dotenv/config";
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();
const msg = await client.messages.create({
  model: "claude-opus-4-7",
  max_tokens: 256,
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(msg.content[0].text);

// Run
npx tsx index.ts

Python Environment

1. Install Python

  • Python 3.10+

Sign up to read the full article

Create a free account to access the full content of our original articles.