Machine Learning/LiftWing/API/External usage
This page explains how external users can access Lift Wing API endpoints. External users are clients outside WMF production infrastructure, including Toolforge and Cloud VPS machines.
Internal users: see Internal_usage instead.
Access external endpoints
External Lift Wing endpoint URLs use the following format:
https://api.wikimedia.org/service/lw/inference/v1/models/{MODEL_NAME}:predict
Use Machine_Learning/LiftWing#Current_Inference_Services to see the list of available models and find the {MODEL_NAME}. Models in the "experimental" namespace are only available internally.
Quick start
This section shows sample curl API calls for two different models.
- See the API reference for example calls in Python and Javascript.
- See #Authentication for how to get an access token.
The following examples show one request to a model that uses page identifiers (page_title or page_id) as POST parameters, and one that uses revision (rev_id) instead.
Example of how to query the outlink-topic-model model via curl:
exportACCESSTOKEN="copy-paste-token" # Get predicted topics for the page of Douglas Adams on English Wikipedia. curlhttps://api.wikimedia.org/service/lw/inference/v1/models/outlink-topic-model:predict-XPOST-d'{"page_title": "Douglas_Adams", "lang": "en"}'-H"Authorization: Bearer $ACCESSTOKEN"-A"YOUR_APP_NAME (YOUR_EMAIL_OR_CONTACT_PAGE)"
Example of how to query the revertrisk-multilingual model via curl:
exportACCESSTOKEN="copy-paste-token" # Get the revert risk probability for the edit on English Wikipedia identified by the revision id 123456. curlhttps://api.wikimedia.org/service/lw/inference/v1/models/revertrisk-multilingual:predict-XPOST-d'{"rev_id": 123456, "lang": "en"}'-H"Authorization: Bearer $ACCESSTOKEN"-A"YOUR_APP_NAME (YOUR_EMAIL_OR_CONTACT_PAGE)"
Authentication
To use the Lift Wing API as an authenticated user, you must log in with OAuth. To do that, you must first obtain an access token for your client. Follow the instructions at mw:Wikimedia APIs/Authentication.
Rate limits for external usage
Lift Wing endpoints have the following rate limits for external clients:
- Clients hosted on Wikimedia Cloud Services
- Bots approved by a Wikimedia project
- Clients known to the Wikimedia Foundation, including Wikimedia Enterprise