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

# البدء السريع

> ابدأ مع TokenLab API في دقيقتين

## الخطوة 1: ابدأ بأرصدة التجربة

<Steps>
  <Step title="إنشاء حساب">
    سجّل في [tokenlab.sh](https://tokenlab.sh) باستخدام بريدك الإلكتروني أو Gmail أو حساب GitHub.
  </Step>

  <Step title="استخدم أرصدة التجربة المضمنة">
    يتضمن حسابك أرصدة تجربة للطلبات التجريبية الصغيرة الأولى. لا تحتاج إلى الشحن قبل Quickstart.
  </Step>

  <Step title="أنشئ أو انسخ مفتاح API">
    انتقل إلى **Dashboard → API Keys** وأنشئ مفتاحًا جديدًا أو انسخ مفتاحًا موجودًا. احتفظ به بأمان لأن المفتاح الكامل يظهر مرة واحدة فقط.
  </Step>
</Steps>

<Warning>
  احفظ مفتاح الـ API الخاص بك بأمان. لا تكشف عنه في شيفرة جانب العميل أو في مستودعات عامة.
</Warning>

## الخطوة 2: تثبيت عميل

<CodeGroup>
  ```bash Python theme={null}
  pip install openai
  ```

  ```bash JavaScript theme={null}
  npm install openai
  ```

  ```bash Go theme={null}
  go get github.com/openai/openai-go/v3
  ```

  ```bash PHP theme={null}
  composer require openai-php/client
  ```
</CodeGroup>

## الخطوة 3: أجرِ طلبك الأول

بالنسبة لمعظم عمليات التكامل الجديدة، ابدأ بـ **إكمالات الدردشة** على `POST /v1/chat/completions`.

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.tokenlab.sh/v1/chat/completions \
    -H "Authorization: Bearer sk-your-api-key" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-5.4",
      "messages": [
        {"role": "user", "content": "What is the capital of France?"}
      ]
    }'
  ```

  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="sk-your-api-key",
      base_url="https://api.tokenlab.sh/v1"
  )

  response = client.chat.completions.create(
      model="gpt-5.4",
      messages=[{"role": "user", "content": "What is the capital of France?"}]
  )

  print(response.choices[0].message.content)
  ```

  ```javascript JavaScript theme={null}
  import OpenAI from 'openai';

  const client = new OpenAI({
    apiKey: 'sk-your-api-key',
    baseURL: 'https://api.tokenlab.sh/v1'
  });

  const response = await client.chat.completions.create({
    model: 'gpt-5.4',
    messages: [{ role: 'user', content: 'What is the capital of France?' }],
  });

  console.log(response.choices[0].message.content);
  ```
</CodeGroup>

<Note>
  استخدم `POST /v1/responses` فقط عندما تحتاج صراحةً إلى سلوك مخصص لـ Responses. بعض الحقول الخاصة بـ Responses تعتمد على النموذج المحدد ومسار التوجيه.
</Note>

## اشحن للاستخدام الإنتاجي

أرصدة التجربة المضمنة مخصصة للاختبارات الصغيرة الأولى. أضف أرصدة من **Dashboard → Billing** فقط عندما تكون مستعدًا للاستخدام الإنتاجي أو للاختبارات الأعلى حجمًا.

## جرّب نماذج مختلفة

تدعم TokenLab مئات النماذج. غيّر حقل `model` فقط:

```python theme={null}
response = client.chat.completions.create(model="gpt-5.4", messages=[{"role": "user", "content": "Hello"}])
response = client.chat.completions.create(model="gpt-5-mini", messages=[{"role": "user", "content": "Hello"}])
response = client.chat.completions.create(model="claude-sonnet-4-6", messages=[{"role": "user", "content": "Hello"}])
response = client.chat.completions.create(model="gemini-3.5-flash", messages=[{"role": "user", "content": "Hello"}])
response = client.chat.completions.create(model="deepseek-r1", messages=[{"role": "user", "content": "Hello"}])
```

## تمكين البث

```python theme={null}
stream = client.chat.completions.create(
    model="gpt-5.4",
    messages=[{"role": "user", "content": "Tell me a short story."}],
    stream=True
)

for chunk in stream:
    delta = chunk.choices[0].delta.content
    if delta:
        print(delta, end="")
```

## ما التالي؟

<CardGroup cols={2}>
  <Card title="المصادقة" icon="key" href="/authentication">
    تعرّف على إدارة مفاتيح API والأمان.
  </Card>

  <Card title="OpenAI SDK" icon="code" href="/integrations/openai-sdk">
    استخدم المسارات المتوافقة مع OpenAI `/v1` مع حِزم OpenAI SDKs الحالية.
  </Card>

  <Card title="مرجع API" icon="book" href="/api-reference/introduction">
    استعرض مرجع نقاط النهاية الكامل.
  </Card>

  <Card title="النماذج" icon="robot" href="https://tokenlab.sh/ar/models">
    تصفح توفر النماذج الحالي والأسعار.
  </Card>
</CardGroup>
