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

# اكتشاف النماذج (AI SDK)

> كيفية جلب معرّفات النماذج الحالية لاستخدامها مع موفّر AI SDK.

لا يوفّر موفّر Vercel AI SDK دالة `listModels()` مدمجة. استخدم إحدى الطريقتين للحفاظ على حداثة معرّفات النماذج.

## الخيار 1: الجلب من Gateway API

```ts theme={null}
const response = await fetch("https://api.phaseo.app/v1/models", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.PHASEO_API_KEY}`,
  },
});

const filteredResponse = await fetch(
  "https://api.phaseo.app/v1/models?provider=anthropic&status=active,deprecated&availability=all",
  {
    headers: {
      Authorization: `Bearer ${process.env.PHASEO_API_KEY}`,
    },
  },
);

if (!response.ok || !filteredResponse.ok) {
  throw new Error("Failed to load models");
}

const models = await response.json();
const filteredModels = await filteredResponse.json();
console.log(models, filteredModels);
```

## الخيار 2: استخدام TypeScript SDK الرسمي

```ts theme={null}
import Phaseo from "@phaseo/sdk";

const client = new Phaseo({ apiKey: process.env.PHASEO_API_KEY! });
const models = await client.getModels({
  provider: ["anthropic"],
  status: ["active", "deprecated"],
  availability: "all",
});

console.log(models);
```

## استخدام المعرّفات المكتشفة مع AI SDK

```ts theme={null}
import { phaseo } from "@phaseo/ai-sdk-provider";
import { generateText } from "ai";

const result = await generateText({
  model: phaseo("openai/gpt-5-nano"),
  prompt: "Hello from a discovered model ID.",
});

console.log(result.text);
```

## ملاحظات

* تستخدم معرّفات النماذج تنسيق `provider/model`.
* تدعم `/v1/models` عوامل تصفية مثل `provider` و`status` و`organisation` و`endpoints` و`availability`.
* أعِد التحقق من توفر النماذج دوريًا لمتابعة تغييرات التوجيه والإيقاف.
* يُفضّل اختيار المعرّفات من `/v1/models` بدل تثبيتها في الشيفرة على المدى الطويل.


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