컨텐츠로 건너뛰기
主站 新闻 控制台

세 단계로 시작하기

4ALL API는 OpenAI 인터페이스 프로토콜과 완전히 호환됩니다. 기존 OpenAI SDK / HTTP 클라이언트는 Base URL과 API Key만 교체하면 사용할 수 있으며, 대부분의 경우 코드를 전혀 수정할 필요가 없습니다.

1단계: 계정 등록

api.4allapi.com 에서 계정을 등록하고 콘솔에 로그인합니다. 신규 사용자는 등록 후 콘솔에서 잔액과 사용 가능한 모델을 확인할 수 있습니다.

2단계: API 토큰 생성

  1. 콘솔 왼쪽 메뉴에서 토큰(API Keys) 으로 이동합니다;
  2. 새 토큰 만들기 를 클릭하여 이름, 한도 상한, 만료 시간 및 사용 가능한 모델 그룹을 설정할 수 있습니다;
  3. 생성 완료 후 sk- 로 시작하는 키를 복사하여 안전하게 보관합니다.

3단계: 첫 번째 요청 전송

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)

다음 단계