Wiring a keyless model into automation flows and phone shortcuts

Automation builders love language models for the small jobs between apps: qualifying a lead that arrives on WhatsApp, drafting a reply to a form submission, tagging an email, or turning a note into a calendar event. Many published examples use Gemini through an API key from AI Studio, plugged into an n8n workflow or an iPhone Shortcut, and some proudly note that no OpenAI key is needed.
This guide shows how to add an AI step that needs no key at all, using the OpenAI-compatible endpoint on this site, and how to do it in a way that survives real use: correct request format, reliable parsing, rate limit handling and sensible data hygiene. The same patterns apply if you later switch the step to Gemini or another provider.
Frequently asked questions
What is an AI step in an automation?
A node or action that sends text from earlier steps to a model and passes the model's answer to later steps. In n8n it is usually an HTTP Request or a dedicated AI node; in Apple Shortcuts it is the Get Contents of URL action.
How does the keyless endpoint differ from using a Gemini key?
There is no credential to create, store or leak, and no billing. In exchange, limits apply per IP address, there is no SLA, and the model is free-ai, an independent open-weight model, not Gemini. It is text only, so image generation steps still need another provider.
Which request format should I use?
For flows that need control, use POST /v1/chat/completions with a JSON body. For the simplest possible step, GET /ask?q= returns plain text, or JSON with &format=json.
Why does my flow get 429 errors?
The endpoint allows one request per second per IP with bursts of three and two parallel requests. Flows that process lists in parallel exceed that quickly. Add a wait between items or batch them, and honour the Retry-After header.
Why does my HTTP step get 403?
The API rejects requests without a normal User-Agent. Most automation tools send one automatically. If you use a custom script node with a minimal HTTP client, set a User-Agent header explicitly.
Which is better for lead qualification, rules or a model?
Use rules for hard facts like budget ranges or postcodes, and a model for fuzzy judgement like intent and urgency from free text. Combining both is more reliable than either alone.
Is it safe to send customer messages to a free API?
Each request leaves a technical log with time, IP, User-Agent and token counts, and the content passes through a third-party service. Send only what the task needs, remove phone numbers and emails where possible, and check your own privacy obligations.
Can a Shortcut generate images with this endpoint?
No. The free-ai endpoint is text only. Shortcuts that create images use image-capable APIs from other providers, with their own keys and costs.
Step by step
- Test the request in a terminal — Run the reference curl command and confirm you get a JSON answer with text in choices[0].message.content.
- Add an HTTP step to your flow — In n8n use an HTTP Request node, in Shortcuts use Get Contents of URL, with POST, a JSON body and the chat completions URL.
- Map inputs into messages — Keep the system message fixed and insert the incoming text from earlier steps into the user message.
- Parse and validate the answer — Extract the content field, parse JSON if requested, and check every field against allowed values.
- Add retries and rate limiting — Batch items with at least a second between requests, retry on 429 and 503, and route persistent failures to an error branch.
- Trim personal data — Send only the text the model needs and keep identifiers in your own system.
The request every tool needs to send
Whatever the tool, the AI step is a single HTTP request. The body names the model, gives a list of messages and optionally sets a maximum length and temperature. The answer is a JSON object whose text sits at choices[0].message.content.
Once you can produce this request in one tool, you can produce it in any of them. The command below is the reference; test it in a terminal first, then reproduce it in your automation tool.
No authorisation header required
The endpoint ignores keys, so you can leave out the Authorization header. If a tool insists on one, any placeholder value works.
Keep temperature low for automations
Automations need predictable output. A temperature around 0.2 keeps answers consistent from run to run, which makes parsing far more reliable.
curl -s https://api.apifreegemini.com/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{
"model": "free-ai",
"temperature": 0.2,
"max_tokens": 200,
"messages": [
{"role": "system", "content": "Reply only with JSON: {\"intent\": \"buy|rent|other\", \"urgency\": \"high|low\"}"},
{"role": "user", "content": "Hi, we need a 2-bedroom flat to rent from next month, near the station."}
]
}'Setting it up in n8n
In n8n, the most transparent option is the HTTP Request node. Set the method to POST, the URL to https://api.apifreegemini.com/v1/chat/completions, send a JSON body, and build the messages from previous nodes with expressions. Some AI nodes also accept a custom OpenAI-compatible base URL; if yours does, set it to https://api.apifreegemini.com/v1 and the model to free-ai.
After the request, add a node that reads choices[0].message.content and, if you asked for JSON, parses it. Route the flow based on the parsed fields.
Build the body with expressions
Put the incoming message text into the user message with an expression referencing the previous node. Keep the system message static so that every run uses the same instructions.
Use the batching options
When a node processes many items, enable batching with a small batch size and an interval of at least a second. This keeps the flow inside the per-IP rate limit.

