Technology Aug 31, 2026 · 9 min read

I Tried 5 Free LLM APIs With One Python Script

I wanted to find a free LLM API for small tools and experiments. There are many lists online, but free plans change often. Some model names and limits were already old when I checked them. So I opened new accounts and tried five providers myself: Groq Google AI Studio OpenRouter Cloudflare Worker...

DE
DEV Community
by Erika
I Tried 5 Free LLM APIs With One Python Script

I wanted to find a free LLM API for small tools and experiments.

There are many lists online, but free plans change often. Some model names and
limits were already old when I checked them. So I opened new accounts and tried
five providers myself:

  • Groq
  • Google AI Studio
  • OpenRouter
  • Cloudflare Workers AI
  • Token Harbor

I did not add a credit card to any account. I used the same Python script and
the same two tasks as much as possible.

One disclosure: I work with Token Harbor. To keep the comparison fair, I used
the same test method for all five providers. I also kept failed requests and
problems in the results. This includes the weak points of Token Harbor.

Quick results

Provider and model Setup Free limit in my test Coding task Context test Main problem
Groqqwen/qwen3.8-27b 1–2 min 30 RPM, 1K RPD, 8K TPM, 2M TPD Passed in 1.85s 7,521 input tokens passed in 2.13s 8K TPM limits the size of one request
Google AI Studiogemini-3.5-flash-lite 3–4 min 15 RPM, 250K input TPM, 500 RPD Passed in 6.54s First request failed; 84,424-token retry passed in 24.35s One temporary 503 error
OpenRouterpoolside/laguna-s-2.1:free A few minutes 50 free requests per day First request got 429; retry passed First request got 429; 80,464-token retry passed in 9.35s Shared free pool was busy
Cloudflare Workers AI@cf/google/gemma-4-26b-a4b-it Longest 10K neurons per day Returned JSON, but code had one edge-case bug 20K words failed; 42,268-token smaller test passed in 5.93s Setup was harder and long calls disconnected
Token Harbordeepseek-v4-flash:free 1–2 min Rolling 7-day value allowance Passed in 1.84s 63,887 input tokens passed in 34.62s Dashboard shows a percentage, not an exact cap

These results are from August 28–29, 2026. They are only a snapshot. Free plans
and models can change.

Test method

I used two small tests. My goal was not to make a full model benchmark. I only
wanted to check if the API was really usable.

Test 1: Python debugging

I gave each model a short Python function with several bugs. The model had to:

  • remove a mutable default argument;
  • ignore duplicate order IDs;
  • exclude cancelled orders;
  • return the correct count and total;
  • return the answer as JSON.

I checked both the JSON format and the corrected code.

Test 2: long-context retrieval

The script created a synthetic incident log. I placed three exact values near
the start, middle, and end. The model had to find all three values and return
them as JSON.

The normal test was about 20,000 words. I used a smaller input for Groq because
its free plan had an 8K TPM limit. I also reduced the Cloudflare test after the
20K-word requests failed.

I turned off automatic SDK retries. If I retried by hand, I saved both the
failed request and the successful request.

All requests used the same local HTTP proxy from APAC. The latency may be
different in another region.

The basic request looked like this:

from openai import OpenAI

client = OpenAI(
    api_key=API_KEY,
    base_url=PROVIDER_BASE_URL,
    max_retries=0,
)

response = client.chat.completions.create(
    model=MODEL_ID,
    messages=[{"role": "user", "content": prompt}],
    temperature=0,
    max_completion_tokens=3000,
)

All five providers supported an OpenAI-style Chat Completions request. Cloudflare
also needed an Account ID in the base URL.

Groq

Groq was the easiest provider to start using. I signed in with Google and made
an API key. I did not need another email verification step or a credit card.

For qwen/qwen3.8-27b, my account showed these limits:

  • 30 requests per minute
  • 1,000 requests per day
  • 8,000 tokens per minute
  • 2,000,000 tokens per day

The daily limit is large, but the per-minute token limit is much smaller. This
means I could not send the normal 20K-word test in one request.

I used a smaller prompt with 7,521 input tokens. The model found all three
values in 2.13 seconds. The coding task also returned correct code in 1.85
seconds. One sentence in its bug explanation was not correct, but the fixed
function worked.

Groq was the best fit for short and fast requests in this test. For large
prompts, it is important to check TPM and not only TPD.

Groq rate limits

Google AI Studio

Google AI Studio took about three or four minutes to set up. I signed in with
Google, created a project, and generated an API key. It did not require a card.

My project showed 15 RPM, 250K input TPM, and 500 RPD for
gemini-3.5-flash-lite.

The coding task passed in 6.54 seconds. The code was correct, but one sentence
in the explanation was wrong.

