Let me conclude first: Projects that already use the OpenAI SDK can usually migrate to AIFast by replacing the Base URL, API Key, and Model ID. Before migrating, confirm whether the project uses Chat Completions or Responses API; "Compatible with OpenAI" does not mean that all endpoints and advanced parameters are exactly the same.
Find three configurations before migrating
| Project configuration | AIFast recommended value |
|---|---|
| Base URL | https://www.aifast.club/v1 |
| API Key | Independent Key for projects created by the console |
| Model | /v1/models The real ID returned |
It is recommended to migrate in the test environment first instead of directly replacing the production configuration. Create independent keys for different projects and set controllable limits, which can be revoked individually when leaks occur or use is stopped.
Step 1: Confirm the model and basic links
export AIFAST_API_KEY="yours_API_Key"
curl --fail-with-body --silent --show-error \
https://www.aifast.club/v1/models \
-H "Authorization: Bearer $AIFAST_API_KEY"
Successful return contains data The model list response of the array indicates that the domain name, HTTPS, and Bearer authentication links are basically normal. Then copy the real model ID from the response:
export MODEL_ID="real copied from model list_ID"
Step 2: Migrate the Python project
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=os.environ["MODEL_ID"],
messages=[
{"role": "system", "content": "Answers must be concise。"},
{"role": "user", "content": "list API Three checks before migrating。"},
],
)
print(response.choices[0].message.content)
If the original project uses OPENAI_API_KEY, do not keep multiple Keys from unknown sources at the same time. Clarify the priority of environment variables to prevent the program from reading the official OpenAI Key while the request is sent to the third-party Base URL, or vice versa.
Step Three: Migrate Node.js Project
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: process.env.MODEL_ID,
messages: [
{ role: "user", content: "Reply only OPENAI_COMPATIBLE_READY" },
],
temperature: 0,
});
console.log(response.choices[0].message.content);
Complete non-streaming short requests first, then add streaming, tool calls, image input, or structured output. Adding too many parameters at once will make it difficult to locate the source of the error.
How to choose between Chat Completions and Responses
| Project status | Recommended verification path |
|---|---|
Already used chat.completions.create |
Verify first /v1/chat/completions, the lowest migration cost |
| Used Responses API | First check whether the target model and entrance are supported /v1/responses |
| Use tool call | Separately verify tool name, parameter JSON and multiple rounds of postback |
| Use images, audio or files | Acceptance is based on specific endpoints one by one, and is not inferred based on the success of the text API. |
ViewLLM API Compatibility MatrixEndpoint boundaries that require verification can be quickly confirmed.
Five Minute Acceptance Checklist
/v1/modelsReturns parsable JSON instead of HTML.- Minimal request returns expected structure and saves
model、usageand request ID. - Error Key returns clear 401/403 without revealing sensitive information.
- Streaming requests can continuously read SSE instead of waiting for a complete response and outputting it all at once.
- Billing changes can correspond to model, token, key and request time.
To compare existing APIs, useFree model checkingCheck protocols, model declarations, tokens, SSE and tool calls. The test results are not certified by the underlying manufacturer and should be judged based on multi-period samples and real business question sets.
FAQ
why appears /v1/v1?
The client and configuration are each added once. /v1. If the log shows /v1/v1/chat/completions, change the Base URL to the domain name root address according to the client rules, or turn off automatic appending of paths.
Why is 401 returned?
Check the Key source, environment variable priority, Bearer request header and leading and trailing spaces. Do not put the Key in the browser front-end, public repository or screenshot.
Why is 429 returned?
429 is usually related to quota, concurrency, or rate limits. Read the error text and Retry-After, use exponential backoff and random jitter, don't retry infinitely and immediately.
Why does the API return 200 and the service still fails?
HTTP 200 only means that the request was processed normally. It is still necessary to verify the output constraints, tool parameters, token, streaming end event and business question set pass rate.
Next step
Continue readingOpenAI Compatible quick access、401, 429, 502 error troubleshootingandProduction on-line checklist, then run a staged migration and rollback drill.