5-Minute Quick Start

Follow this simple tutorial to complete your first LLM API call in 5 minutes

Quick Start⏱️ Estimated time: 5 minutes
1
Register Account
2
Get API Key
3
Install SDK
4
Send Request
1

Register Account

First, you need to register an account to get API access.

  1. Visit n1n.ai/register to register
  2. Fill in email and password to complete registration
  3. Verify your email address

💡 Tip: New users receive free credits upon registration, allowing immediate API testing.

2

Get API Key

After logging in, you need to create an API key to authenticate your requests.

  1. 1.Go to the "API Keys" page in the console
  2. 2.Click "Create New Key" button
  3. 3.Set a recognizable name for the key
  4. 4.Copy and securely save your API key
Your API Key
sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

⚠️ Important: Keep your API key secure and never expose it in public repositories.

3

Install SDK

Choose your preferred programming language and install the corresponding SDK package.

Python

Terminal
pip install openai

Node.js

Terminal
npm install openai
4

Send Your First Request

Now let's send your first API request and chat with AI!

Python Example

from openai import OpenAI

# Initialize client
client = OpenAI(
    api_key="your_api_key",
    base_url="https://api.n1n.ai/v1"  # Using n1n.ai API endpoint
)

# Send request
response = client.chat.completions.create(
    model="gpt-3.5-turbo",
    messages=[
        {"role": "system", "content": "You are a helpful assistant"},
        {"role": "user", "content": "Hello, please introduce yourself"}
    ]
)

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

JavaScript Example

import OpenAI from 'openai';

// Initialize client
const openai = new OpenAI({
  apiKey: 'your_api_key',
  baseURL: 'https://api.n1n.ai/v1'  // Using n1n.ai API endpoint
});

// Send request
async function main() {
  const completion = await openai.chat.completions.create({
    model: "gpt-3.5-turbo",
    messages: [
      {role: "system", content: "You are a helpful assistant"},
      {role: "user", content: "Hello, please introduce yourself"}
    ]
  });

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

main();

cURL Example

curl https://api.n1n.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your_api_key" \
  -d '{
    "model": "gpt-3.5-turbo",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant"},
      {"role": "user", "content": "Hello, please introduce yourself"}
    ]
  }'

✅ Expected Output

Hello! I'm an AI assistant. I can help you answer questions, provide information, have conversations, assist with writing, help with programming, and many other tasks. I'm based on large language model technology and can understand and generate natural language. How can I help you today?

🎉

Congratulations! You've successfully completed your first API call

You've mastered the basic usage of LLM API and can now start building more complex applications.

What's Next?