> ## Documentation Index
> Fetch the complete documentation index at: https://aimp.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Python SDK

> استخدم Python لتشغيل النماذج ونشر مشاريع النماذج.

# Python SDK

استخدم HTTP مباشرة للتكاملات الخلفية البسيطة. استخدم حزم AIMP Python عندما
تؤلف أو تنشر مشاريع نماذج.

## تشغيل المستهلك عبر Python

```python theme={null}
import os
import requests

gateway_url = os.environ["AIMP_GATEWAY_URL"].rstrip("/")

payload = {
    "model": "demo-model",
    "mode": "execute",
    "scope": "playground",
    "input": {"text": "Hello from Python"},
    "params": {},
}

response = requests.post(
    f"{gateway_url}/api/runs",
    headers={"X-API-Key": os.environ["AIMP_API_KEY"]},
    json=payload,
    timeout=60,
)
response.raise_for_status()
print(response.json())
```

## حزم تأليف النماذج

مزودو النماذج يثبتون SDK داخل مشاريع النماذج:

```bash theme={null}
python -m pip install ai-marketplace-sdk
```

نقطة تشغيل runtime داخل حاويات النماذج هي:

```bash theme={null}
python -m aimp_sdk.model_runner --module /app/main.py
```

## متى تستخدم CLI

استخدم CLI للـ scaffolding والتحقق من العقد وتسجيل الدخول وعمليات النشر:

```bash theme={null}
ai init demo-model --yes
ai contract validate --json
ai publish --configure --json
ai push
```

تابع [نشر CLI](./cli-publish) إذا كنت تنشر نموذجاً.