The first long-context request failed with HTTP 503 UNAVAILABLE. I tried again
about one minute later. The second request passed:

  • 84,424 input tokens
  • 67 output tokens
  • 24.35 seconds
  • all three values were correct

I found one difference in Google's usage numbers. The API response reported
84,424 prompt tokens, but the rate-limit page showed a 64.72K TPM peak. I kept
both numbers in my notes because they may use different accounting methods.

Google's terms for unpaid Gemini API services also need attention. Content may
be used to improve Google products, and the rules can be different by region. I
only used synthetic data in this test.

OpenRouter

OpenRouter did not require a credit card or another email verification step.
There were some signup questions, and it showed an option to add a card. I could
skip it.

I used poolside/laguna-s-2.1:free. I chose a fixed model instead of the
openrouter/free router because I wanted to test the same model again on a
retry.

The first coding request returned 429. The first long-context request also
returned 429. Both errors came from the shared upstream free pool. They were not
caused by using all 50 daily requests.

Both manual retries worked. The long-context retry used 80,464 input tokens,
finished in 9.35 seconds, and found all three values.

The OpenRouter Dashboard showed two successful requests, about 81.1K tokens,
and $0.00 spend. However, I could not find a simple counter showing how many of
the 50 daily free requests were still available.

OpenRouter is useful for trying many free models with one API. I would still add
retry logic because the shared free pool can be busy.

OpenRouter free-model limits

Cloudflare Workers AI

Cloudflare did not require a card, but the setup was harder for me. I had to
find the Workers AI REST API page, create a scoped API token, and copy the
Account ID. This was different from a normal API-key page.

The first coding request used all 3,000 output tokens for model thinking and
returned no visible answer. Cloudflare's example for this Gemma model showed
how to turn thinking off:

extra_body={
    "chat_template_kwargs": {
        "enable_thinking": False
    }
}

After this change, the model returned valid JSON in 4.32 seconds. It used 10.82
neurons. The answer was close, but the fixed function missed one edge case. A
cancelled order ID could be accepted later if the same ID appeared again.

The long-context test had another problem. Three 20K-word requests failed before
the client received an answer. Two connections stayed open for about 120 and
111 seconds. The third failed during TLS after 3.48 seconds.

I reduced the prompt to about 10,000 words. This request passed:

  • 42,268 input tokens
  • 54 output tokens
  • 5.93 seconds
  • all three values were correct

The Dashboard later showed 2.02K of the daily 10K neurons used. Successful
responses explained only about 482 neurons. The remaining amount was close to
the estimated input cost of the two long requests that disconnected after about
two minutes.

This suggests that Cloudflare processed and counted those requests even though
my client did not receive the answers. This is only an estimate from the total
Dashboard usage. I cannot say if Cloudflare, the proxy, or another network part
caused the disconnects.

Token Harbor

Token Harbor took about two minutes to set up. I registered, verified my email,
and generated an API key. It did not require a card.

I tested deepseek-v4-flash:free. The coding task passed in 1.84 seconds. The
normal long-context request also passed:

  • 20,075 words
  • 63,887 input tokens
  • 293 output tokens
  • 34.62 seconds
  • all three values were correct

The free limit is different from the other providers. It is a value-based
allowance with a personal rolling seven-day period. The Dashboard shows the
used percentage, but it does not show a fixed token number.

About 70K tokens moved the meter from 0% to 4%. A simple estimate gives around
1.5 to 2 million similar DeepSeek tokens for one period. This is not an official
limit. The Dashboard percentage is rounded, and another model may use the
value-based allowance at a different rate.

Permanent free routes are opt-in. Token Harbor may retain prompts and responses
sent through these routes. Paid routes use a different zero-retention policy. I
would not send private code or customer data through the free route.

My final view

Need My choice from this test
Short and fast requests Groq
A large free request with clear project limits Google AI Studio
Many models through one API OpenRouter, with retry logic
Existing Cloudflare project Workers AI, after learning its setup
Rolling allowance without a separate TPM limit Token Harbor

All five APIs worked without a credit card. They were good enough for testing,
personal tools, and low-volume automation.

I would not depend on a free endpoint alone for a user-facing product. Google
returned one 503. OpenRouter returned two shared-pool 429 errors. Cloudflare's
long requests disconnected, and some of that work appeared in the usage meter.

There was also a model-quality issue. Four providers returned functionally
correct Python fixes, but three of those answers included at least one wrong
explanation. Cloudflare returned valid JSON, but its code still had one edge-case
bug.

For me, a free API still needs timeouts, retry rules, logs, and a paid fallback.
The quota number alone is not enough to choose a provider.

I used synthetic prompts only. Limits and available models may change, so
please check the official pages before using them. I used AI to help organize
and edit this article. I checked the final numbers against my saved test files.

DE
Source

This article was originally published by DEV Community and written by Erika.

Read original article on DEV Community
Back to Discover

Reading List