# Use Hanzo AI with TypeScript — Hanzo AI > Use Hanzo AI in TypeScript and Node.js with the OpenAI SDK, Vercel AI SDK, or raw fetch. Full type safety and async/streaming support. [Integrations](https://hanzo.ai/integrations)/TypeScript 🟦Languages # Use Hanzo AI with TypeScript Use Hanzo AI in TypeScript and Node.js with the OpenAI SDK, Vercel AI SDK, or raw fetch. Full type safety and async/streaming support. Base URL: `https://api.hanzo.ai/v1` API Key: Get yours at [hanzo.ai/signup](https://hanzo.ai/signup) · Fully OpenAI-compatible · 500+ models available 🟦 Created by [Microsoft](https://typescriptlang.org) License: Apache-2.0 · [View source on GitHub →](https://github.com/microsoft/TypeScript) Hanzo AI is OpenAI-compatible, so existing TypeScript code works with zero refactoring. We deeply appreciate the Microsoft team for building and maintaining this open-source project. ## OpenAI SDK typescript ``` npm install openai import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.hanzo.ai/v1", apiKey: process.env.HANZO_API_KEY, }); const response = await client.chat.completions.create({ model: "zen4-pro", messages: [{ role: "user", content: "Hello!" }], }); console.log(response.choices[0].message.content); ``` ## Streaming typescript ``` const stream = await client.chat.completions.create({ model: "zen4-pro", messages: [{ role: "user", content: "Stream this" }], stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); } ``` ## Next.js API route typescript ``` // app/api/generate/route.ts import OpenAI from "openai"; import { NextResponse } from "next/server"; const client = new OpenAI({ baseURL: "https://api.hanzo.ai/v1", apiKey: process.env.HANZO_API_KEY, }); export async function POST(req: Request) { const { prompt } = await req.json(); const response = await client.chat.completions.create({ model: "zen4-pro", messages: [{ role: "user", content: prompt }], }); return NextResponse.json(response.choices[0].message); } ``` ## List models typescript ``` const models = await client.models.list(); console.log(`Available: ${models.data.length} models`); models.data.slice(0, 5).forEach((m) => console.log(m.id)); ``` ## Ready to get started? Create a free account and get your API key. 100K API calls/month free forever. [Get API Key — Free](https://hanzo.ai/signup)[Browse Models](https://hanzo.ai/models) ## More integrations [OpenAI Python SDK](https://hanzo.ai/integrations/openai-sdk)[Anthropic SDK](https://hanzo.ai/integrations/anthropic-sdk)[LangChain](https://hanzo.ai/integrations/langchain)[LlamaIndex](https://hanzo.ai/integrations/llamaindex)[Vercel AI SDK](https://hanzo.ai/integrations/vercel-ai-sdk)[Hugging Face](https://hanzo.ai/integrations/huggingface)[AutoGen](https://hanzo.ai/integrations/autogen)[CrewAI](https://hanzo.ai/integrations/crewai)[DSPy](https://hanzo.ai/integrations/dspy)[Haystack](https://hanzo.ai/integrations/haystack)[Cursor](https://hanzo.ai/integrations/cursor)[Continue.dev](https://hanzo.ai/integrations/continue-dev)[GitHub Copilot](https://hanzo.ai/integrations/github-copilot)[Docker](https://hanzo.ai/integrations/docker)[Kubernetes](https://hanzo.ai/integrations/kubernetes)[Python](https://hanzo.ai/integrations/python)[Go](https://hanzo.ai/integrations/go)[Rust](https://hanzo.ai/integrations/rust)