Quickstart
Give a TokenFlux agent its first task, or make your first API request
Quickstart
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
- Open Agents. TokenFlux has created a default agent for you.
- Type a task, for example "Find this week's notable AI model releases and write a short summary to releases.md", and send it.
- 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
- Create a key on API keys and copy it. The full key is shown only once.
- Open Models & pricing and copy a model ID.
- 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.