Quickstart
Follow these 4 steps to make your first API call. Never done this before? No problem — we explain every single step.
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:
Copy it and keep it safe — treat it like a password. You'll paste it in Step 3.
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:
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:
Text will scroll by for a few seconds. When it stops and you see a blinking cursor again, it worked.
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.
Run it
Back in your terminal, type these commands and press Enter after each one:
You're live! Every token you use comes out of your balance. Each conversation is private — nothing is logged on our end.
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.
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.
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.
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.
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.
Authentication
Every API request must include your API key in the Authorization header.
API keys always start with af-. Get yours at Pricing.
Models
Currently available on AiFlow:
| Model ID | Context window | Best for |
|---|---|---|
| qwen-coder | 8,192 tokens | Code 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
Request parameters
| Parameter | Type | Description |
|---|---|---|
| model | string | Model to use. Currently: qwen-coder |
| messages | array | Array of message objects with role (user/assistant) and content |
| max_tokens | integer | Max tokens to generate. Default: 1024. Max: 4096 |
| temperature | float | Response creativity, 0–2. Lower = more focused. Default: 0.7 |
| stream | boolean | Stream tokens as generated. Default: false |
Example response
Streaming
Set stream: true to receive tokens as they generate — makes your app feel much faster.
Errors
| Code | Meaning | What to do |
|---|---|---|
| 401 | Unauthorized | Your API key is wrong or missing. Check it starts with af- |
| 402 | Payment required | Token balance is empty. Top up at /pricing |
| 429 | Rate limited | Too many requests — slow down or upgrade your plan |
| 500 | Server error | Something 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:
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
| Bundle | Requests / min | Tokens / min |
|---|---|---|
| Starter | 30 RPM | 50K TPM |
| Plus | 60 RPM | 100K TPM |
| Pro | 150 RPM | 300K TPM |
| Power | 500 RPM | 1M 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.