Getting started
Quickstart
A step-by-step guide to making your first AI API request — SDK installation, API key setup, and a working sample in three short steps.
Install the SDK
Install the official Vertex SDK for your language. The SDK handles authentication, retries, and streaming for you.
# Node.js 18+
npm install @vertex-ai/sdk
Set up your API key
Create a key in your dashboard, then export it as an environment variable. Never hard-code keys in source control.
export VERTEX_API_KEY=sk-••••••••••
Make your first request
Run this snippet. You'll get a completion back in a single synchronous call — no configuration required.
import Vertex from "@vertex-ai/sdk";
const client = new Vertex();
const res = await client.chat.completions.create({
model: "vertex-large-2",
messages: [{ role: "user", content: "Explain embeddings in one sentence." }],
});
console.log(res.choices[0].message.content);
Expected output
"Embeddings are dense vector representations that let a model measure how similar two pieces of text are."
Next steps
Now that your first request works, go deeper with the full reference or the task-oriented guides.