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

# دليل إعداد OpenCode CLI

> AceDataCloud Coding Plan API guide - Ace Data Cloud

## 1. الحصول على API Key

افتح [قائمة تطبيقات Ace Data Cloud](https://platform.acedata.cloud/console/applications)، وادخل إلى تطبيق متاح وانسخ API Key.

![الحصول على Ace Data Cloud API Key](https://cdn.acedata.cloud/dvc3cg.jpg)

## 2. تثبيت OpenCode

```bash theme={null}
curl -fsSL https://opencode.ai/install | bash
```

يمكنك أيضًا استخدام npm:

```bash theme={null}
npm install -g opencode-ai
```

## 3. تعيين API Key

```bash theme={null}
export ACEDATACLOUD_API_KEY="API Key الخاص بك"
```

لجعل ذلك ساريًا بشكل دائم، أضف هذا السطر إلى `~/.zshrc` أو `~/.bashrc` ثم أعد فتح الطرفية.

## 4. إعداد Provider

حرّر `~/.config/opencode/opencode.json`:

```json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "acedatacloud": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Ace Data Cloud",
      "options": {
        "baseURL": "https://api.acedata.cloud/v1",
        "apiKey": "{env:ACEDATACLOUD_API_KEY}"
      },
      "models": {
        "MODEL_ID": { "name": "MODEL_ID" }
      }
    }
  }
}
```

انتقل إلى [دليل النماذج](https://platform.acedata.cloud/models) لعرض أسماء النماذج (مثل `claude-opus-5` و`gpt-6-sol`)، واستبدل جميع `MODEL_ID` بالاسم نفسه؛ عند التحقق الدقيق، استخدم قيمة `id` في استجابة `/v1/models` كمرجع. هذه القيمة هي اسم النموذج المستخدم في معلمة API `model`، وليست UUID الخاص بالخدمة أو API. يستخدم Ace Data Cloud هنا Chat Completions، لذلك فإن adapter هو `@ai-sdk/openai-compatible`.

## 5. التحقق والتشغيل

```bash theme={null}
opencode auth list
opencode models acedatacloud
opencode run --model acedatacloud/MODEL_ID "Reply only OK"
```

ثم شغّل `opencode` في دليل المشروع. إذا لم يظهر النموذج، فتحقق من مسار ملف الإعدادات، وصياغة JSON، ومتغيرات البيئة؛ يشير 401 إلى أن Key غير صالح أو لم يتم تصديره.

تعيد إضافة IDE استخدام إعدادات OpenCode runtime نفسها، راجع [إضافة OpenCode IDE](https://platform.acedata.cloud/documents/opencode-ide-integration).

## المراجع الرسمية

* [OpenCode Providers](https://opencode.ai/docs/providers/)
* [إعداد OpenCode](https://opencode.ai/docs/config/)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.