How do I add web search to my AI app, and what does a search cost?
POST https://api.wiozen.com/v1/search with query in the body. It works with the same API key and comes out of your balance. As of 12 November 2026 a successful search costs $0.00009, so 1,000 searches cost $0.09. A search is a request of its own, independent of any model: you take the result and put it into your own prompt for the model.How do I send a search request?
The body must be a JSON object and query must be a non-empty string. Otherwise you get 400 (Missing required parameter: query). You can set the number of results with max_results.
curl https://api.wiozen.com/v1/search \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "istanbul weather this week", "max_results": 5}'The response carries url, title and snippet in a results array:
{
"query": "istanbul weather this week",
"results": [
{ "url": "https://...", "title": "...", "snippet": "..." }
]
}What those fields contain can vary with the search backend. In the live test we ran while building the Content Bot, title was the query itself and url was a redirect link; the real address was in the link's uddg parameter. If you want a site name or address from a result, resolve the address first, as in the example below. A result carries only a short summary (snippet), not the whole page. If you need the full text, give the address to the Markdown conversion endpoint.
How do I give the results to a model?
Search is a separate request and isn't wired into the chat endpoint automatically. You run the search first, then put the summaries and the question into the prompt. Example (model wiozen-coder):
import requests
from urllib.parse import urlparse, parse_qs
H = {"Authorization": "Bearer sk-gw-..."}
BASE = "https://api.wiozen.com/v1"
def real_url(u):
return parse_qs(urlparse(u).query).get("uddg", [u])[0]
question = "What will the weather in Istanbul be like this week?"
found = requests.post(f"{BASE}/search", json={"query": question, "max_results": 5},
headers=H, timeout=60).json()
notes = "\n".join(f"- {real_url(r.get('url', ''))}: {r.get('snippet', '')}"
for r in found.get("results", []))
r = requests.post(f"{BASE}/chat/completions", headers=H, timeout=600, json={
"model": "wiozen-coder",
"max_tokens": 2000,
"messages": [{"role": "user",
"content": f"Question: {question}\n\nSearch results:\n{notes}\n\nAnswer using only these results and list the addresses you used."}],
})
print(r.json()["choices"][0]["message"]["content"])If you want the model itself to decide when to search, define the search as a tool: the model asks for a tool call, your code calls /v1/search and returns the result. That loop is described in the function calling guide.
What does a search cost?
In the code every successful search counts as a fixed 1,000 tokens: 500 input, 500 output. This endpoint has no row on the Models page; the default price applies, $0.03 per million tokens for input and $0.15 for output. The sum: 500 × $0.03 / 1M + 500 × $0.15 / 1M = $0.000015 + $0.000075 = $0.00009.
We checked this against live records too. Between 13 October and 11 November 2026, each of the 2,168 searches that completed cost exactly $0.00009, $0.19512 in total. We took the measurement on 12 November 2026 and the price may change later.
An example for an app that searches for a question and then writes an answer. The numbers are assumptions, not a measured average: a prompt with 5 results is about 3,000 input tokens and the answer is 500 output tokens.
| Line | Tokens | Cost |
|---|---|---|
| Search | 1,000 (fixed) | $0.00009 |
| Answer input, wiozen-coder | 3,000 | $0.00015 |
| Answer output, wiozen-coder | 500 | $0.00010 |
| Total | $0.00034 |
So in this example 1,000 questions cost about $0.34. The answer's cost depends on the model you choose; the search line stays the same. Model prices are on the Models page, the method is in the cost guide.
What happens if there's an error?
If a search can't return a result (the search itself fails), the request isn't charged. A 400 for an empty or missing query is free too.
If the balance has run out or the key's spend limit is reached you get 429; a wrong key gets 401 (429 guide, 401 guide). You can see each search's cost request by request on the Usage page; tracking is covered in the spend tracking guide. The minimum top-up is $5. Card top-ups currently work only from Turkey, with a card issued in Turkey.
Frequently asked questions
Which endpoint does web search on the Wiozen API use?
POST https://api.wiozen.com/v1/search. The body needs query; max_results is optional.How much does one search cost?
Is a failed search charged?
Does a search result bring back the whole page?
snippet) and an address. For the page's text use the /v1/web/fetch endpoint.Can the model run the search by itself?
Get your key on the Keys page; the full list of endpoints is in the docs.
Create your accountMore guides: How can you use an AI API from Turkey without a credit card? · How do you connect an OpenAI-compatible API to a tool you already use? · How do you calculate the cost of an AI API? · What should I do if my AI API key has leaked? · How do you generate images with an AI API, and what does one image cost? · How much does a speech-to-text API cost, and how is it billed per minute? · Why does my AI API return a 429 error, and how do I fix it? · Why do long AI API requests time out: streaming or non-streaming? · Anthropic Messages API or OpenAI Chat Completions: which one should I use? · What is a context window, and what is a 1 million token context good for? · Which AI model should I choose: deciding by price, context and quality · Why does a reasoning model return an empty answer, and why are thinking tokens charged? · Why is my API balance running out faster than expected? Tracking spend request by request · How do you convert a web page to Markdown to feed it to an AI model? · How do you get AI to write and publish articles in WordPress automatically? · How do you find blog topics from RSS feeds and Google Trends? · Does AI-written content show up on Google and in AI answers? · How do you get internal links into AI-written WordPress articles? · How do you get AI to generate a different featured image for every WordPress post? · How do you write a content brief when an AI writes your blog posts? · What should you watch for when an AI writes recipes for your food blog? · How do you fix errors when connecting a WordPress plugin to your AI API account? · Why does my AI article bot stop halfway in WordPress? "Run is stuck" and LiteSpeed · Why are my scheduled WordPress posts late? WP-Cron and a real server cron · How do I get an AI article bot to write blog posts in English or another language? · What does "Content Bot cannot generate articles" mean? Reading the bot's log · If I delete the WordPress AI article plugin, are the articles it wrote deleted? · How do you do function calling (tool use) with an AI API? · How do I check my AI API balance from code and get a low-balance alert? · Can I use the same AI article plugin on several WordPress sites with one account and one balance? · How do you run Claude Code with a different API address and key? · Do AI-written WordPress posts get an FAQ section and FAQ structured data (schema)? · My AI API returns "401 Invalid API key": why isn't my key accepted? · Is there a free trial for an AI API? How much credit Wiozen API gives and what it covers · Claude Haiku vs Claude Sonnet via API: price per million tokens and when to use each · How much does a Claude Code session cost with an API key? · Can you use Claude Code without a subscription and pay only for what you use? · How much does prompt caching cut API costs? Cache read and cache write prices · When is the DeepSeek API cheaper? Peak and off-peak hour pricing · Which model should you use in Cline, Cursor, OpenCode and Aider? · How much does an AI-written WordPress post cost? Text, image and research · Why didn't the AI bot publish its post, and why is it stuck in drafts? · How many AI-written posts a day should you publish, and how do you set the frequency? · Who should be the author of AI-written WordPress posts? · What to watch for when AI writes posts for a loan, crypto or energy website · An AI API returns "Unknown model": where do I find the right model name?