Welcome to the Inference.net API examples repository! This collection provides code samples and guides for common tasks using the Inference.net API.
To run these examples, you'll need:
- An Inference.net account - Create a free account here
- An API key from your account dashboard
You can set up your API key in one of two ways:
-
Environment Variable:
export INFERENCE_API_KEY=your_api_key_here
-
.env File (recommended for development): Create a
.env
file in your project root:INFERENCE_API_KEY=your_api_key_here
Most IDEs (like VS Code) will automatically load this file.
Most examples are written in Python, but the concepts can be applied to any language.
-
Webhook Example - A minimalistic API that uses inference.net to detect Magnus Carlsen in images using webhooks
-
LLM Translation - A guide to LLM translation at scale
-
Batch Processing - Process multiple asynchronous requests in a single API call
-
Function Calling - Give your models tools
-
Structured Outputs - Have your models output structured outputs
-
Vision - Process images with AI models
-
Background Inference - Use the asynchronous API for cost-effective processing
MIT License