Inference Logoinference.sh

Authentication

How to authenticate with the API.


Get an API Key

  1. Go to Settings → API Keys
  2. Click Create API Key
  3. Copy the key (starts with inf_)

Keep it Secret

  • Don't commit to git
  • Don't share publicly
  • Use environment variables
bash
1export INFERENCE_API_KEY="inf_your_key"

Using the Key

With SDKs

1from inferencesh import inference2import os3 4# Direct5client = inference(api_key="inf_your_key")6 7# From environment variable8client = inference(api_key=os.environ["INFERENCE_API_KEY"])

With REST API

bash
1curl https://api.inference.sh/apps/run \2  -H "Authorization: Bearer inf_your_key" \3  -H "Content-Type: application/json" \4  -d '{"app": "infsh/echo", "input": {"message": "Hello!"}}'

Install SDKs

1pip install inferencesh2 3# With async support4pip install inferencesh[async]

Next

SDK Overview — Running apps, streaming, files

we use cookies

we use cookies to ensure you get the best experience on our website. for more information on how we use cookies, please see our cookie policy.

by clicking "accept", you agree to our use of cookies.
learn more.