TokenFlux Docs

Quickstart

Give a TokenFlux agent its first task, or make your first API request

1. Create an account and add funds

Sign up and verify your email. Then add funds on Billing. Agents and API keys spend the same balance.

Then choose a path: give an agent a task, or call the API from your code.

2a. Give an agent a task

  1. Open Agents. TokenFlux has created a default agent for you.
  2. Type a task, for example "Find this week's notable AI model releases and write a short summary to releases.md", and send it.
  3. Watch the reply stream in. The agent starts its sandbox, calls tools and writes the file to its workspace.

Next steps:

  • Connect a chat app on the agent's Channels page. See Channels.
  • Run the task on a schedule. See Automations.

2b. Make an API request

  1. Create a key on API keys and copy it. The full key is shown only once.
  2. Open Models & pricing and copy a model ID.
  3. Send a request:
curl https://tokenflux.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_TOKENFLUX_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "YOUR_MODEL_ID",
    "messages": [
      {"role": "user", "content": "Hello"}
    ]
  }'

Replace YOUR_TOKENFLUX_KEY and YOUR_MODEL_ID with values from the web app. Treat API keys like passwords and never expose them in browser code or source control.

The request appears on Usage with its tokens and cost.

OpenAI SDK

OpenAI-compatible clients can use the same endpoint by changing their base URL and key:

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.TOKENFLUX_API_KEY,
  baseURL: "https://tokenflux.ai/v1",
});

const response = await client.chat.completions.create({
  model: process.env.TOKENFLUX_MODEL,
  messages: [{ role: "user", content: "Hello" }],
});

console.log(response.choices[0]?.message.content);

Next, read the API overview, then Chat Completions, Responses, Messages or Embeddings.

To connect a desktop or coding client, follow the Cline custom provider setup or the Cherry Studio custom provider setup.

Coding clients

To connect a coding client, use its endpoint and protocol settings:

Install an SDK

For JavaScript or TypeScript, install the OpenAI SDK before running the example:

npm install openai

For Python, install the Python SDK:

pip install openai

Set TOKENFLUX_API_KEY and TOKENFLUX_MODEL in your environment, then run:

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["TOKENFLUX_API_KEY"],
    base_url="https://tokenflux.ai/v1",
)

completion = client.chat.completions.create(
    model=os.environ["TOKENFLUX_MODEL"],
    messages=[{"role": "user", "content": "Hello, TokenFlux!"}],
)
print(completion.choices[0].message.content)

Explore the next task

If a request fails, check your key, model access and balance. The API overview explains errors and retries. Contact support@tokenflux.ai if you need help.

On this page