pawit_roy
Employee
Employee

Large Language Models (LLMs) are revolutionizing the way we interact with digital systems, from conversational agents to intelligent automation. But to truly harness their capabilities, especially in enterprise and developer ecosystems, it’s essential to bridge the gap between LLMs and external systems through tools—specifically APIs. This is where OpenAPI plays a pivotal role.

pawit_roy_0-1744902728471.png

What is OpenAPI?

OpenAPI (formerly Swagger) is an open-source specification that defines a standard, machine-readable format for describing RESTful APIs. It enables developers and automated systems to understand an API’s structure—including endpoints, request parameters, authentication methods, and response types—without relying on traditional documentation or access to source code.

Its adoption spans industries such as technology, finance, and healthcare, thanks to its interoperability with a wide array of tools and frameworks.

Why OpenAPI Matters for LLMs

Integrating OpenAPI with LLMs enhances their ability to interact with real-world systems. Here's how:

  • Universal Interface: OpenAPI acts as a universal bridge to RESTful APIs, making it possible for LLMs to interact with services ranging from cloud infrastructure to productivity apps.
  • Standardized Format: The standardized schema helps LLMs accurately interpret API functionality—including expected inputs and outputs—without ambiguity.
  • Accelerated Tool Creation: Developers can efficiently build LLM-compatible tools by parsing OpenAPI definitions directly.
  • Seamless Integration: With broad support from API tooling ecosystems, OpenAPI enables quick embedding of LLM agents into existing workflows.
  • Supports Tool Calling: Tool calling allows LLMs to autonomously select and invoke relevant APIs based on user prompts—a key feature unlocked by structured OpenAPI descriptions.

Enabling LLM Tool Calling with SnapLogic

To connect LLMs with OpenAPI-defined tools, the OpenAPI Function Generator Snap plays a crucial role. This component converts any OpenAPI spec into a tool object that LLMs can use through the Tool Calling pipeline in SnapLogic.

pawit_roy_1-1744902888625.png

pawit_roy_2-1744902897467.png

Input Options for the Generator Snap

The generator supports multiple input methods:

  • URL: Directly fetch the OpenAPI spec from a provided URL.
    pawit_roy_3-1744902968350.png
  • Text Editor: Paste the raw spec into a built-in editor.
    pawit_roy_4-1744903002589.png
     
  • Input Document: Pass the OpenAPI string as part of an input document via expression.pawit_roy_5-1744903037503.png

     

     

  • File Upload: Select a spec file stored in the SLDB.
    pawit_roy_6-1744903065314.png
     

Output Structure

pawit_roy_7-1744903095199.png

The generated tool output includes:

  • sl_tool_metadata: Metadata such as security parameters, headers, and base URLs.
  • json_schema: A schema of the input parameters.

These tools can be passed into the Tool Calling Snap, which then resolves runtime variables like headers and endpoint URLs dynamically. Developers can chain this with an HTTP Client Snap to perform real API calls based on LLM outputs.

Passing Through the Tool Calling Snap

When the tool is passed through the Tool Calling Snap, it dynamically processes and resolves several key components using the metadata and user input:

  • Resolved URL: The base URL and path parameters from the OpenAPI spec are combined with user-supplied values to generate the final API endpoint.
  • Headers: Custom headers, or content-type headers are filled in based on the OpenAPI security definitions or context provided by the LLM.

pawit_roy_8-1744903190429.png

pawit_roy_9-1744903209024.png

This resolved output makes it simple for downstream snaps (like HTTP Client) to directly execute the API call.

Action tools with HTTP Client Snap

pawit_roy_10-1744903267938.png

 

Once the Tool Calling Snap generates the resolved tool data, this output can be piped directly into an HTTP Client Snap for execution:

pawit_roy_11-1744903334575.png

This setup effectively turns a static OpenAPI definition into a fully dynamic and executable workflow, allowing LLMs to autonomously interact with real services.

Real-World Use Cases

With the right configuration, LLMs can interact with virtually any OpenAPI-compliant service. This opens up a wide range of practical applications across productivity tools, developer APIs, data services, and more.

Example Use Case: Load Products from FakeStore API and Save as CSV in GitHub Gist

This example shows how an LLM can orchestrate a two-step integration using OpenAPI specs and tool calling via SnapLogic:

  1. Fetch Data: Retrieve product data from FakeStore API.
  2. Transform & Upload: Format the data as CSV and post it as a public GitHub Gist using GitHub’s Gist API.

Main Pipeline (download)

pawit_roy_12-1744903361205.png

Loop Pipeline (download, github openapi file, fake store openapi file)

pawit_roy_13-1744903375616.png

Prompt to LLM:

“Load all products from FakeStore API and upload them as a CSV file to GitHub Gist.”

Pipeline Flow Breakdown

Step 1: FakeStore API Tool Call

  • OpenAPI Tool: FakeStore API spec (loaded via URL or file).
  • LLM Task: Recognize the available /products endpoint and trigger a GET request to retrieve the full list of products.
  • Tool Calling Snap Output: Resolved URL to https://fakestoreapi.com/products, method GET, no authentication needed.

Step 2: GitHub Gist API Tool Call

  • OpenAPI Tool: GitHub Gist API spec, with token-based authentication defined in sl_tool_metadata.
  • LLM Task: Use the POST /gists endpoint, and construct the request body with:
    • description: e.g., "FakeStore Products Export"
    • public: true
    • files: A JSON object with one file (e.g., "products.csv": { content: "<csv data>" })

Step 3: Summarize the Result

  • LLM Task: Extract and present key details from the final Gist API response, such as:
    • Total number of products exported

    • Link to the created Gist (e.g., html_url)
    • Confirmation message for the user

Final Result:

pawit_roy_14-1744903779694.png

pawit_roy_15-1744903786829.png