See Stacksync in action with a solution architect. Book a demo ↗
AI inference

Connect an AI application

Call AI models from your backend with an EOS inference key and a current model ID.

Use an EOS inference key to make model requests from your application's backend. Each request specifies a model from the current catalog, so you can change models without replacing the application's key, provided the workspace policy permits the new model.

Configure the client

SettingValue
API base URLhttps://enterprise-os.stacksync.ai/api/inference/v1
Chat completion path/chat/completions
AuthenticationAuthorization: Bearer followed by the inference key
ModelAn exact ID from the current available model catalog

Keep the key in a server-side variable such as STACKSYNC_AI_KEY, and the selected model in STACKSYNC_AI_MODEL. Inference requests use the inference key, not your EOS CLI management token. The key supplies its workspace context; inference calls do not require a workspace header.

Use a chat-completions-compatible SDK

For a Python client using the OpenAI-compatible interface:

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["STACKSYNC_AI_KEY"],
    base_url="https://enterprise-os.stacksync.ai/api/inference/v1",
)

result = client.chat.completions.create(
    model=os.environ["STACKSYNC_AI_MODEL"],
    messages=[{"role": "user", "content": "Draft a friendly partner welcome message."}],
    max_tokens=256,
)
print(result.choices[0].message.content)

Install the SDK used by your application, and select a model that supports the request's features. Supported request features include text chat, function tools, JSON output options, reasoning, and streaming, subject to the selected model. This endpoint does not provide embeddings, audio, image generation, or provider routing overrides.

Call the API directly

With the key and model supplied securely in your environment:

jq -n --arg model "$STACKSYNC_AI_MODEL"   '{model:$model,messages:[{role:"user",content:"Draft a partner welcome message."}],max_tokens:256}' |
  curl --fail-with-body     https://enterprise-os.stacksync.ai/api/inference/v1/chat/completions     -H "Authorization: Bearer $STACKSYNC_AI_KEY"     -H 'Content-Type: application/json' --data-binary @-

Set stream: true for a server-sent events response. Specify max_tokens or max_completion_tokens to control the requested output limit rather than relying on the endpoint default.

Try a request from the CLI

eos inference models
eos inference chat "$STACKSYNC_AI_MODEL" --prompt 'Draft a partner welcome message.' --max-tokens 256
eos inference chat "$STACKSYNC_AI_MODEL" --prompt 'Draft a partner welcome message.' --max-tokens 256 --stream

eos inference chat reads STACKSYNC_AI_KEY from your environment. Management commands such as creating or sharing keys still use your EOS sign-in.

Handle failures

ResponseWhat to check
401The key may be invalid or revoked, or its owner may no longer have access.
402Available allowance is insufficient for the request's reservation. Inspect spending and pending reservations.
429Model capacity is busy; retry with backoff.
502 / 503A model or inference service may be unavailable. Avoid blindly repeating a paid request after an ambiguous failure.

If a model is unavailable, refresh the catalog and check the workspace's allowed-model policy. Use request logs to inspect status, cost, tokens, and duration.

On this page