alawadi.cloudDocs

Connect your app to AI

Give a container you deployed one-click access to the AI model, with the endpoint and key injected as environment variables.

Any container app you run on alawadi.cloud can call the AI model without minting or pasting a key. One click in the portal injects the endpoint and a scoped key into your app as environment variables — your code just reads them.

What gets injected

Connecting AI sets three environment variables on your container: ALAWADI_AI_BASE_URL (the OpenAI-compatible endpoint), ALAWADI_AI_MODEL (the default model id), and ALAWADI_AI_API_KEY (a key scoped to this container, delivered as a secret — never printed).

Connect

Open your container in the portal and find the Connect AI card on its overview.

Click Connect AI. We mint a container-scoped key, store it as a secret, and inject the three ALAWADI_AI_* variables. Your app restarts to pick them up.

Read the variables in your code. Disconnect any time — that revokes the key and removes the variables.

Call the model from your app

Point any OpenAI SDK at the injected base URL and key. Example in Python:

import os
from openai import OpenAI

client = OpenAI(
    base_url=os.environ["ALAWADI_AI_BASE_URL"],
    api_key=os.environ["ALAWADI_AI_API_KEY"],
)

resp = client.chat.completions.create(
    model=os.environ["ALAWADI_AI_MODEL"],
    messages=[{"role": "user", "content": "مرحبا! عرّف عن نفسك بجملة واحدة."}],
)
print(resp.choices[0].message.content)

It is the same OpenAI-compatible API as a personal key — the same models, streaming, tool calling, limits, and per-token billing. Usage counts toward your balance and any spend cap you set.

AI Agents manage their own key

If the container is an AI Agent, it already has its own inference key — manage it through the agent, not this card.

Spend caps

To avoid surprises, set a monthly cap on the AI page in the portal. Once your month-to-date AI spend reaches the cap, inference is refused with a clear 402 until you raise it or the month rolls over — your other services are never affected. Leave the cap empty for no limit. The AI page also shows month-to-date spend and a per-day cost breakdown.

Try it first in the Playground

Not sure what to build? The AI page has a Playground — a chat panel that talks to the model right in the browser (pick a model, set a system prompt, stream the reply). It bills the same per-token rate, so it doubles as a quick way to size a prompt before you wire it into your app.

Next

On this page