π 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 -X POST "https://open-source-license-api.onrender.com/v1/search" \
-H "Content-Type: application/json" \
-d '{ "query": "Chart library for closed source" }'
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())
{
"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 -X POST "https://open-source-license-api.onrender.com/v1/alternatives" \
-H "Content-Type: application/json" \
-d '{ "package_name": "highcharts", "desired_license": "MIT" }'
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())
{
"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 -X GET "https://open-source-license-api.onrender.com/v1/licenses/MIT"
import requests
resp = requests.get("https://open-source-license-api.onrender.com/v1/licenses/MIT")
print(resp.json())
{
"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 -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" }'
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())
{
"package_name": "mongodb",
"risk_score": "Medium",
"issues": ["Server-side GPL dependencies"]
}
POST /v1/audit β Audit Dependencies
curl -X POST "https://open-source-license-api.onrender.com/v1/audit" \
-H "Content-Type: application/json" \
-d '{ "dependencies": ["react", "lodash", "ffmpeg"] }'
import requests
data = {"dependencies": ["react", "lodash", "ffmpeg"]}
resp = requests.post("https://open-source-license-api.onrender.com/v1/audit", json=data)
print(resp.json())
{
"audit": {
"react": "Low Risk",
"lodash": "Low Risk",
"ffmpeg": "High Risk"
}
}
POST /v1/compatibility-check β Compatibility Check
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" }'
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())
{
"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 -X POST "https://open-source-license-api.onrender.com/v1/resolve-conflicts" \
-H "Content-Type: application/json" \
-d '{ "package_a": "ffmpeg", "package_b": "highcharts" }'
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())
{
"resolution_suggestions": ["Replace ffmpeg with alternative LGPL library", "Use Chart.js instead of Highcharts"]
}
β¨ Automation & DevTools
POST /v1/generate-header β License Header Generator
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" }'
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())
{
"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
- 200 OK: Request successful
- 400 Bad Request: Missing parameters or invalid JSON
- 404 Not Found: Package not found in registry
- 500 Internal Server Error: AI or registry issue
π‘ Innovation & Utility
OSLI uses Stateful Data (the SPDX database) to ensure legal correctness, and Generative AI to provide human-readable strategy.