4-4 AI Quickstart: Connect to a Unified AI API in 5 Minutes

Tutorial · 2026-11-20 · ~8 min read

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

  1. Visit www.4-4.vip, register and log into the console;
  2. Top up your account or redeem a prepaid card for credits;
  3. Open the "Tokens" page and create an API key (format sk-...). Keep it safe — the full key is shown only once at creation.
Security note: an API key is worth the credits behind it. Never commit it to Git or ship it in frontend code. Manage it with environment variables.

Core concept: Base URL and key

4-4 AI speaks the OpenAI protocol. You only need three pieces of configuration:

SettingValue
Base URLhttps://www.4-4.vip/v1
API Keythe sk-... key from your console Tokens page
model parameterthe 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

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

Self-hosting one-api / new-api vs. a Managed AI Gateway: Cost, Ops & Security An honest decision framework comparing self-hosted one-api/new-api with a managed AI gateway across hidden ops Connecting Cursor / Claude Code / Cherry Studio to a Custom AI Gateway Configure Cursor, Claude Code and Cherry Studio to use an OpenAI-compatible custom gateway (including 4-4 AI):
Ready to build?

One key for GLM, DeepSeek, Qwen and more — unified billing and usage analytics.

View models & pricing Get started