4-4 AI Quickstart: Connect to a Unified AI API in 5 Minutes
This tutorial takes you from zero to your first streaming response on 4-4 AI: get a key → set the Base URL → run your first request. Everything uses the OpenAI-compatible interface — any existing code, framework, or tool that supports a custom OpenAI Base URL (openai SDK, LangChain, Cursor, etc.) works without changing your code logic, just the configuration.
Prerequisites
- Visit www.4-4.vip, register and log into the console;
- Top up your account or redeem a prepaid card for credits;
- Open the "Tokens" page and create an API key (format
sk-...). Keep it safe — the full key is shown only once at creation.
Core concept: Base URL and key
4-4 AI speaks the OpenAI protocol. You only need three pieces of configuration:
| Setting | Value |
|---|---|
| Base URL | https://www.4-4.vip/v1 |
| API Key | the sk-... key from your console Tokens page |
| model parameter | the model you want, e.g. deepseek-chat, glm-4 (see the model list in your console) |
Switching models = changing the model parameter. Switching providers = changing the Base URL. That decoupling is the whole point of a unified gateway: your business code stays independent of model vendors.
Option 1: cURL (fastest way to verify connectivity)
curl https://www.4-4.vip/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $44AI_API_KEY" \
-d '{
"model": "deepseek-chat",
"messages": [
{"role": "user", "content": "Introduce yourself in one sentence"}
]
}'
If the JSON response contains choices[0].message.content, the whole pipeline works.
Option 2: Python (official openai SDK)
pip install openai
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["44AI_API_KEY"], # your 4-4 AI key
base_url="https://www.4-4.vip/v1" # key part: point to the 4-4 AI gateway
)
# Standard call
resp = client.chat.completions.create(
model="deepseek-chat",
messages=[{"role": "user", "content": "Write a quicksort in Python"}]
)
print(resp.choices[0].message.content)
# Streaming
stream = client.chat.completions.create(
model="deepseek-chat",
messages=[{"role": "user", "content": "Tell me a fun fact"}],
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta
if delta and delta.content:
print(delta.content, end="", flush=True)
Option 3: Node.js
npm install openai
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.N44_API_KEY,
baseURL: "https://www.4-4.vip/v1",
});
const completion = await client.chat.completions.create({
model: "deepseek-chat",
messages: [{ role: "user", content: "Write a debounce function in TypeScript" }],
});
console.log(completion.choices[0].message.content);
Integrating mainstream frameworks and tools
- LangChain / LlamaIndex: use their OpenAI-compatible components and set
base_url/openai_api_baseto the address above; - Cursor / Claude Code / Cherry Studio and similar AI tools: enter the Base URL and key in their "custom API / OpenAI-compatible" settings — see our dedicated tool setup guide;
- Your own code: any HTTP client speaking the OpenAI protocol works, no extra SDK required.
FAQ
401 Invalid API Key?
Check in order: ① spaces or line breaks copied along with the key; ② the key disabled or deleted on the Tokens page; ③ account balance exhausted; ④ the header format must be Bearer sk-... (note the space after Bearer).
429 Too Many Requests?
The gateway rate-limits per token. Lower concurrency, add retry with exponential backoff and jitter, or raise the token's rate limit in the console.
Streaming response cuts off midway?
Enable SDK retry with a longer timeout for long outputs. If you are behind a corporate proxy, make sure it does not buffer SSE streams (text/event-stream).
Which models are supported?
See the live list on the console "Models" page. 4-4 AI aggregates GLM, DeepSeek, Qwen and other mainstream models — one key, one interface, any model.
Related articles
One key for GLM, DeepSeek, Qwen and more — unified billing and usage analytics.
View models & pricing Get started