Integrate VietAI Gateway into your applications and IDEs
VietAI Gateway is 100% compatible with OpenAI API. Just change the base_url and api_key.
https://vertex-key.com/api/v1vai-xxxxxxxxxx (get from Dashboard)Claude Code is Anthropic's official CLI tool for coding with Claude. Connect it to VietAI Gateway to use all available models.
/v1/messages vào base URL. Dùng https://vertex-key.com/api (không có /v1) để tránh bị trùng path. Gateway hỗ trợ cả hai format nhưng khuyến nghị dùng format chuẩn.Set these environment variables before running claude:
# Linux / macOS
export ANTHROPIC_BASE_URL=https://vertex-key.com/api
export ANTHROPIC_API_KEY=vai-your-api-key-here
# Windows (PowerShell)
$env:ANTHROPIC_BASE_URL="https://vertex-key.com/api"
$env:ANTHROPIC_API_KEY="vai-your-api-key-here"
# Then run Claude Code as normal
claudeSpecify model directly when launching:
# Use specific model tier
claude --model omega/claude-opus-4-6
claude --model flash/claude-opus-4-6
claude --model flash/claude-sonnet-4-6
claude --model omega/claude-sonnet-4-6Add to your Claude Code settings file for permanent configuration:
{
"env": {
"ANTHROPIC_BASE_URL": "https://vertex-key.com/api",
"ANTHROPIC_API_KEY": "vai-your-api-key-here"
}
}omega/claude-opus-4-6 — Best quality, tool use supportomega/claude-sonnet-4-6 — Tool use + fastflash/claude-opus-4-6 — Fast response, 1M contextflash/claude-sonnet-4-6 — Fastest, budget-friendlyvai-xxx API key (from Dashboard). Model IDs use dashes: claude-opus-4-6 (not dots). Cả https://vertex-key.com/api và https://vertex-key.com/api/v1 đều hoạt động.Add VietAI Gateway as an AI provider in Cursor IDE.
Go to Cursor Settings → Models → OpenAI API Key
Base URL: https://vertex-key.com/api/v1
API Key: vai-your-api-key-hereIn the model list, click + Add Model and enter these model IDs:
omega/claude-opus-4-6 (best quality, tool use)
omega/claude-sonnet-4-6 (fast + tool use)
flash/claude-opus-4-6 (fast response)
flash/claude-sonnet-4-6 (fastest Claude)
pro/gpt-5.2 (best GPT, reasoning)
pro/gpt-5.3-codex-xhigh (best for code)
gem/gemini-3.1-pro-preview (Gemini latest)omega/ models (tool use support) or flash/ models (fastest response). Both work great for code completion and chat.vai-xxx API key (from Dashboard), not the original sk-xxx key. Model IDs accept both formats: claude-opus-4-6 or claude-opus-4.6.Open file ~/.continue/config.json and add:
{
"models": [
{
"title": "Claude Opus 4.6 (Omega)",
"provider": "openai",
"model": "omega/claude-opus-4-6",
"apiBase": "https://vertex-key.com/api/v1",
"apiKey": "vai-your-api-key-here"
},
{
"title": "Claude Sonnet 4.6 (Flash)",
"provider": "openai",
"model": "flash/claude-sonnet-4-6",
"apiBase": "https://vertex-key.com/api/v1",
"apiKey": "vai-your-api-key-here"
},
{
"title": "GPT-5.2 (Pro)",
"provider": "openai",
"model": "pro/gpt-5.2",
"apiBase": "https://vertex-key.com/api/v1",
"apiKey": "vai-your-api-key-here"
},
{
"title": "GPT-5.3 Codex (Pro)",
"provider": "openai",
"model": "pro/gpt-5.3-codex-xhigh",
"apiBase": "https://vertex-key.com/api/v1",
"apiKey": "vai-your-api-key-here"
}
],
"tabAutocompleteModel": {
"title": "Claude Haiku 4.5 (Fast)",
"provider": "openai",
"model": "lite/claude-haiku-4-5",
"apiBase": "https://vertex-key.com/api/v1",
"apiKey": "vai-your-api-key-here"
}
}lite/claude-haiku-4-5 for tab autocomplete (fast + cheap). Use omega/ or pro/ models for chat.In Cline/Roo Code settings, select API Provider: OpenAI Compatible
API Provider: OpenAI Compatible
Base URL: https://vertex-key.com/api/v1
API Key: vai-your-api-key-here
Model ID: omega/claude-opus-4-6omega/claude-opus-4-6 — Best quality, tool use supportomega/claude-sonnet-4-6 — Fast + tool usepro/gpt-5.3-codex-xhigh — Best GPT for codeflash/claude-opus-4-6 — Fast response, 1M contextflash/claude-sonnet-4-6 — Fastest, budget-friendlyomega/ tier models for best tool use compatibility.OpenClaw is an AI agent framework. Configure it to use VietAI Gateway models.
Add this configuration to your OpenClaw config file:
{
"models": {
"providers": {
"vertex-key": {
"baseUrl": "https://vertex-key.com/api/v1",
"apiKey": "vai-your-api-key-here",
"api": "openai-completions",
"models": [
{
"id": "omega/claude-opus-4-6",
"name": "Claude Opus 4.6 (Omega)",
"reasoning": true,
"input": ["text"],
"contextWindow": 1000000,
"maxTokens": 128000
},
{
"id": "flash/claude-opus-4-6",
"name": "Claude Opus 4.6 (Flash)",
"reasoning": true,
"input": ["text"],
"contextWindow": 1000000,
"maxTokens": 128000
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "vertex-key/omega/claude-opus-4-6"
}
}
}
}flash/ models (fast) for OpenClaw agents. Use omega/ if you need tool use support.pip install openaifrom openai import OpenAI
client = OpenAI(
api_key="vai-your-api-key-here",
base_url="https://vertex-key.com/api/v1"
)
# Chat
response = client.chat.completions.create(
model="omega/claude-sonnet-4-6",
messages=[
{"role": "system", "content": "You are a smart AI assistant."},
{"role": "user", "content": "Hello!"}
],
temperature=0.7,
max_tokens=1024
)
print(response.choices[0].message.content)
# Streaming
stream = client.chat.completions.create(
model="pro/gpt-5.2",
messages=[{"role": "user", "content": "Write a poem about Hanoi"}],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
# Vision
response = client.chat.completions.create(
model="omega/claude-opus-4-6",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "Describe this image"},
{"type": "image_url", "image_url": {"url": "https://example.com/img.jpg"}}
]
}]
)import OpenAI from "openai";
const client = new OpenAI({
apiKey: "vai-your-api-key-here",
baseURL: "https://vertex-key.com/api/v1",
});
const response = await client.chat.completions.create({
model: "omega/claude-opus-4-6",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);curl https://vertex-key.com/api/v1/chat/completions \
-H "Authorization: Bearer vai-your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"model": "omega/claude-sonnet-4-6",
"messages": [{"role": "user", "content": "Hello!"}],
"temperature": 0.7,
"max_tokens": 1024
}'Generate images using OpenAI-compatible endpoint. Supports Gemini 3.1 (1K/2K/4K), Gemini 2.5 Flash, Nano Banana 2, GPT Image, Sora Image, and more.
| Model ID | Resolution | Price |
|---|---|---|
| gemini-image-1k | 1408×768 (1K) | $0.36/req |
| gemini-image-2k | 2816×1536 (2K) | $0.45/req |
| gemini-image-4k | 5632×3072 (4K) | $0.50/req |
| gemini-2.5-flash-image | 1024×1024 | $0.25/req |
| gpt-image-1.5 | 1024×1024 | $0.36/req |
| max/gemini-3.1-image-1k | 1408×768 (1K) 🔥 | $0.49/req |
| max/gemini-3.1-image-2k | 2816×1536 (2K) 🔥 | $0.65/req |
| max/gemini-3.1-image-4k | 5632×3072 (4K) 🔥 | $0.81/req |
| max/gemini-2.5-flash-image | 1024×1024 🔥 | $0.32/req |
| max/gemini-3.1-image-1k-p | 1408×768 (1K) 🔥 | $0.49/req |
| max/gemini-3.1-image-2k-p | 2816×1536 (2K) 🔥 | $0.65/req |
| max/gemini-3.1-image-4k-p | 5632×3072 (4K) 🔥 | $0.81/req |
| max/nano-banana-2-1k | 1408×768 (1K) 🔥 | $0.65/req |
| max/nano-banana-2-2k | 2816×1536 (2K) 🔥 | $0.81/req |
| max/nano-banana-2-4k | 5632×3072 (4K) 🔥 | $0.97/req |
| max/gpt-image-1.5 | 1024×1024 🔥 | $0.49/req |
| max/gpt-image-1 | 1024×1024 🔥 | $0.49/req |
| max/sora-image | 1024×1024 🔥 | $0.49/req |
| max/sora-image-vip | 1024×1024 🔥 | $0.49/req |
| max/gpt-4o-image | 1024×1024 🔥 | $0.49/req |
from openai import OpenAI
client = OpenAI(
api_key="vai-your-api-key-here",
base_url="https://vertex-key.com/api/v1"
)
# Generate image
response = client.images.generate(
model="gemini-image-1k", # or max/gemini-3.1-image-4k
prompt="A cute cat wearing a tiny hat, photorealistic",
n=1,
size="1024x1024"
)
# Get image URL or base64
image_url = response.data[0].url
print(f"Image URL: {image_url}")
# If response contains base64
if response.data[0].b64_json:
import base64
img_bytes = base64.b64decode(response.data[0].b64_json)
with open("output.png", "wb") as f:
f.write(img_bytes)curl https://vertex-key.com/api/v1/images/generations \
-H "Authorization: Bearer vai-your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"model": "max/gemini-3.1-image-4k",
"prompt": "Mountain landscape at sunset, photorealistic",
"n": 1,
"size": "1024x1024"
}'import OpenAI from "openai";
const client = new OpenAI({
apiKey: "vai-your-api-key-here",
baseURL: "https://vertex-key.com/api/v1",
});
const response = await client.images.generate({
model: "max/gemini-3.1-image-1k",
prompt: "A futuristic cityscape at night",
n: 1,
size: "1024x1024",
});
console.log("Image URL:", response.data[0].url);gemini-image-* có Auto Failover — tự động chuyển provider khi lỗimax/) — ổn định hơn, giá cao hơnurl hoặc b64_json tùy modelGenerate videos using AI models. Supports Grok Video 3, Veo 3.1 (3 mức giá), and Image-to-Video.
| Model ID | Duration | Resolution | Speed | Price |
|---|---|---|---|---|
| imy/grok-video-3 | 6s | 720p | — | $0.36/video |
| imy/grok-video-3-10s | 10s | 720p | — | $0.46/video |
| imy/grok-video-3-15s | 15s | 720p | — | $0.66/video |
| imy/veo_3_1-fast-slow | 5s | 720p | 🐢 Chậm | $0.90/video |
| imy/veo_3_1-fast-medium | 5s | 720p | ⚡ Nhanh | $1.65/video |
| imy/veo_3_1-fast-premium | 5s | 720p | 🚀 Cao | $2.25/video |
| imy/veo_3_1-fast-4K-slow | 5s | 4K | 🐢 Chậm | $1.65/video |
| imy/veo_3_1-fast-4K-medium | 5s | 4K | ⚡ Nhanh | $2.25/video |
| imy/veo_3_1-fast-4K-premium | 5s | 4K | 🚀 Cao | $3.00/video |
| max/veo-3.1-fast | 8s 🏢 | 720p | Enterprise | $1.35/video |
| max/veo-3.1 | 8s 🏢 | 720p (HQ) | Enterprise | $1.80/video |
task_id → poll status cho đến khi hoàn thành. Thời gian render: Grok ~60-120s, Veo 3.1 ~80-390s.import requests
import time
BASE = "https://vertex-key.com/api/v1"
HEADERS = {
"Authorization": "Bearer vai-your-api-key-here",
"Content-Type": "application/json"
}
# Step 1: Create video task
resp = requests.post(f"{BASE}/video/create", headers=HEADERS, json={
"model": "imy/veo_3_1-fast-medium", # or max/veo-3.1-fast
"prompt": "A golden retriever running on the beach at sunset",
"duration": 5
})
task = resp.json()
task_id = task["id"]
print(f"Task created: {task_id}")
# Step 2: Poll until complete
while True:
status = requests.get(
f"{BASE}/videos/{task_id}",
headers=HEADERS
).json()
print(f"Status: {status['status']} {status.get('progress', '')}%")
if status["status"] == "completed":
video_url = status["video_url"]
print(f"✅ Video ready: {video_url}")
break
elif status["status"] == "failed":
print(f"❌ Failed: {status.get('error', 'unknown')}")
break
time.sleep(10) # Poll every 10 secondsimport requests, base64, time
BASE = "https://vertex-key.com/api/v1"
HEADERS = {"Authorization": "Bearer vai-your-api-key-here", "Content-Type": "application/json"}
# Read image → base64
with open("input-car.png", "rb") as f:
b64 = base64.b64encode(f.read()).decode()
# Step 1: Create video from image
resp = requests.post(f"{BASE}/video/create", headers=HEADERS, json={
"model": "max/veo-3.1-fast", # or imy/veo_3_1-fast-medium
"messages": [{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{b64}"}},
{"type": "text", "text": "Generate a video: car driving into the sunset, cinematic"}
]
}]
})
task_id = resp.json()["id"]
print(f"Task: {task_id}")
# Step 2: Poll (same as text-to-video)
for i in range(60):
time.sleep(10)
data = requests.get(f"{BASE}/videos/{task_id}", headers=HEADERS).json()
print(f"Poll #{i+1}: {data.get('status','')} {data.get('progress',0)}%")
if data["status"] == "completed":
print(f"✅ Video: {data['video_url']}")
break
if data["status"] == "failed":
print(f"❌ {data.get('error','')}")
break# Step 1: Create task
curl https://vertex-key.com/api/v1/video/create \
-H "Authorization: Bearer vai-your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"model": "imy/veo_3_1-fast-medium",
"prompt": "Cinematic drone shot over rice terraces at golden hour",
"duration": 5
}'
# Response: {"id": "veo:abc123..."}
# Step 2: Poll status (repeat until completed)
curl https://vertex-key.com/api/v1/videos/veo:abc123... \
-H "Authorization: Bearer vai-your-api-key-here"
# Response: {"status": "completed", "video_url": "https://...mp4"}const BASE = "https://vertex-key.com/api/v1";
const HEADERS = {
"Authorization": "Bearer vai-your-api-key-here",
"Content-Type": "application/json"
};
// Step 1: Create task
const resp = await fetch(BASE + "/video/create", {
method: "POST",
headers: HEADERS,
body: JSON.stringify({
model: "imy/veo_3_1-fast-medium",
prompt: "A golden retriever running on the beach",
duration: 5
})
});
const { id: task_id } = await resp.json();
console.log("Task:", task_id);
// Step 2: Poll until done
while (true) {
await new Promise(r => setTimeout(r, 10000));
const status = await fetch(
BASE + "/videos/" + task_id,
{ headers: HEADERS }
).then(r => r.json());
console.log("Status:", status.status, status.progress || "");
if (status.status === "completed") {
console.log("Video:", status.video_url);
break;
}
if (status.status === "failed") {
console.error("Failed:", status.error);
break;
}
}duration: Grok hỗ trợ 6/10/15s — Veo 3.1 mặc định 5smessages (chuẩn OpenAI vision)flash/ = Fast Response | omega/ = Tool Use + Thinking | pro/ = GPT Pro | lite/ = Budget | gem/ = Gemini | xai/ = Grok | max/ = Enterprise 🏢| Model ID | Name | Price | Features |
|---|---|---|---|
| flash/claude-opus-4-6 | Claude Opus 4.6 ⚡ | $5.00 / $25.00 | Fast, Vision, 1M ctx |
| flash/claude-sonnet-4-6 | Claude Sonnet 4.6 ⚡ | $3.00 / $15.00 | Fast, Vision, 1M ctx |
| omega/claude-opus-4-6 | Claude Opus 4.6 🔱 | $5.00 / $25.00 | Tool Use, Vision |
| omega/claude-sonnet-4-6 | Claude Sonnet 4.6 🔱 | $3.00 / $15.00 | Tool Use, Vision |
| pro/gpt-5.2 | GPT-5.2 💎 | $1.75 / $14.00 | Reasoning, Vision |
| pro/gpt-5.3-codex-xhigh | GPT-5.3 Codex Elite 💎 | $3.00 / $24.00 | Code, Reasoning |
| lite/claude-haiku-4-5 | Claude Haiku 4.5 💡 | $1.00 / $5.00 | Fast, Budget |
| gem/gemini-3.1-pro-preview | Gemini 3.1 Pro 💎 | $3.00 / $18.00 | Reasoning, Latest |
| xai/grok-4.1 | Grok 4.1 ⚡ | $4.50 / $22.50 | Reasoning, Latest |
| xai/grok-4-fast | Grok 4 Fast ⚡ | $1.00 / $2.50 | Fast |
| gemini-image-1k | Gemini Image 1K 🎨 | $0.36/req | Image, 1408×768 |
| max/gemini-3.1-image-1k | Gemini 3.1 Image 1K 🏢 | $0.60/req | Image, Enterprise |
| max/veo-3.1-fast | Veo 3.1 Fast 🏢 | $1.50/req | Video, Enterprise |
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather information",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string"}
},
"required": ["city"]
}
}
}]
response = client.chat.completions.create(
model="omega/claude-opus-4-6",
messages=[{"role": "user", "content": "What's the weather in Hanoi?"}],
tools=tools
)OPENAI_API_KEY=vai-your-api-key-here
OPENAI_BASE_URL=https://vertex-key.com/api/v1import os
from openai import OpenAI
# Automatically read from env
client = OpenAI() # No need to pass api_key, base_url/api/v1/chat/completionsChat Completion/api/v1/completionsText Completion/api/v1/embeddingsEmbedding/api/v1/images/generationsGenerate Image/api/v1/video/createCreate Video Task/api/v1/videos/:task_idPoll Video Status/api/v1/audio/speechText-to-Speech/api/v1/audio/transcriptionsSpeech-to-Text/api/v1/modelsModel List