Fluxio
← Back to the blog

Token Streams Over One Relay Key for a Small Agent Team

Coding agents, liveEN

§1 Share One Fluxio Relay Key While Every Agent Streams Replies

A small team of coding agents multiplies credentials faster than it multiplies output. Every agent wants its own API key, its own rate limit and its own invoice, and somebody has to rotate all of it when a laptop is lost. Sharing one relay account collapses that work into a single secret and a single token-based bill, while a streaming-first relay keeps each agent feeling local and responsive.

Fluxio is a streaming-first, pay-per-token AI API relay at https://fluxioapi.com, and one key reaches Claude, GPT, Gemini, DeepSeek, Kimi, GLM, Qwen, Grok and more, with replies arriving token by token. For a small team that means one account for every coding agent on the roster, whether the agent plans a refactor with Claude Sonnet 5.5 or summarizes a failing test run with DeepSeek V4 Flash.

The critical property for real-time chat is that the relay never buffers a full answer before handing it over. The response is a token stream, so a terminal agent can redraw its output line while the model is still generating and a web console can render live chat bubbles instead of a spinner. Because the billing is pay-per-token, three agents sharing one account stay fair without seat licenses or per-user plans.

A minimal smoke test is short enough to paste into a terminal: export the shared credential as FLUXIO_API_KEY, then send a chat completion request to https://api.fluxioapi.com/v1/chat/completions with stream set to true and watch the delta chunks arrive one at a time. If tokens trickle in instead of arriving in a single block, the relay is behaving exactly as your agents expect.

§2 Keep the Shared Relay Key in a Vault Instead of Shell Profiles

Once several agents read the same credential, storage discipline matters more than usual. Put the relay key in a secret manager or an untracked environment file, then export it as FLUXIO_API_KEY in the shell that launches each agent. Never paste the key into a repository, a chat log or a shared markdown runbook, because one leak now affects the whole team.

A tiny wrapper keeps the pattern consistent across runtimes. Start every agent through one script that reads FLUXIO_API_KEY from the vault, verifies it with a cheap ping request, and refuses to launch if the credential is missing. The same wrapper can enforce a team-wide token ceiling, so a runaway loop stops before the invoice does.

  • – Storing the relay key in a team vault with access limited to agent operators
  • – Exporting the credential as FLUXIO_API_KEY at process start instead of in a tracked file
  • – Rotating one relay key per quarter rather than rotating a separate key per agent
  • – Rejecting startup when the shared credential is absent so no agent silently falls back

Keep an eye on how the credential is passed to subprocesses. If one agent spawns helper processes, inherit the environment variable deliberately and strip it from any log output, since verbose debugging is the most common way a shared key escapes.

§3 Point OpenAI Style SDKs at api.fluxioapi.com/v1 and Consume SSE Deltas

Fluxio speaks the OpenAI style chat completions shape, so any OpenAI SDK works with two changes: set the base URL to https://api.fluxioapi.com/v1 and pass the shared relay key as the API key. OpenAI style clients add /v1 in some libraries and not others, so pin the trailing path in your own configuration and every agent hits the same endpoint.

In Python the streaming loop is only a few lines: create a client with base_url set to https://api.fluxioapi.com/v1 and api_key read from the environment, call chat.completions.create with stream set to true and model set to Claude Sonnet 5.5, then print each delta content fragment as it arrives. The same request in Node uses the OpenAI JavaScript SDK with identical arguments, so a team can mix languages without mixing accounts.

The server-sent event stream is the reason this feels like real-time chat. Each chunk carries the next token or short token group, so a terminal UI can render partial code while the model is still reasoning. For a cheaper pass over routine edits, swap the model field to DeepSeek V4 Flash and leave the rest of the pipeline untouched.

  • – Setting the base URL explicitly to https://api.fluxioapi.com/v1 in every SDK client
  • – Enabling stream mode on each request so replies arrive as live token streams
  • – Rendering delta fragments immediately instead of waiting for the final message object
  • – Reading the usage block at the end of the stream to record exact token counts

Handle the stream defensively as well: stop rendering on a connection drop, retry once with the same prompt if the relay reports an incomplete finish reason, and never treat a partial block as a finished answer.

§4 Wire Claude Code, Codex and Gemini CLI to One Streaming Relay

CLI agents usually accept a base URL and an API key through environment variables or a settings file, which is exactly what a shared relay account needs. Point Codex at https://api.fluxioapi.com/v1 with the shared key, configure the other coding CLIs with the matching relay base URL, and every tool streams from one Fluxio balance with one monthly invoice.

Give each agent a job description that matches its cost profile. Long architectural reasoning can run on Claude Sonnet 5.5, quick syntax fixes and log triage can run on DeepSeek V4 Flash, and a broad exploration pass can use Gemini 3.1 Pro when you want a second perspective on a design. The relay key stays identical across all three profiles.

Keep the shared account healthy by running each agent with a hard context window and an output cap. Token streams make runaway loops easy to notice, because you can watch the same sentence arrive twice in real time and cancel before the bill grows.

  • – Assigning expensive reasoning models to planning steps and cheap streaming models to edits
  • – Cancelling a stream the moment repetition appears instead of letting the loop finish
  • – Recording the finish reason of every stream to catch silent truncation across agents
  • – Sharing one relay base URL so switching tools never switches the account

§5 Attribute Shared Tokens per Agent and Invite the Next Collaborator

A shared account only stays fair if you can see who spent what. Pass an identifier in the request metadata or a custom header, such as team-agent set to planner or team-agent set to refactorer, and log the usage block returned at the end of each stream. Within a week the log tells you which agent consumes the budget and which model choice is responsible.

Those numbers drive simple policy changes. If the refactorer spends most of its tokens re-reading files, tighten its prompt; if the planner burns a long stream on speculative branches, cap its output and let a cheaper streaming model summarize. Because Fluxio bills per token instead of per seat, you can add a fourth agent tomorrow without negotiating a new plan.

The relay is also built for teams that grow by word of mouth. Members who invite friends earn 17% of what those friends pay, so bringing in the contractor who runs your deployment agent can offset the shared token bill while everyone streams from the same account.

Start small: one key, one base URL, three agents with distinct model profiles, and a log that attributes every stream. As the team grows, the relay stays the single point of control for credentials, cost and live token delivery.

Sign up at https://fluxioapi.com and give your whole coding team one streaming relay account.

Create a Fluxio account →

More from the current