This tutorial only accomplishes one thing: using the minimum steps to confirm that the account, key, model and API link are all working properly. Run the short request first, and then configure Cursor, Dify, Codex or your own application.
Check before you start
- open AIFast registration page Create an account.
- Log in to the console and go to "API Tokens".
- Prepare a local environment variable that will not be submitted to the code repository.
Configuration steps
Step 1: Create API Key
Create a new token in the console. It is recommended to clearly state the purpose of the name, for example:
macbook-local-test
cursor-work
production-order-service
Different devices and projects use different Keys, which can be revoked individually if a leak is subsequently discovered, without affecting all businesses.
Step 2: Save as environment variable
macOS or Linux:
export AIFAST_API_KEY="your_API_Key"
Windows PowerShell:
$env:AIFAST_API_KEY="your_API_Key"
Step 3: Query the model
macOS or Linux:
curl https://www.aifast.link/v1/models \
-H "Authorization: Bearer $AIFAST_API_KEY"
Windows PowerShell:
Continue in the same PowerShell window where you set the environment variable:
$aifastHeaders = @{
Authorization = "Bearer $env:AIFAST_API_KEY"
}
$aifastModels = Invoke-RestMethod `
-Uri "https://www.aifast.link/v1/models" `
-Method Get `
-Headers $aifastHeaders
$aifastModels.data | Select-Object id
Copy the ID of a text model that your account can access and that supports OpenAI Chat Completions. The model list helps you discover available models; a listed ID does not guarantee support for every protocol. Check its supported API type in the model catalog as well. Model IDs and access permissions can change, so verify current values in the console and live API responses.
Step 4: Send short request
Replace YOUR_MODEL_ID in the example with the model ID you confirmed supports Chat Completions in the previous step.
macOS or Linux:
curl https://www.aifast.link/v1/chat/completions \
-H "Authorization: Bearer $AIFAST_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_MODEL_ID",
"messages": [{"role": "user", "content": "Reply with only: Connection successful"}],
"stream": false
}'
Windows PowerShell:
Reuse the authentication headers in the same PowerShell window and build the JSON body from an object. This avoids incompatible Bash line continuations and quoting rules:
$aifastRequestBody = @{
model = "YOUR_MODEL_ID"
messages = @(
@{
role = "user"
content = "Reply with only: connection ok"
}
)
stream = $false
} | ConvertTo-Json -Depth 4
$aifastResponse = Invoke-RestMethod `
-Uri "https://www.aifast.link/v1/chat/completions" `
-Method Post `
-Headers $aifastHeaders `
-ContentType "application/json" `
-Body $aifastRequestBody
$aifastResponse.choices[0].message.content
Once the model responds successfully, continue with the configuration for your chosen client or tool.
FAQ
curl returns HTML
Usually the web page address is requested, not the API address. Check if using:
https://www.aifast.link/v1
Key looks correct but still 401
Copy the Key again, avoiding leading and trailing spaces. don't put Bearer The text is saved into the Key field;Bearer Should be added automatically by request header or client.
There are too many models and I don’t know which one to choose.
For your first test, choose a text model that supports OpenAI Chat Completions. The request above does not work as written with models that support only Responses API, Anthropic Messages or another protocol. Image, video and retrieval models also require their own request formats.
Next step
After the basic call is successful, you can continue reading OpenAI-compatible API quick start, or enter the corresponding tool tutorial.