Quickstart

Create an API key, install the CLI, and run your first inference request.

Developer quickstart

The Inference API is an OpenAI-shaped surface on European infrastructure, tuned first for realtime inference, with flex and async windows for work that does not have to block a user. The fastest path is the sference CLI; use the Python SDK or raw HTTP when you need them in your stack.

Control plane vs inference

  • Inference (https://api.sference.com/v1/...): models, batches, responses, streams.
  • Control plane (/control/v1/... in API Reference): orgs, API keys, catalog, billing.

This page focuses on inference. Keys are minted in the sference console.

Create and export an API key

  1. Sign in to sference and create an API key for your workspace.
  2. Store it somewhere safe (password manager, Doppler, Vault, …). Never commit keys to git.
  3. Export it for local development:
export SFERENCE_API_KEY="sk_..."

On Windows (PowerShell):

setx SFERENCE_API_KEY "sk_..."

The CLI and Python SDK read SFERENCE_API_KEY from the environment.

Install the CLI

curl -fsSL https://raw.githubusercontent.com/s-ference/sference/main/install.sh | sh

Other options: uv tool install sference-cli, pip install sference-cli, or pipx install sference-cli. See CLI for details.

Run your first request

Start with a realtime request, a synchronous call that returns when inference finishes. It is OpenAI-shaped, so if you already call /v1/chat/completions somewhere, only the base URL and the model id change:

curl https://api.sference.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $SFERENCE_API_KEY" \
  -d '{
    "model": "Qwen/Qwen3.6-35B-A3B",
    "messages": [
      { "role": "user", "content": "Write a one-sentence greeting for an inference platform." }
    ]
  }'

Add "stream": true to receive tokens as they are produced rather than waiting for the full completion.

The same thing from the CLI

Store the key for the CLI (if you have not already):

sference auth login --api-key "$SFERENCE_API_KEY"
sference responses create \
  --model "Qwen/Qwen3.6-35B-A3B" \
  --content "Write a one-sentence greeting for an inference platform." \
  --wait

--wait returns the finished result instead of a response id. Add --json for machine-readable output. For batches, streams, and JSONL jobs, see CLI and the OSS README.

Realtime, flex, or async?

The example above runs on the realtime tier, a synchronous request that returns when inference finishes. Three modes share the same endpoint and models:

ModeHowWhen
RealtimeSync /v1/chat/completions, /v1/messages, or blocking /v1/responsesA user is waiting; most traffic runs here
Flex/v1/chat/completions or /v1/responses with service_tier: "flex" (not /v1/messages)Latency-tolerant interactive work at a discount; may queue longer, retries on 408
Asyncbackground: true on /v1/responses, streams, batchesBackground and bulk work on the 24h completion window

Python SDK

For application code or coding agents:

pip install sference-sdk

For interactive code, call the blocking response/chat methods; for unattended jobs, use create_response(..., background=True) with wait_for_response; see Python SDK.

Background work with raw HTTP

When nobody is waiting on the result, whether bulk jobs, long generations, or anything off the interactive path, send it to /v1/responses with background: true and collect it later:

curl https://api.sference.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $SFERENCE_API_KEY" \
  -d '{
    "model": "Qwen/Qwen3.6-35B-A3B",
    "input": [
      { "role": "user", "content": "Write a one-sentence greeting for an inference platform." }
    ],
    "background": true
  }'

You get a response object with an id and status (in_progress, completed, failed, …). Poll GET /v1/responses/{response_id} or use events; see Responses & streams.

Go deeper