Quickstart

Follow these 4 steps to make your first API call. Never done this before? No problem — we explain every single step.

💬
Not a developer? You don't need this page.
Use AiFlow Studio instead — it's a full chat interface in your browser. No setup, no code, no terminal. Just open it and start typing.
1

Get your API key

Go to Pricing and buy any token bundle — starting at $5. After checkout you'll receive an email with your key. It looks like this:

👆 Your API key looks exactly like this
af-sk-live-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Copy it and keep it safe — treat it like a password. You'll paste it in Step 3.

2

Open your terminal and install the library

What is a terminal? It's a text window where you type commands. On Windows: press the Windows key, search for "Command Prompt", and open it. On Mac: press Cmd+Space, search "Terminal", and open it.

First, check if Python is installed by typing this and pressing Enter:

terminal
python --version

If you see a version number like Python 3.11.2, great — move on. If you get an error, go to python.org, download Python, and install it. Then come back here.

Now install the OpenAI library by typing this and pressing Enter:

terminal
pip install openai

Text will scroll by for a few seconds. When it stops and you see a blinking cursor again, it worked.

3

Create a file and paste your key into it

Open Notepad (Windows) or TextEdit (Mac). Copy the code below. Then find the highlighted line and replace af-paste-your-key-here with your actual key from Step 1.

Save the file on your Desktop and name it test.py. Make sure it ends in .py not .txt.

python — save this as test.py
from openai import OpenAI client = OpenAI( base_url="https://api.aiflow.to/v1", api_key="af-paste-your-key-here" # ← replace with your key ) response = client.chat.completions.create( model="qwen-coder", messages=[{"role": "user", "content": "Say hello!"}] ) print(response.choices[0].message.content)
4

Run it

Back in your terminal, type these commands and press Enter after each one:

terminal
# Windows: cd %USERPROFILE%\Desktop python test.py # Mac: cd ~/Desktop python3 test.py
✓ If it worked, you'll see something like this:
Hello! How can I help you today?

You're live! Every token you use comes out of your balance. Each conversation is private — nothing is logged on our end.

Something not working? Make sure your key starts with af-, you copied the whole key, and there are no extra spaces. Still stuck? Email support[at]aiflow.to — we respond within 24 hours.

No coding needed

You don't need to write a single line of code to use AiFlow. We built AiFlow Studio — a private AI workspace that runs right in your browser, just like ChatGPT but with complete privacy.

1

Go to aiflow.to

You'll land directly in the Studio. You can try it in demo mode immediately — no signup, no key, no credit card. Just start typing.

2

Buy tokens to unlock real AI

Demo mode shows you simulated responses. For real AI, go to Pricing and buy any bundle starting at $5. You'll get an email with your API key within seconds.

3

Click "API Key" in the top bar and paste your key

Open your email, copy the key that starts with af-, and paste it into the box. It connects instantly. Your key is saved in your browser — we never see it.

4

Start working — and download when you're done

Type anything you need. Legal documents, medical notes, financial analysis, code, emails — whatever it is. When you're finished, click the Download button at the top to save your conversation as a text file on your computer.

Close the tab and it's gone. We never had your conversation. Nothing is stored on our servers — not your questions, not the answers, not anything. Total privacy, by design.

Authentication

Every API request must include your API key in the Authorization header.

http header
Authorization: Bearer af-your-api-key-here

API keys always start with af-. Get yours at Pricing.

Never share your API key. Don't put it in public code, GitHub repos, or client-side JavaScript. If you think it was exposed, email support[at]aiflow.to immediately to revoke it.

Models

Currently available on AiFlow:

Model IDContext windowBest for
qwen-coder8,192 tokensCode generation, debugging, writing, analysis, general use

More models coming soon. We prioritize models that deliver the best balance of quality, speed, and privacy.

Chat completions

POST/v1/chat/completions

Request parameters

ParameterTypeDescription
modelstringModel to use. Currently: qwen-coder
messagesarrayArray of message objects with role (user/assistant) and content
max_tokensintegerMax tokens to generate. Default: 1024. Max: 4096
temperaturefloatResponse creativity, 0–2. Lower = more focused. Default: 0.7
streambooleanStream tokens as generated. Default: false

Example response

json
{ "id": "chatcmpl-abc123", "model": "qwen-coder", "choices": [{ "message": { "role": "assistant", "content": "Hello! How can I help?" }, "finish_reason": "stop" }], "usage": { "prompt_tokens": 18, "completion_tokens": 9, "total_tokens": 27 } }

Streaming

Set stream: true to receive tokens as they generate — makes your app feel much faster.

python
response = client.chat.completions.create( model="qwen-coder", messages=[...], stream=True ) for chunk in response: if chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="", flush=True)

Errors

CodeMeaningWhat to do
401UnauthorizedYour API key is wrong or missing. Check it starts with af-
402Payment requiredToken balance is empty. Top up at /pricing
429Rate limitedToo many requests — slow down or upgrade your plan
500Server errorSomething went wrong on our end — wait a moment and retry

Migrate from OpenAI

Already using OpenAI? Switching to AiFlow takes under 60 seconds. Change exactly three lines:

what to change
- base_url="https://api.openai.com/v1" + base_url="https://api.aiflow.to/v1" - api_key="sk-..." + api_key="af-..." - model="gpt-4o" + model="qwen-coder"

Every request and response shape is identical to OpenAI's API. LangChain, LlamaIndex, and any other library that supports OpenAI will work with no other changes.

Rate limits

BundleRequests / minTokens / min
Starter30 RPM50K TPM
Plus60 RPM100K TPM
Pro150 RPM300K TPM
Power500 RPM1M TPM

Need higher limits? Email support[at]aiflow.to.

Privacy details

Here is the complete technical picture of what happens to your data.

What happens when you send a request

Your request travels over HTTPS to our server. The model generates a response. Both the prompt and response exist only in memory during processing — they are never written to any disk or database. The connection closes and the data is gone.

What we log

Only metadata required for billing: request timestamp, token count, response latency, and your API key ID (not the key itself).

What we never log

The content of your prompts, the content of AI responses, your IP address, or any identifying information from the body of your requests.

Training data

We run a self-hosted open source model. There is no pipeline by which your conversations could reach a training dataset. We do not fine-tune on customer data under any circumstances.

AiFlow Studio

The Studio keeps your conversation in your browser's local memory only. It is never sent to our servers. Close the tab and it is deleted from your browser. The Download feature saves a text file to your computer — that file never touches our infrastructure.

Questions about compliance? Email support[at]aiflow.to — we're happy to discuss your specific requirements for legal, medical, financial, or enterprise use.