πŸ“œ OSLI API πŸ“œ

Open Source License Intelligence API

Introduction

OSLI is an intelligent compliance engine designed to bridge the gap between complex open-source legal jargon and real-world developer workflows. By combining deterministic SPDX data (State) with Gemini AI reasoning (Intelligence), OSLI provides a developer experience that is predictable, correct, and delightful.

The OSLI API is deployed and ready for use.

You can explore the interactive documentation and test endpoints directly from your browser.

Base API URL:
https://open-source-license-api.onrender.com

The following are key API endpoints you can interact with for various tasks.

πŸ” Discovery & Research

POST /v1/search β€” Smart Library Search

Discover libraries that meet your licensing requirements. Enter a natural language query and OSLI will return libraries compatible with your project’s policies.

cURL Example
curl -X POST "https://open-source-license-api.onrender.com/v1/search" \
-H "Content-Type: application/json" \
-d '{ "query": "Chart library for closed source" }'
Python Example
import requests
data = {"query": "Chart library for closed source"}
resp = requests.post("https://open-source-license-api.onrender.com/v1/search", json=data)
print(resp.json())
Expected JSON Response
{
  "libraries": [
    {"name": "Highcharts", "license": "Commercial", "risk_score": "High"},
    {"name": "Chart.js", "license": "MIT", "risk_score": "Low"}
  ]
}

POST /v1/alternatives β€” Safe-Alternative Finder

Find permissive alternatives to restrictive libraries (e.g., MIT instead of GPL), reducing legal risk while maintaining functionality.

cURL Example
curl -X POST "https://open-source-license-api.onrender.com/v1/alternatives" \
-H "Content-Type: application/json" \
-d '{ "package_name": "highcharts", "desired_license": "MIT" }'
Python Example
import requests
data = {"package_name": "highcharts", "desired_license": "MIT"}
resp = requests.post("https://open-source-license-api.onrender.com/v1/alternatives", json=data)
print(resp.json())
Expected JSON Response
{
  "alternatives": [
    {"name": "Chart.js", "license": "MIT"},
    {"name": "ECharts", "license": "Apache-2.0"}
  ]
}

GET /v1/licenses/{id} β€” Deep-Dive License Info

Retrieve detailed metadata for a specific SPDX license, including permissions, conditions, and obligations.

cURL Example
curl -X GET "https://open-source-license-api.onrender.com/v1/licenses/MIT"
Python Example
import requests
resp = requests.get("https://open-source-license-api.onrender.com/v1/licenses/MIT")
print(resp.json())
Expected JSON Response
{
  "id": "MIT",
  "name": "MIT License",
  "permissions": ["commercial-use", "modification", "distribution"],
  "conditions": ["include-license"],
  "limitations": ["liability", "warranty"]
}

πŸ›‘ Risk & Compliance

POST /v1/analyze β€” Analyze Package Risk

cURL Example
curl -X POST "https://open-source-license-api.onrender.com/v1/analyze" \
-H "Content-Type: application/json" \
-d '{ "package_name": "mongodb", "context": "Commercial closed-source SaaS" }'
Python Example
import requests
data = {"package_name": "mongodb", "context": "Commercial closed-source SaaS"}
resp = requests.post("https://open-source-license-api.onrender.com/v1/analyze", json=data)
print(resp.json())
Expected JSON Response
{
  "package_name": "mongodb",
  "risk_score": "Medium",
  "issues": ["Server-side GPL dependencies"]
}

POST /v1/audit β€” Audit Dependencies

cURL Example
curl -X POST "https://open-source-license-api.onrender.com/v1/audit" \
-H "Content-Type: application/json" \
-d '{ "dependencies": ["react", "lodash", "ffmpeg"] }'
Python Example
import requests
data = {"dependencies": ["react", "lodash", "ffmpeg"]}
resp = requests.post("https://open-source-license-api.onrender.com/v1/audit", json=data)
print(resp.json())
Expected JSON Response
{
  "audit": {
    "react": "Low Risk",
    "lodash": "Low Risk",
    "ffmpeg": "High Risk"
  }
}

POST /v1/compatibility-check β€” Compatibility Check

cURL Example
curl -X POST "https://open-source-license-api.onrender.com/v1/compatibility-check" \
-H "Content-Type: application/json" \
-d '{ "license_a": "MIT", "license_b": "GPL-3.0" }'
Python Example
import requests
data = {"license_a": "MIT", "license_b": "GPL-3.0"}
resp = requests.post("https://open-source-license-api.onrender.com/v1/compatibility-check", json=data)
print(resp.json())
Expected JSON Response
{
  "license_a": "MIT",
  "license_b": "GPL-3.0",
  "compatible": false,
  "conflict": "GPL-3.0 is viral, incompatible with MIT in commercial SaaS"
}

POST /v1/resolve-conflicts β€” Legal Patch Suggester

cURL Example
curl -X POST "https://open-source-license-api.onrender.com/v1/resolve-conflicts" \
-H "Content-Type: application/json" \
-d '{ "package_a": "ffmpeg", "package_b": "highcharts" }'
Python Example
import requests
data = {"package_a": "ffmpeg", "package_b": "highcharts"}
resp = requests.post("https://open-source-license-api.onrender.com/v1/resolve-conflicts", json=data)
print(resp.json())
Expected JSON Response
{
  "resolution_suggestions": ["Replace ffmpeg with alternative LGPL library", "Use Chart.js instead of Highcharts"]
}

⌨ Automation & DevTools

POST /v1/generate-header β€” License Header Generator

cURL Example
curl -X POST "https://open-source-license-api.onrender.com/v1/generate-header" \
-H "Content-Type: application/json" \
-d '{ "project_name": "Nebula", "license_id": "MIT", "language": "Python" }'
Python Example
import requests
data = {"project_name": "Nebula", "license_id": "MIT", "language": "Python"}
resp = requests.post("https://open-source-license-api.onrender.com/v1/generate-header", json=data)
print(resp.json())
Expected JSON Response
{
  "file_name": "Nebula_license_header.py",
  "header_content": "# MIT License\\n# Project: Nebula\\n# Generated by OSLI API"
}

🐍 Python Quickstart

To get started with the OSLI API in Python, ensure you have the requests library installed:

pip install requests

Copy and paste this script to test the connection to the OSLI engine:

import requests
import json

BASE_URL = "https://open-source-license-api.onrender.com"

def osli_quickstart_demo():
    print("πŸš€ Connecting to OSLI Compliance Engine...\n")

    search_payload = {"query": "Modern UI component library for a commercial SaaS"}
    search_res = requests.post(f"{BASE_URL}/v1/search", json=search_payload)
    if search_res.status_code == 200:
        print("πŸ” AI-Suggested Libraries:")
        print(json.dumps(search_res.json(), indent=2))
    
    audit_payload = {"dependencies": ["react", "lodash", "ffmpeg", "mongodb"]}
    audit_res = requests.post(f"{BASE_URL}/v1/audit", json=audit_payload)
    if audit_res.status_code == 200:
        print("πŸ›‘οΈ Dependency Audit (Traffic Light System):")
        print(json.dumps(audit_res.json(), indent=2))

if __name__ == "__main__":
    try:
        osli_quickstart_demo()
    except Exception as e:
        print(f"❌ Connection Error: {e}")

⚠️ Error Handling & Correctness

πŸ’‘ Innovation & Utility

OSLI uses Stateful Data (the SPDX database) to ensure legal correctness, and Generative AI to provide human-readable strategy.