A lead qualifier as a worked example
A popular pattern is a messaging assistant for real estate that reads incoming enquiries and decides who deserves an immediate call. The model's job is narrow: classify intent, urgency and missing information from free text. Hard facts such as budget limits stay in ordinary rules.
Ask the model for a fixed JSON shape, validate it, and fall back to a human queue when parsing fails or the model is unsure. That way the automation never silently drops a lead.
Validate before acting
Check that the JSON parses and that each field has an allowed value. If not, route to a human queue rather than guessing. One wrong automated reply costs more trust than a short delay.
- Extract intent: buy, rent or other
- Estimate urgency from wording and dates
- List missing details such as budget or area
- Draft a short, polite reply asking for those details
- Send uncertain cases to a person
Adding AI to Apple Shortcuts
Shortcuts can call any web API with the Get Contents of URL action. Choose POST as the method, set the request body to JSON, and add the fields model, max_tokens and messages. For the messages array, a dictionary per message with role and content keys works.
For a quick personal shortcut, the plain-text endpoint is even simpler: build a URL like https://api.apifreegemini.com/ask?q= followed by the URL-encoded question, and the response is the answer as text, ready to show or speak.
Extract the answer
With the chat endpoint, use Get Dictionary Value on the result to walk down to choices, then the first item, then message and content. With the ask endpoint, the result is already the answer text.
Share sheet input
Shortcuts that accept text from the share sheet can summarise an article, rewrite a message or translate a paragraph from any app. Keep the input short; very long selections are better handled in a script.

Handling limits and errors gracefully
Every automation eventually meets a 429 or a 503. A 429 means your IP exceeded the rate or daily limit; it comes with a Retry-After header saying how long to wait. A 503 means the service is busy; retrying after two to five seconds usually works. Both are normal and should be handled rather than treated as failures.
Most automation tools offer retry settings per node. Set a few retries with a wait of several seconds, and add an error branch that notifies you or parks the item for later.
Daily budgets reset at midnight UTC
The per-IP limit of 10,000 requests or 10,000,000 tokens per day resets at 00:00 UTC. Heavy batch flows should be scheduled with that in mind, or split across days.
Cloud-hosted automation shares IPs
If your flows run on a hosted automation platform, your requests may share outgoing IP addresses with other customers, and therefore share rate limits. Self-hosted instances avoid that.
Code nodes and custom scripts
When a flow needs logic beyond simple mapping, a code node or a small script is clearer. The Python version below uses requests, which sends a normal User-Agent, and handles 429 and 503 responses with a short wait. If you ever switch to Python's built-in urllib, remember to set a User-Agent header, or the API will answer 403.
import json
import time
import requests
URL = "https://api.apifreegemini.com/v1/chat/completions"
def classify(message, attempts=4):
body = {
"model": "free-ai", "temperature": 0.2, "max_tokens": 150,
"messages": [
{"role": "system", "content": 'Return JSON only: {"intent": "buy|rent|other", "urgency": "high|low"}'},
{"role": "user", "content": message},
],
}
for _ in range(attempts):
r = requests.post(URL, json=body, timeout=60)
if r.status_code in (429, 503):
time.sleep(float(r.headers.get("Retry-After", 3)))
continue
r.raise_for_status()
text = r.json()["choices"][0]["message"]["content"]
try:
return json.loads(text.strip().strip("`").removeprefix("json"))
except json.JSONDecodeError:
return {"intent": "other", "urgency": "low", "needs_human": True}
return {"intent": "other", "urgency": "low", "needs_human": True}
print(classify("Looking to buy a house with a garden before the school year starts."))
Data hygiene in automated flows
Automations move personal data around without anyone looking, so decide upfront what reaches the model. Strip phone numbers, emails and addresses from the text if the task does not need them. Keep the original record in your own system and send only the free-text part to the AI step.
This site is not affiliated with Google, and its requests are logged technically with time, IP, User-Agent, country, endpoint, status, latency, sizes and tokens. Conversations are not stored between calls, but content still passes through a third party. For regulated data, use a provider with a contract that covers it. The article on keeping keys and credentials safe covers the paid side of the same question.
Keep a record of what was sent
Store in your own system which records went through the AI step, when, and what the model returned. If a customer asks why they received a certain reply, you can answer without guessing, and you can delete the record when your retention rules say so.
Switching providers later
Because the request format is the widely used OpenAI style, moving the step to another provider later means changing the URL, adding a key and changing the model name. Keep those three values in your tool's credentials or environment settings rather than scattered across nodes.
If a flow grows to need images, long documents or strict uptime, a commercial provider is the better fit. The keyless route remains handy for prototypes and personal shortcuts. For flows that should choose between models automatically, see routing prompts between cheap and strong models.
One place for model settings
Store base URL, model and key as variables or credentials. A provider change then touches one setting instead of every workflow that uses AI.

Send a test prompt to the keyless free-ai endpoint from the home page, no sign-up or key required.
Read also
- Open-weight models vs Gemini: when is a mid-size model good enough?
- How to move your chat context between ChatGPT, Gemini and an API
- When is it worth switching on thinking or reasoning mode in an API?
- How to keep a Gemini API key out of your app and off the bill
- Why do non-English prompts burn more tokens on Gemini and others?