Run free VS Code AI agents on GPT and Gemini
A free VS Code AI agent needs exactly two things: an extension like Cline or Roo Code and an OpenAI-compatible API key. Point the extension at the apiToken.sale gateway and GPT or Gemini executes your one-prompt tasks at a flat 50% off official rates — no Cursor Pro subscription involved.
·
What a one-prompt agent actually requires
To type one prompt into VS Code and watch an agent plan, edit files, run terminal commands and loop until the task is done, you need a free agent extension and a key for the model — nothing else. Cursor Pro is not a requirement: open-source agents such as Cline and Roo Code accept any OpenAI-compatible endpoint, so GPT and Gemini run inside plain VS Code on your own API balance. The extension is free; the only metered component is the model traffic, billed per token.
That split matters for your wallet. A subscription bundles a fixed monthly quota you may never use; a per-token key charges only for what the agent actually burns. With an apiToken.sale key, every supported GPT and Gemini model sits behind one base URL on one prepaid balance, at a flat 50% off official rates.
See also: OpenAI-compatible API quickstart: from curl to the official SDK
Connect Cline or Roo Code to the gateway
- 01Install Cline or Roo Code from the VS Code Marketplace — both are free and open source.
- 02Open the extension's API provider settings and select OpenAI Compatible.
- 03Set the base URL to https://router.apitoken.sale/v1 and paste your sk-pool-••• key.
- 04Enter gpt-6.1-terra as the model ID and give the agent its first real task.
# Cline / Roo Code → API provider settings API Provider : OpenAI Compatible Base URL : https://router.apitoken.sale/v1 API Key : sk-pool-••• Model ID : gpt-6.1-terra
On this setting both extensions speak the OpenAI Chat Completions protocol, so streaming responses and system prompts behave as the specification describes and the agent cannot tell the gateway from a direct connection. Gemini runs through the same provider entry: set the model ID to google/gemini-3.8-flash. The key works the moment it is created — there is no approval queue or waitlist.
Match the model to the agent step
An agent loop is not one kind of work. Reading files and applying small edits is cheap, high-volume traffic; untangling a cross-module refactor is not. Because one key covers every GPT and Gemini model, you switch models inside the extension per task instead of juggling accounts or billing profiles.
| Model ID | Use it for | Official in / out ($ per 1M) | Here (−50%) |
|---|---|---|---|
| gpt-6-luna | Quick edits, lookups, high-volume steps | $0.10 / $0.50 | $0.05 / $0.25 |
| google/gemini-3.8-flash | Fast everyday work on a second model family | $0.75 / $3.75 (promotional through 2026) | $0.375 / $1.875 |
| gpt-6.1-terra | The default: everyday coding and agent loops | $1 / $5 | $0.50 / $2.50 |
| gpt-6.1-sol | Complex refactors, architecture, long sessions | $2 / $10 | $1 / $5 |
A practical pattern: keep the agent on GPT-6.1 Terra, drop to GPT-6 Luna for mechanical multi-file chores, and escalate to GPT-6.1 Sol only when the task genuinely needs deep reasoning. Gemini 3.8 Flash sits on the same entry when you want a second model family in the loop. The dashboard shows token-level usage per call, so you can see exactly what each session cost.
Why agent loops are where the discount compounds
One prompt in an agentic extension turns into many model calls: the agent re-reads your files, plans, edits, runs tests and re-checks its own output. A task that feels like a single interaction can easily chain dozens of requests. Per-token billing means the cost scales with the loop — and a flat discount on every token scales with it too.
- Cached input is billed at the official cached rate minus your discount, so the long context an agent re-reads on every step comes back cheap.
- Output tokens dominate agent sessions — every edit, diff and explanation is output — which is where the per-million savings concentrate.
- There is no seat fee and no monthly quota: an idle week costs nothing, a heavy refactoring weekend costs only its tokens.
One key for every agent you run
The same key is not tied to one extension. It works in Cline, Roo Code, Continue, Cursor, Codex CLI and the OpenAI SDKs at the same time, against the same balance — so you can keep an autonomous agent running in one window while a lighter chat extension answers questions in another. Claude Code can use it too, as a client that runs GPT and Gemini models through the gateway. Gemini-native tools reach the same models over generateContent with an x-goog-api-key header, which keeps multi-model workflows on a single prepaid balance that never expires.
If the first prompt fails, check these three things
- 401 Unauthorized: the API key or base URL is wrong — re-paste both, with no trailing spaces, and keep the /v1 suffix.
- Model not found: the extension is sending an ID this catalog does not publish; use a current one such as gpt-6.1-terra or google/gemini-3.8-flash, and check GET /v1/models with the same key.
- Slow responses or 429 errors: lower the extension's concurrency and respect the Retry-After header before retrying.
Some extensions pre-fill OpenAI's default endpoint even after you pick a custom provider. If requests still hit api.openai.com, check that you chose OpenAI Compatible rather than OpenAI, and confirm the base URL field actually saved.
Frequently asked questions
Do I need Cursor Pro to get an AI agent in VS Code?
No. Free open-source extensions like Cline and Roo Code add agentic coding to plain VS Code and accept any OpenAI-compatible endpoint — with an apiToken.sale key, the only cost is per-token model usage.
How do I point Cline or Roo Code at apiToken.sale?
Select OpenAI Compatible as the API provider, set the base URL to https://router.apitoken.sale/v1 and paste your sk-pool-… key. The same settings work in both extensions.
Which model should a VS Code agent use?
gpt-6.1-terra is a good default for everyday coding loops; escalate to gpt-6.1-sol for complex refactors and drop to gpt-6-luna for cheap, high-volume steps. For Gemini, set the model ID to google/gemini-3.8-flash — all on the same key.
What does an agent session cost on this setup?
Billing is per token at official OpenAI or Google rates minus a flat 50%: GPT-6.1 Terra works out to $0.50 input and $2.50 output per million tokens, and cached input is billed at the official cached rate minus the same discount.
Does the same key work outside VS Code?
Yes. The same key covers Cursor, Codex CLI, Claude Code running GPT or Gemini models, and the OpenAI and Google SDKs on one prepaid balance.
Create an account, top up your balance, and generate an API key to use supported GPT and Gemini models.