Quick Start

OpenAI Compatible API quick access tutorial

Use reproducible curl, Python and Node.js examples to connect to the OpenAI Compatible API, configure the Base URL, API Key and real model ID, and troubleshoot 401, model not found and /v1/v1.

Updated on 2026-07-18Checked 2026-07-18Estimated reading time: 8 minutesFor OpenAI Compatible API
Configuration fields were checked against public documentation. Models, prices, and capabilities can change; verify current values in the console and live API responses.
Special topic: OpenAI Compatible API Access and Troubleshooting Center

The value of OpenAI Compatible API is to allow existing SDKs, scripts and tools to connect different models through a unified protocol. There is usually no need to rewrite business logic when migrating, the focus is on confirmation Base URL, API Key, model ID and API type

Quick conclusion

When you connect for the first time, you only need to do three things: use /v1/models Verify the Key and copy the real model ID; send a non-streaming short request; confirm from the log that the final address has not changed /v1/v1/chat/completions. After the basic call passes, add SSE, tool calls, retries, and production traffic.

Check before you start

Prepare the following three items:

  1. API Key created in AIFast console.
  2. API base address https://www.aifast.club/v1
  3. The real model ID shown in the console model square.

API Keys are only displayed in full when they are created. Don't write it into public repositories, front-end code, screenshots, or chat logs.

Configuration steps

1. First query the model list

Execute in terminal:

curl https://www.aifast.club/v1/models \
  -H "Authorization: Bearer $AIFAST_API_KEY"

If successful the return contains data An array of model list responses, indicating that domain name resolution, HTTPS, and authentication links are basically normal. if return 401, check the Key first; if an HTML page is returned, it is usually because the Base URL is written incorrectly or the request does not enter the API route.

2. Using the Python SDK

Install SDK:

python -m pip install --upgrade openai

Put Key into environment variables:

export AIFAST_API_KEY="yours_API_Key"

Minimal call example:

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AIFAST_API_KEY"],
    base_url="https://www.aifast.club/v1",
)

response = client.chat.completions.create(
    model="YOUR_MODEL_ID",
    messages=[
        {"role": "user", "content": "Explain what hint caching is in three sentences。"}
    ],
)

print(response.choices[0].message.content)

will YOUR_MODEL_ID Replace with the real model ID in the model square and do not fill in the card title, Chinese alias or manufacturer name.

3. Use the Node.js SDK

npm install openai
export AIFAST_API_KEY="yours_API_Key"
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.AIFAST_API_KEY,
  baseURL: "https://www.aifast.club/v1",
});

const response = await client.chat.completions.create({
  model: "YOUR_MODEL_ID",
  messages: [
    { role: "user", content: "list API Five configurations you need to check before going online。" },
  ],
});

console.log(response.choices[0].message.content);

4. Do not repeat splicing /v1

Different clients handle Base URLs differently:

client fields It is recommended to fill in
Explicitly request Base URL https://www.aifast.club/v1
The client will automatically add /v1 https://www.aifast.club
Complete request address Fill in the specific API according to the client's requirements

If it appears in the log /v1/v1/chat/completions, indicating that the client and configuration are each added once. /v1

FAQ

Return 401 Unauthorized

  • Are there any spaces or quotation marks before and after Key?
  • Whether a Key that has been deleted, expired, or belongs to another account has been misused.
  • Whether the request header is Authorization: Bearer YOUR_KEY

Return model not found

  • call first /v1/models Get the real model ID.
  • Do not use the web page display name as the API model name.
  • Confirm whether the model is open to the current account.

Streaming output interrupted

First turn off the streaming mode and make a short request. If non-streaming requests are OK, then check client read timeouts, proxy buffering, and network connectivity instead of replacing the model directly.

Next step

After the first request is successful, streaming output, retries, timeouts, logs and model routing are gradually added. Don't plug in all advanced parameters at once without validating the underlying call.

View 401, 429, 502 API error troubleshooting, or go to AIFast model square Confirm currently available models.

Source checked

Reference and Check Sources

Next step

Check the model and price first, then create an independent test Key

The model ID, open status and price will change; it will be added to production after passing small-scale verification.

Model PricingCreate Account View API documentation