Skip to content
Main Site News Console

Three Steps to Get Started

4ALL API is fully compatible with the OpenAI interface protocol. Existing OpenAI SDK / HTTP clients only need to replace the Base URL and API Key to work; in most cases, no code changes are needed.

Step 1: Register an account

Open api.4allapi.com to register an account and log in to the console. New users can view their balance and available models in the console after registration.

Step 2: Create an API token

  1. Go to Tokens(API Keys) in the left menu of the console;
  2. Click New Token to set the name, quota limit, expiration time, and available model groups;
  3. After creation, copy the generated key starting with sk- and keep it safe.

Step 3: Send your first request

curl

Terminal window
curl https://api.4allapi.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $AIPROXY_KEY" \
-d '{
"model": "gpt-5.6",
"messages": [{"role": "user", "content": "你好,介绍一下你自己"}]
}'

Python(OpenAI SDK)

from openai import OpenAI
client = OpenAI(
base_url="https://api.4allapi.com/v1",
api_key="sk-你的密钥",
)
resp = client.chat.completions.create(
model="gpt-5.6",
messages=[{"role": "user", "content": "你好,介绍一下你自己"}],
)
print(resp.choices[0].message.content)

Node.js(OpenAI SDK)

import OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://api.4allapi.com/v1',
apiKey: process.env.AIPROXY_KEY,
})
const resp = await client.chat.completions.create({
model: 'gpt-5.6',
messages: [{ role: 'user', content: '你好,介绍一下你自己' }],
})
console.log(resp.choices[0].message.content)

Next steps