Get an API key
- Visit inference.net and create an account.
-
On the dashboard, visit the
API Keystab on the left sidebar. Create an API key or use the default key. - Copy the API key to your clipboard by clicking the copy icon to the right of the key.
-
In your terminal, set the
INFERENCE_API_KEYenvironment variable to the API key you copied.
Test Request
Perform a simple curl request to the Inference.net API.OpenAI SDK
Inference.net is compatible with the OpenAI Chat API. You can use the official OpenAI SDK to interact with the Inference.net API. We support both streaming and non-streaming requests, as well as the following parameters:max_tokenstemperaturetop_pfrequency_penaltypresence_penalty
INFERENCE_API_KEY environment variable before running the code below.