Skip to main content

Quickstart Guide

Get connected and start invoking large language models in just 3 simple steps within minutes.


Step 1: Obtain an API Key

  1. Log in to the Ainfix Console.
  2. Navigate to "API Keys" (Tokens) in the left sidebar menu.
  3. Click "Add Token", configure the token name and quota limits, then save and copy the generated sk-... key.

:::caution Security Notice Your API key grants access to your usage quota. Never commit it directly to public repositories or hardcode it into client-side applications. :::


Step 2: API Endpoint (Base URL)

The standard API endpoint for this platform is:

https://api.ainfix.com/v1

Step 3: Code Examples

1. Python (Using the official openai library)

pip install openai
from openai import OpenAI

client = OpenAI(
api_key="sk-your-ainfix-token-here",
base_url="https://api.ainfix.com/v1"
)

response = client.chat.completions.create(
model="gpt-5.6-sol",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "你好,请介绍一下你自己!"}
],
stream=False
)

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

2. Node.js / TypeScript (Using the official openai library)

npm install openai
import OpenAI from 'openai';

const client = new OpenAI({
apiKey: 'sk-your-ainfix-token-here',
baseURL: 'https://api.ainfix.com/v1',
});

async function main() {
const completion = await client.chat.completions.create({
model: 'gpt-5.6-sol',
messages: [{ role: 'user', content: 'Hello!' }],
});

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

main();

3. cURL (Command-line call)

curl https://api.ainfix.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-ainfix-token-here" \
-d '{
"model": "gpt-5.6-sol",
"messages": [
{
"role": "user",
"content": "Hello World!"
}
]
}'

Third-Party Client Configuration

If you are using a GUI client (such as NextChat, Cherry Studio, ChatBox, LobeChat, Cursor, Dify, etc.):

  1. API Provider: Select OpenAI.
  2. Base URL / API Host: Enter https://api.ainfix.com (some clients automatically append /v1; if full paths are supported, enter https://api.ainfix.com/v1).
  3. API Key: Enter the sk-... token generated from the Ainfix Console.
  4. Model: Enter the supported model name directly (e.g., gpt-4o, claude-3-5-sonnet, gemini-1.5-pro, etc.).