Quickstart
Make Your First Request
Call APIQIK Chat Completions with Python, Node.js, and cURL.
The following examples request qwen-turbo using Python, Node.js, and cURL. Set your API key and run an example to receive your first model response.
Install the official SDK
# Python
python3 -m pip install -U openai
# Node.js
npm install openaiPython
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["APIQIK_API_KEY"],
base_url="https://api.apiqik.com/v1",
)
response = client.chat.completions.create(
model="qwen-turbo",
messages=[
{"role": "system", "content": "You are a concise, reliable assistant."},
{"role": "user", "content": "Explain an API aggregation platform in one sentence."},
],
)
print(response.choices[0].message.content)Node.js
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.APIQIK_API_KEY,
baseURL: "https://api.apiqik.com/v1",
});
const response = await client.chat.completions.create({
model: "qwen-turbo",
messages: [
{ role: "system", content: "You are a concise, reliable assistant." },
{ role: "user", content: "Explain an API aggregation platform in one sentence." },
],
});
console.log(response.choices[0].message.content);This example uses ES Modules. Set "type": "module" in package.json, or save the file with an .mjs extension.
cURL
curl https://api.apiqik.com/v1/chat/completions \
-H "Authorization: Bearer $APIQIK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-turbo",
"messages": [
{
"role": "user",
"content": "Explain an API aggregation platform in one sentence."
}
]
}'Read the response
A non-streaming request returns a JSON object. Generated text is at choices[0].message.content; token usage is usually at usage.
{
"id": "chatcmpl-apiqik-example",
"object": "chat.completion",
"model": "qwen-turbo",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "An API aggregation platform connects multiple model services through one interface."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 18,
"completion_tokens": 16,
"total_tokens": 34
}
}The sample response does not represent fixed usage. IDs, token counts, and generated content can vary between requests. Always use the actual response.