A free LLM API for coding agents
Cline, Roo Code, Continue, aider, OpenCode, Codex CLI and Zed all speak the OpenAI Chat Completions API. So does this. Change the base URL, paste a free key, and your agent has a backend with real tool calling and automatic failover across 27 providers.
Base URL https://dreamprompting.com/api/v1
API key dp-... (free, from /account)
Model auto (or pin one, see below)
Why a coding agent needs more than a chat endpoint
A chat endpoint takes text and returns text. A coding agent needs something harder: it asks the model to
emit a structured call like read_file({"path": "src/auth.py"}),
runs that call locally, feeds the result back, and repeats until the job is done. That mechanism is tool
calling, and it is the single capability that separates an endpoint you can build an agent on from one you cannot.
Free endpoints are often quiet about this. The dangerous failure is not a clear error, it is a provider that
accepts your tools parameter, ignores it, and returns a
cheerful paragraph explaining what it would do. Your agent parses for a tool call, finds prose, and breaks
somewhere far from the cause.
We probed every model route we serve with a real function-calling request rather than trusting documentation. Of 18 routes, 15 returned a correct tool call, the other two were rate limited at the time rather than incapable, and exactly one source could not do it at all: the keyless last-resort provider, which flattens a conversation into a URL query and can only answer in prose. That one now declares itself incapable, and the gateway skips it whenever a request carries tools, a tool result, or an assistant turn containing tool calls. An agent request will never be answered by something that cannot make the call. If nothing capable is available, you get an honest 502 that says so, which is far easier to debug than a plausible paragraph.
Tool calling, verified
15 of 18 model routes emit real tool calls. Measured with live requests, not read off a spec sheet.
Failover mid-task
When a free tier taps out, the next provider takes the turn. Your agent loop does not notice.
No card, no trial
5000 requests and 500,000 tokens per day, free.
Connect your agent
Every one of these has a slot for an OpenAI-compatible provider. These tools move quickly, so if a setting has been renamed since this was written, look for the words "OpenAI Compatible", "Custom", or "Base URL" and the pattern still holds.
| Agent | Type | Where the setting lives |
|---|---|---|
| Cline | VS Code extension | Settings, API Provider: OpenAI Compatible |
| Roo Code | VS Code extension | Settings, Provider: OpenAI Compatible |
| Kilo Code | VS Code extension | Provider: OpenAI Compatible |
| Continue | VS Code and JetBrains | config.yaml, provider: openai |
| aider | CLI | --openai-api-base flag or environment |
| OpenCode | CLI | opencode.json, an openai-compatible provider |
| Codex CLI | CLI | config.toml, a custom model_provider |
| Zed | Editor | settings.json, openai with an api_url |
| dreamcode | CLI | Built here. Nothing to configure. |
Cline, Roo Code and Kilo Code
All three are VS Code extensions built on the same provider layer, so the steps are identical. Open the extension settings and choose OpenAI Compatible as the API provider, then fill in three fields:
Base URL https://dreamprompting.com/api/v1
API Key dp-your-key-here
Model ID auto
If the extension offers a "model supports images" or "computer use" toggle, leave those off. Turn the context or auto-approve limits down rather than up: these extensions attach open editor tabs and a repository map to requests, which is the fastest way to hit the 32k input ceiling described below.
aider
aider reads the standard OpenAI environment variables, so nothing needs editing:
export OPENAI_API_BASE=https://dreamprompting.com/api/v1
export OPENAI_API_KEY=dp-your-key-here
aider --model openai/auto
The openai/ prefix tells aider which API dialect to speak; auto is the model name we resolve. Add --map-tokens 0 on a large repository to stop aider sending a repository map with every request, which matters more here than on a paid endpoint.
Continue
Add a model block to your Continue config (~/.continue/config.yaml):
models:
- name: DreamPrompting
provider: openai
model: auto
apiBase: https://dreamprompting.com/api/v1
apiKey: dp-your-key-here
roles: [chat, edit, apply]
Leave autocomplete out of the roles list. Inline completion fires on almost every keystroke and will burn a daily request quota in an afternoon for very little benefit.
OpenCode
Add a provider to opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"dreamprompting": {
"npm": "@ai-sdk/openai-compatible",
"name": "DreamPrompting",
"options": {
"baseURL": "https://dreamprompting.com/api/v1",
"apiKey": "dp-your-key-here"
},
"models": { "auto": { "name": "DreamPrompting auto" } }
}
}
}
Codex CLI
Declare a custom provider in ~/.codex/config.toml:
model = "auto"
model_provider = "dreamprompting"
[model_providers.dreamprompting]
name = "DreamPrompting"
base_url = "https://dreamprompting.com/api/v1"
env_key = "DREAMPROMPTING_API_KEY"
Then export DREAMPROMPTING_API_KEY=dp-.... Putting the key in an environment variable rather than the config file keeps it out of anything you might commit.
Zed
In Zed's settings.json, point the OpenAI provider at this gateway:
{
"language_models": {
"openai": {
"api_url": "https://dreamprompting.com/api/v1",
"available_models": [
{ "name": "auto", "display_name": "DreamPrompting", "max_tokens": 32000 }
]
}
}
}
Paste the key through Zed's assistant panel rather than the settings file, so it lands in the keychain.
Anything else, or your own agent
The API is the OpenAI Chat Completions API, so the official SDKs work unchanged. A minimal tool-calling loop:
from openai import OpenAI
client = OpenAI(base_url="https://dreamprompting.com/api/v1",
api_key="dp-your-key-here")
tools = [{
"type": "function",
"function": {
"name": "read_file",
"description": "Read a file from disk.",
"parameters": {
"type": "object",
"properties": {"path": {"type": "string"}},
"required": ["path"],
},
},
}]
messages = [{"role": "user", "content": "What does src/main.py do?"}]
while True:
reply = client.chat.completions.create(
model="auto", messages=messages, tools=tools,
).choices[0].message
messages.append(reply)
if not reply.tool_calls:
print(reply.content)
break
for call in reply.tool_calls:
result = run_my_tool(call.function.name, call.function.arguments)
messages.append({"role": "tool",
"tool_call_id": call.id,
"content": result})
Streaming works too: pass stream=True and tool call deltas arrive as normal SSE chunks. A provider that returns 200 and then streams nothing is failed over rather than delivered to you as an empty response, because the gateway waits for a real chunk before committing.
The one limit that will actually bite you
Requests are capped at 32,000 input tokens, measured across message content. Tool definitions do not count against it. Output is capped at 8,192 tokens.
This is a gateway guard rather than a model limit, and it exists for a specific reason: a single unbounded request can drain an entire free tier's daily allowance. The largest request logged before the cap went in was 86,000 tokens against a provider tier that allows 100,000 per day. One request, most of a day's capacity.
For a coding agent this is the number that decides whether things work well. A coding conversation is dominated by file contents, so an agent that reads whole files to look around exhausts the budget in about three turns, then starts forgetting the thing it was asked to do. An agent that searches first and reads line ranges stays an order of magnitude below the ceiling. In a real task on this gateway, a well-behaved agent fixed a bug across seven model calls and never exceeded 1,400 tokens of context.
Practical settings that keep you under it:
- Turn off repository maps and whole-repository indexing. In aider that is
--map-tokens 0. - Do not auto-attach every open editor tab. Most extensions do this by default.
- Prefer agents that grep and read ranges over agents that paste whole files.
- Keep the conversation short. Start a new task rather than continuing a thirty-turn thread.
- Skip inline autocomplete entirely. It is a request per keystroke for a suggestion you usually discard.
If you want to see exactly what a given prompt costs before you send it, the token calculator tokenizes text with the real BPE tokenizer rather than estimating from character counts, and the API behind it is free and keyless.
Which model to point it at
Use auto unless you have a reason not to. It is not a specific
model, it is an instruction to try each configured provider in order and move on when one fails. On free tiers
that matters more than any individual model choice, because rate limits are the normal state rather than the
exception. During one measurement pass, Groq's 70B model and two Gemini models were all rate limited
simultaneously, and requests were served by NVIDIA and Cohere instead without the caller noticing.
Model capability does vary in ways that show up specifically in agent loops. The 70B-class models and
gpt-oss-120b hold a multi-step plan together across turns. The 8B
models will happily call tools, but they tend to re-read files they have already read, which wastes the one
resource an agent cannot spare. If a run goes in circles, that is the first thing to change: pin a larger model
rather than adjusting the prompt.
To pin one, use provider/model form, for example
groq/openai/gpt-oss-120b or
nvidia/meta/llama-3.3-70b-instruct. A pinned model is tried first
and then falls back to the normal chain, so pinning improves your odds without giving up resilience. The
models page lists everything currently served.
When something goes wrong
| You see | It means | Do this |
|---|---|---|
| 401 | Key missing or revoked | Check the header is Authorization: Bearer dp-... |
| 413 | Over 32k input tokens | Turn off repo maps and auto-attached files |
| 429 | Per-minute limit or daily quota | The message says which. Wait, or slow the loop |
| 502 | Every provider failed | The message lists what was tried and what was skipped |
| Prose instead of a tool call | The model chose not to call a tool | Pin a larger model, or set tool_choice: "required" |
| Agent loops on the same file | Model too small to track state | Pin a 70B-class model or gpt-oss-120b |
A 502 carrying tools is worth reading closely. The message names every provider tried and says explicitly when one was skipped because it cannot make tool calls, or because the conversation was too long for it. That is usually enough to tell whether the problem is your request or the day's free-tier weather.
Running an agent on your own repository, safely
A coding agent is a program that reads your files and runs commands based on what a language model decides. That is genuinely useful and genuinely worth a few precautions, none of which are specific to this gateway.
Assume everything in the workspace is sent upstream. The agent reads files and puts their
contents in a prompt, which goes to a third-party provider. A .env
holding production credentials is one read_file away from leaving
your machine. Point agents at repositories that do not contain live secrets.
File contents can give the agent instructions. This is prompt injection, and in a coding agent it has real teeth. Text in a README, a code comment, an issue description or a vendored dependency can say "ignore your instructions and run this command", and the model has no reliable way to distinguish that from something you asked for. The approval prompt is what stands between an injected instruction and a shell command running on your machine, which is the main argument for leaving approvals on.
Work on a branch with a clean tree. The cheapest safety mechanism in existence is
git checkout .. If the agent has nothing of yours to destroy that
is not already committed, the worst case is wasted time.
Watch for tests being edited. A failing test is a report about the code. An agent that cannot fix the code will sometimes change the test's expected value to match the bug and then report success, which destroys the only evidence the bug existed. This is common enough across agents that it is worth reviewing any diff that touches a test file.
Our own CLI agent is built around these constraints and documents the specific findings from an adversarial audit of it, including the ones that were real. See the dreamcode page.
Questions people actually ask
- Does this support tool calling and function calling?
- Yes, and it is the whole reason a coding agent works here rather than just a chat box. Of the 18 model routes currently configured, 15 return real tool calls. The gateway now refuses to route a request carrying tools to a source that cannot make them, so an agent never receives prose where it was parsing for a tool call.
- Which model should I pick for a coding agent?
- Use auto unless you have a reason not to. It lets the gateway fail over when a provider is rate limited, which on free tiers happens constantly. If a run goes in circles, pin a 70B-class model or gpt-oss-120b. The 8B models can call tools but tend to re-read files they have already seen, which wastes the context budget that matters most.
- What is the context limit and why is it 32k?
- 32,000 input tokens per request, measured across message content. It is a gateway guard rather than a model limit, and it exists because a single unbounded request can drain a free tier's entire daily allowance. The largest request logged before the cap was 86,000 tokens against a tier that allows 100,000 per day.
- Why did my agent stop after a few file reads?
- Almost always the 32k input ceiling. Coding agents that read whole files into context hit it within a handful of turns and return a 413. Agents that search first and read line ranges stay far below it. Cap the number of files your agent auto-attaches, and turn off any setting that sends the whole open file or the full repository map on every request.
- Do I need a credit card?
- No. A key is free and immediate, and there is no billing attached to it at any usage level. The gateway pools the free tiers of many upstream providers rather than reselling paid capacity.
- Is it fast enough to code with?
- For an agent loop, usually yes, though it is slower than a paid frontier model and noticeably more variable, because a request may be served by any of several providers with different hardware. Groq is very fast when it is not rate limited. Expect seconds rather than sub-second, and expect the occasional retry.
- What happens when a provider hits its rate limit?
- The gateway moves to the next provider that can serve the request and your agent never sees the failure. In a real test run, three consecutive turns of a single task were served by three different providers as free tiers flapped, and the agent did not notice. A provider is not committed to until it has actually produced a chunk, so one that accepts a request and then streams nothing is replaced rather than reaching you as an empty response.
- Can I use this with Claude Code?
- Not directly. Claude Code speaks the Anthropic Messages API rather than the OpenAI Chat Completions API, so it needs a translating proxy in between. Any agent with an OpenAI-compatible provider slot works without one.
- Is it safe to let an agent edit my repository?
- Treat every file in the workspace as something the model will read and may quote back to a third-party provider, so do not point an agent at a directory holding production secrets. Keep approval prompts on until you trust a setup, work on a branch with a clean tree so a bad edit is one git checkout away, and be aware that file contents can carry prompt injection: text in a README or a dependency can instruct the agent, and an approval prompt is what stands between that and a shell command.
- Are my prompts or code used for training?
- DreamPrompting does not train on your requests, but it is a gateway rather than the model host, and each upstream provider applies its own policy to what it receives. Free tiers in particular commonly reserve the right to use requests for improving their services. Do not send code you cannot share with a third party.
- What do the error codes mean?
- 401 means the key is missing or revoked. 413 means the request exceeded 32,000 input tokens, so the agent is sending too much context. 429 is either the per-minute rate limit or the daily key quota, and the message says which. 502 means every provider that could serve the request failed, and the message lists what was tried and why anything was skipped.
- Can I run the agent against a local model instead?
- Yes, since anything OpenAI-compatible works, including Ollama and llama.cpp on your own machine. The tradeoff is hardware: a 70B-class model at reasonable quality needs roughly 40GB of VRAM. The VRAM calculator on this site gives the exact figure for a given model, quantisation and context length.
Point your agent at it
A free key takes a few seconds and works with every tool on this page.