SwiftRelay

← All sprint notes

Set Up Codex on SwiftRelay with an API Relay in Minutes

First lapsEN

What an HTTP 402 Signals on SwiftRelay

If you run Codex against SwiftRelay and a request comes back with HTTP 402, the relay is telling you one thing in plain language: payment is required before the call can go through. Nothing was billed for the work you asked for, and nothing was delivered. HTTP 402 is the Payment Required status code, and on a pay-per-token API relay it points straight at the balance attached to your account rather than at your prompt, your Codex install or the model you selected.

That is the reassuring part of the message. A 402 is a clear checkpoint, not a mystery failure. SwiftRelay charges per token as calls are made, so the relay checks that there is room to deduct what the call actually uses before it runs. When the balance cannot cover that call, the request stops at the payment step. You get a signal you can act on instead of a half-finished response or an error buried in a log.

The fix is short: top up the balance, then send the request again. There is no monthly fee, nothing to subscribe to and no contract to negotiate. You keep exactly what you pay for, and each call deducts only what it used.

Why SwiftRelay Stops a Call Before It Costs You

SwiftRelay is a pay-per-token API relay, so the balance is the fuel tank. When it is empty or too shallow for the next call, the relay answers with HTTP 402 rather than letting the request run and leaving you to settle up later. That design keeps the economics honest: the amount that leaves your balance tracks the tokens the call actually consumed.

Compare that with keeping your own subscription or official account in general terms. There you hold a fixed arrangement whether you lean on it heavily or barely touch it. With SwiftRelay, the meter follows real usage, which is why the balance is the single thing worth watching when a 402 shows up.

  • A 402 means the call was not paid for, so no output was produced.
  • A 402 points at the balance, not at the prompt, the client or the model.
  • Topping up restores the ability to run the call, and no plan change is involved.
  • Usage in the dashboard lists tokens and cost per call, so you can see what consumed the balance.

One more detail is worth knowing: up to 20 live API keys can sit on a single account. If you rotate keys or run several Codex setups, a 402 is still about the shared balance rather than about a key being retired. Check the balance first, then the key.

Topping Up on SwiftRelay: Six Amounts and Real Credit

SwiftRelay gives you six top-up amounts to choose from: $1.39, $6.94, $13.89, $27.78, $69.44 and $138.89. Pick the size that matches how hard you are leaning on Codex in a given stretch. Small top-ups keep the meter running for a quick test, while larger ones mean fewer payment stops when you are deep in a build.

New accounts receive $0.22 in sign-up gift credit, which is enough to get a first request through the gate and confirm your Codex lines are wired correctly before you commit anything larger.

Referrals work in your favour too. You earn 14% of each top-up made by someone you invited, plus 3% from the people they invite in turn. Those rewards can be withdrawn once they reach the $4.86 minimum, or moved straight into your balance, where they can cover future calls.

If a top-up does not suit you, unused credit can be refunded within 11 days of the top-up, minus what was used and the payment fee. That window makes it easier to try SwiftRelay on a real task and read the per-token numbers for yourself.

Start with a modest amount, watch the usage view, and grow the balance only as your workload proves it. SwiftRelay never asks you to buy a package in advance of knowing what you will use.

Codex in Three Lines on SwiftRelay

SwiftRelay connects in minutes: copy three lines and run. For Codex, point the client at the SwiftRelay API host and give it a swft_ key.

01  export OPENAI_BASE_URL=https://api.fastapirelay.com/v1
02  export OPENAI_API_KEY=<your swft_ key>

codex

The base URL is the OpenAI-compatible endpoint on SwiftRelay, and the API key is the swft_ key from your account. Codex pairs with GPT and DeepSeek models on that endpoint, so the same three lines cover the model choices listed below without any change to the shape of your setup.

If you need help after the copy-paste, support runs through Messages in the dashboard and requires a login. There is no support email to hunt for, so the fastest route is to open Messages and ask there.

Per-Token Prices for Codex Work on SwiftRelay

SwiftRelay lists per-token prices on its pricing page, and these four Codex-friendly models are the ones to plan around. Prices are shown per 1M tokens.

  • DeepSeek V4 Flash (deepseek-v4-flash): input $0.2639, output $1.06, cache read $0.006944.
  • DeepSeek V4 Pro (deepseek-v4-pro): input $1.17, output $3.51, cache read $0.0389.
  • GPT-6 Astra (gpt-6-astra): input $0.6597, output $3.28, cache read $0.0653.
  • GPT-6.1 Sol (gpt-6.1-sol): input $0.1736, output $0.8542, cache read $0.0347.

Example: say a day of Codex work sends 100,000 input tokens and 20,000 output tokens through GPT-6.1 Sol. At the listed prices that is $0.01736 for the input and $0.017084 for the output, a total of $0.034444 deducted from the balance.

Example: the same day of traffic on DeepSeek V4 Flash comes to $0.02639 for 100,000 input tokens and $0.0212 for 20,000 output tokens, a total of $0.04759. A full 1M tokens of cache reads on DeepSeek V4 Flash add $0.006944.

These are examples, not quotes of your own usage. Your own numbers live in the usage view, which lists tokens and cost per call. That view is also where a 402 becomes easy to explain: you can see the calls that drained the balance and pick a top-up that fits.

One Clean Lap from 402 to a Live Codex Call

Think of the 402 as a pit-wall light rather than a crash. The relay stopped the car, the meter showed why, and the next step is a top-up instead of a rebuild.

On SwiftRelay the loop is short: top up a balance, paste three lines into Codex, and every call deducts only what it used. No monthly fee, no subscription, no juggling beyond the balance you choose.

Stopwatch ready and Codex waiting: sign up for SwiftRelay now, top up your balance and put your first call on the road.

Keep reading

Back for another lap?Log in