Quickstart
Make your first TokenFlux API request
Quickstart
1. Create an account
Sign up, add funds from Billing, and create a key under API keys.
2. Choose a model
Open Models & pricing and copy a model ID available to your account.
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 Portal. Treat API keys like passwords and never expose them in browser code or source control.
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, see Chat Completions, Responses, Messages, or Embeddings.