{"slug": "i-tried-5-free-llm-apis-with-one-python-script", "title": "I Tried 5 Free LLM APIs With One Python Script", "summary": "A developer tested five free LLM APIs—Groq, Google AI Studio, OpenRouter, Cloudflare Workers AI, and Token Harbor—using a single Python script and two tasks. The results, published on August 28–29, 2026, show that Groq was easiest to set up and fastest for short requests, while Cloudflare had the most difficult setup and long-call disconnections. The developer, who works at Token Harbor, disclosed the affiliation and included Token Harbor's weaknesses in the comparison.", "body_md": "I wanted to find a free LLM API for small tools and experiments.\n\nThere are many lists online, but free plans change often. Some model names and\n\nlimits were already old when I checked them. So I opened new accounts and tried\n\nfive providers myself:\n\nI did not add a credit card to any account. I used the same Python script and\n\nthe same two tasks as much as possible.\n\nOne disclosure: I work with Token Harbor. To keep the comparison fair, I used\n\nthe same test method for all five providers. I also kept failed requests and\n\nproblems in the results. This includes the weak points of Token Harbor.\n\n| Provider and model | Setup | Free limit in my test | Coding task | Context test | Main problem |\n|---|---|---|---|---|---|\nGroq — `qwen/qwen3.8-27b`\n|\n1–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 |\nGoogle AI Studio — `gemini-3.5-flash-lite`\n|\n3–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 |\nOpenRouter — `poolside/laguna-s-2.1:free`\n|\nA 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 |\nCloudflare Workers AI — `@cf/google/gemma-4-26b-a4b-it`\n|\nLongest | 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 |\nToken Harbor — `deepseek-v4-flash:free`\n|\n1–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 |\n\nThese results are from August 28–29, 2026. They are only a snapshot. Free plans\n\nand models can change.\n\nI used two small tests. My goal was not to make a full model benchmark. I only\n\nwanted to check if the API was really usable.\n\nI gave each model a short Python function with several bugs. The model had to:\n\nI checked both the JSON format and the corrected code.\n\nThe script created a synthetic incident log. I placed three exact values near\n\nthe start, middle, and end. The model had to find all three values and return\n\nthem as JSON.\n\nThe normal test was about 20,000 words. I used a smaller input for Groq because\n\nits free plan had an 8K TPM limit. I also reduced the Cloudflare test after the\n\n20K-word requests failed.\n\nI turned off automatic SDK retries. If I retried by hand, I saved both the\n\nfailed request and the successful request.\n\nAll requests used the same local HTTP proxy from APAC. The latency may be\n\ndifferent in another region.\n\nThe basic request looked like this:\n\n``` python\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=API_KEY,\n    base_url=PROVIDER_BASE_URL,\n    max_retries=0,\n)\n\nresponse = client.chat.completions.create(\n    model=MODEL_ID,\n    messages=[{\"role\": \"user\", \"content\": prompt}],\n    temperature=0,\n    max_completion_tokens=3000,\n)\n```\n\nAll five providers supported an OpenAI-style Chat Completions request. Cloudflare\n\nalso needed an Account ID in the base URL.\n\nGroq was the easiest provider to start using. I signed in with Google and made\n\nan API key. I did not need another email verification step or a credit card.\n\nFor `qwen/qwen3.8-27b`\n\n, my account showed these limits:\n\nThe daily limit is large, but the per-minute token limit is much smaller. This\n\nmeans I could not send the normal 20K-word test in one request.\n\nI used a smaller prompt with 7,521 input tokens. The model found all three\n\nvalues in 2.13 seconds. The coding task also returned correct code in 1.85\n\nseconds. One sentence in its bug explanation was not correct, but the fixed\n\nfunction worked.\n\nGroq was the best fit for short and fast requests in this test. For large\n\nprompts, it is important to check TPM and not only TPD.\n\nGoogle AI Studio took about three or four minutes to set up. I signed in with\n\nGoogle, created a project, and generated an API key. It did not require a card.\n\nMy project showed 15 RPM, 250K input TPM, and 500 RPD for\n\n`gemini-3.5-flash-lite`\n\n.\n\nThe coding task passed in 6.54 seconds. The code was correct, but one sentence\n\nin the explanation was wrong.\n\nThe first long-context request failed with HTTP 503 `UNAVAILABLE`\n\n. I tried again\n\nabout one minute later. The second request passed:\n\nI found one difference in Google's usage numbers. The API response reported\n\n84,424 prompt tokens, but the rate-limit page showed a 64.72K TPM peak. I kept\n\nboth numbers in my notes because they may use different accounting methods.\n\nGoogle's terms for unpaid Gemini API services also need attention. Content may\n\nbe used to improve Google products, and the rules can be different by region. I\n\nonly used synthetic data in this test.\n\nOpenRouter did not require a credit card or another email verification step.\n\nThere were some signup questions, and it showed an option to add a card. I could\n\nskip it.\n\nI used `poolside/laguna-s-2.1:free`\n\n. I chose a fixed model instead of the\n\n`openrouter/free`\n\nrouter because I wanted to test the same model again on a\n\nretry.\n\nThe first coding request returned 429. The first long-context request also\n\nreturned 429. Both errors came from the shared upstream free pool. They were not\n\ncaused by using all 50 daily requests.\n\nBoth manual retries worked. The long-context retry used 80,464 input tokens,\n\nfinished in 9.35 seconds, and found all three values.\n\nThe OpenRouter Dashboard showed two successful requests, about 81.1K tokens,\n\nand $0.00 spend. However, I could not find a simple counter showing how many of\n\nthe 50 daily free requests were still available.\n\nOpenRouter is useful for trying many free models with one API. I would still add\n\nretry logic because the shared free pool can be busy.\n\nCloudflare did not require a card, but the setup was harder for me. I had to\n\nfind the Workers AI REST API page, create a scoped API token, and copy the\n\nAccount ID. This was different from a normal API-key page.\n\nThe first coding request used all 3,000 output tokens for model thinking and\n\nreturned no visible answer. Cloudflare's example for this Gemma model showed\n\nhow to turn thinking off:\n\n```\nextra_body={\n    \"chat_template_kwargs\": {\n        \"enable_thinking\": False\n    }\n}\n```\n\nAfter this change, the model returned valid JSON in 4.32 seconds. It used 10.82\n\nneurons. The answer was close, but the fixed function missed one edge case. A\n\ncancelled order ID could be accepted later if the same ID appeared again.\n\nThe long-context test had another problem. Three 20K-word requests failed before\n\nthe client received an answer. Two connections stayed open for about 120 and\n\n111 seconds. The third failed during TLS after 3.48 seconds.\n\nI reduced the prompt to about 10,000 words. This request passed:\n\nThe Dashboard later showed 2.02K of the daily 10K neurons used. Successful\n\nresponses explained only about 482 neurons. The remaining amount was close to\n\nthe estimated input cost of the two long requests that disconnected after about\n\ntwo minutes.\n\nThis suggests that Cloudflare processed and counted those requests even though\n\nmy client did not receive the answers. This is only an estimate from the total\n\nDashboard usage. I cannot say if Cloudflare, the proxy, or another network part\n\ncaused the disconnects.\n\nToken Harbor took about two minutes to set up. I registered, verified my email,\n\nand generated an API key. It did not require a card.\n\nI tested `deepseek-v4-flash:free`\n\n. The coding task passed in 1.84 seconds. The\n\nnormal long-context request also passed:\n\nThe free limit is different from the other providers. It is a value-based\n\nallowance with a personal rolling seven-day period. The Dashboard shows the\n\nused percentage, but it does not show a fixed token number.\n\nAbout 70K tokens moved the meter from 0% to 4%. A simple estimate gives around\n\n1.5 to 2 million similar DeepSeek tokens for one period. This is not an official\n\nlimit. The Dashboard percentage is rounded, and another model may use the\n\nvalue-based allowance at a different rate.\n\nPermanent free routes are opt-in. Token Harbor may retain prompts and responses\n\nsent through these routes. Paid routes use a different zero-retention policy. I\n\nwould not send private code or customer data through the free route.\n\n| Need | My choice from this test |\n|---|---|\n| Short and fast requests | Groq |\n| A large free request with clear project limits | Google AI Studio |\n| Many models through one API | OpenRouter, with retry logic |\n| Existing Cloudflare project | Workers AI, after learning its setup |\n| Rolling allowance without a separate TPM limit | Token Harbor |\n\nAll five APIs worked without a credit card. They were good enough for testing,\n\npersonal tools, and low-volume automation.\n\nI would not depend on a free endpoint alone for a user-facing product. Google\n\nreturned one 503. OpenRouter returned two shared-pool 429 errors. Cloudflare's\n\nlong requests disconnected, and some of that work appeared in the usage meter.\n\nThere was also a model-quality issue. Four providers returned functionally\n\ncorrect Python fixes, but three of those answers included at least one wrong\n\nexplanation. Cloudflare returned valid JSON, but its code still had one edge-case\n\nbug.\n\nFor me, a free API still needs timeouts, retry rules, logs, and a paid fallback.\n\nThe quota number alone is not enough to choose a provider.\n\n*I used synthetic prompts only. Limits and available models may change, so\nplease check the official pages before using them. I used AI to help organize\nand edit this article. I checked the final numbers against my saved test files.*", "url": "https://wpnews.pro/news/i-tried-5-free-llm-apis-with-one-python-script", "canonical_source": "https://dev.to/erika_minamitsu/i-tried-5-free-llm-apis-with-one-python-script-1p1j", "published_at": "2026-08-31 11:31:04+00:00", "updated_at": "2026-08-31 11:52:32.110540+00:00", "lang": "en", "topics": ["large-language-models", "developer-tools", "ai-products"], "entities": ["Groq", "Google AI Studio", "OpenRouter", "Cloudflare Workers AI", "Token Harbor", "qwen/qwen3.8-27b", "gemini-3.5-flash-lite", "deepseek-v4-flash:free"], "alternates": {"html": "https://wpnews.pro/news/i-tried-5-free-llm-apis-with-one-python-script", "markdown": "https://wpnews.pro/news/i-tried-5-free-llm-apis-with-one-python-script.md", "text": "https://wpnews.pro/news/i-tried-5-free-llm-apis-with-one-python-script.txt", "jsonld": "https://wpnews.pro/news/i-tried-5-free-llm-apis-with-one-python-script.jsonld"}}