This article will take about 4 minutes to read.
The advent of LLMs allows us to get access to vast quantities of information that may or may not be correct. It’s up to us to sort through that information to make sure that it’s been verified for accuracy. But the information it provides is mostly correct. The chance that it is correct improves if the generated text does not require much context or reasoning.
One use case for AI that requires very little context at all is returning structured data, as if it were an API. As long as a human is able to review the output for accuracy, that means that a completion API is able to stand in for just about any read-only API out there.
Unlike specialized APIs that perform one function, a completion API can act as a universal interface to a wide range of tasks and services—effectively serving as a stand-in for many other specialized APIs. This is possible because it:
Task | Traditional API Call | Completions API Prompt |
---|---|---|
Currency conversion | Use a Forex API | “Convert 100 USD to EUR using today’s exchange rate.” |
Data extraction | Use a scraper or parsing tool | “Extract all emails and phone numbers from this text.” |
Resume screening | Use HR software | “Summarize the candidate’s qualifications for a tech role.” |
Medical symptoms check | Use a symptom-checker API | “Given these symptoms, what could be the possible causes?” |
A completion API can function as a wrapper or front-end to other bespoke APIs by:
For example, a simple natural language query like “How many orders did we ship to Germany last week?” could be transformed into a structured API call like this:
User Input (Natural Language)
→ "How many orders did we ship to Germany last week?"
Completions API (NLP Translation Layer)
→ Parses and interprets the intent, entities, and timeframes.
→ Outputs a structured API call:
{
"endpoint": "/orders",
"method": "GET",
"params": {
"country": "Germany",
"date_range": "2025-04-28 to 2025-05-04"
}
}
Backend API (Your Custom Logic)
→ Executes the call and returns raw data.
Completions API (Response Interpretation)
→ Converts structured API response into natural language:
"We shipped 153 orders to Germany between April 28 and May 4."
Benefits of This Wrapper Approach
Domain | Natural Language Query | Backend Function Triggered |
---|---|---|
Logistics | “Track my last shipment to Canada” | GET /shipments?destination=Canada&status=latest |
HR/Recruiting | “List applicants with Java and 5+ years experience” | POST /filter_candidates |
Finance | “What was the revenue last quarter?” | GET /revenue?period=Q1-2025 |
Healthcare | “Show me patients with elevated blood pressure” | POST /patients/filter |
Use the Completions API to output structured JSON (via schema-based prompting or function-calling syntax).
Use a middleware layer that:
Validates and sanitizes model outputs.
Maps model outputs to concrete API calls.
Feeds results back through the model for summary or user-facing presentation.
You can also support follow-up queries (like “What about France?”) by keeping conversational context and allowing the model to generate delta queries or comparisons automatically.