> ## 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.

> ## Agent Instructions
> Phaseo Gateway base URL: https://api.phaseo.app/v1. Send `Authorization: Bearer $PHASEO_API_KEY` with every request.
> Model IDs look like `provider/model`, for example `openai/gpt-6-astra`. Do not guess IDs: list them with `GET /v1/models` or check https://phaseo.app/models. `phaseo/free` routes to an available free model and needs no wallet balance.
> For new text integrations prefer `POST /v1/responses`. `POST /v1/chat/completions` (OpenAI format) and `POST /v1/messages` (Anthropic format) suit existing code.
> The full API contract is https://phaseo.app/docs/openapi/v1/openapi.yaml. Official SDKs: `@phaseo/sdk` (TypeScript) and `phaseo` (Python), plus Go, C#, PHP, Ruby and Rust.
> Search these docs over MCP at https://phaseo.app/docs/mcp, and install Phaseo skills with `npx skills add https://phaseo.app/docs`. If a page is wrong or out of date, report it with the MCP `submit_feedback` tool.
> Manage Phaseo accounts with the `phaseo` CLI (`npm install -g @phaseo/cli`, then `phaseo login` or `phaseo login --device-code`), the `/v1` Management API or the MCP server at `https://mcp.phaseo.app/mcp?access=manage`. Do not send users to the dashboard for account tasks. A person is still needed for sign-up, approving a sign-in, paying the first top-up on the checkout link that `phaseo credits add` returns when no card is saved, confirming each saved-card top-up from the emailed link, and account security (password, MFA, passkeys). Create API keys with `phaseo keys create --name <name> --json`; never guess one. Credit top-ups need `phaseo login --scopes billing:write` first. Task map: https://phaseo.app/docs/v1/developers/manage-from-an-agent.md.

# Embeddings

> حوّل النص والمدخلات الأخرى إلى متجهات باستخدام POST /v1/embeddings من أي حزمة Phaseo SDK.

أرسل نصًا إلى `POST /v1/embeddings` لتحصل على متجه واحد لكل مُدخل. تستخدم الأمثلة `client` مُنشأً كما في [التثبيت](https://phaseo.app/docs/ar/v1/sdk-reference/client/installation.md).

```typescript TypeScript theme={null}
const embedding = await client.generateEmbedding({
  model: "openai/text-embedding-3-large",
  input: "Sample text",
});
```

```python Python theme={null}
embedding = client.generate_embedding({
    "model": "openai/text-embedding-3-large",
    "input": "Sample text",
})
```

```go Go theme={null}
resp, err := client.GenerateEmbedding(context.Background(), map[string]interface{}{
  "model": "openai/text-embedding-3-large",
  "input": "Sample text",
})
if err != nil {
  panic(err)
}
fmt.Println(resp["data"])
```

```csharp C# theme={null}
var response = await client.CreateEmbedding(new Dictionary<string, object>
{
    ["model"] = "openai/text-embedding-3-large",
    ["input"] = "Sample text",
});
```

```php PHP theme={null}
$response = $client->generateEmbedding([
    'model' => 'openai/text-embedding-3-large',
    'input' => 'Sample text',
]);
```

```ruby Ruby theme={null}
response = client.generate_embedding(
  model: 'openai/text-embedding-3-large',
  input: 'Sample text'
)
```

```java Java theme={null}
String body = """
{
  "model": "openai/text-embedding-3-large",
  "input": "Sample text"
}
""";

Object response = client.createEmbedding(new com.fasterxml.jackson.databind.ObjectMapper().readTree(body));
System.out.println(String.valueOf(response));
```

```rust Rust theme={null}
// لا توجد دالة للتضمينات بعد: ترسل post() بيانات JSON إلى أي مسار في Phaseo.
let response = client.post("/embeddings", &json!({
    "model": "openai/text-embedding-3-large",
    "input": "Sample text"
}))?;
```

| اللغة | الدالة | القيمة المُعادة |
| - | - | - |
| TypeScript | `client.generateEmbedding(request)` | الاستجابة ذات الأنواع المحددة |
| Python | `client.generate_embedding(request)` أو `client.embeddings.create(request)` | قاموس (dict) |
| Go | `client.GenerateEmbedding(ctx, req)`، والاسم البديل `CreateEmbedding` | `map[string]interface{}` |
| C# | `client.CreateEmbedding(request)` | `Dictionary<string, object>?` |
| PHP | `$client->generateEmbedding($request)`، والاسم البديل `createEmbedding()` | مصفوفة |
| Ruby | `client.generate_embedding(...)`، والاسم البديل `create_embedding` | Hash |
| Java | `client.createEmbedding(jsonNode)` | `Object` |
| Rust | `client.post("/embeddings", &request)` | `PhaseoResponse`، وبيانات JSON في `body` |

## المعاملات

أسماء الحقول في كل حزمة SDK هي حقول جسم JSON.

| الحقل | ملاحظات |
| - | - |
| `model` | مطلوب. معرّف نموذج تضمين. |
| `input` | مطلوب. سلسلة نصية، أو مصفوفة من السلاسل، أو أجزاء محتوى متعددة الوسائط (نص، صورة، صوت، فيديو) للنماذج التي تقبلها. |
| `encoding_format` | `float` (الافتراضي) أو `base64` أو `base64_int8` أو `base64_binary`. |
| `dimensions` | عدد صحيح موجب يقصّر كل متجه، في النماذج التي تدعم ذلك. |
| `provider_options` | إعدادات المزوّد، مثل `task_type` و`title` لدى Google أو `output_dtype` لدى Mistral. |
| `user` | وسم المستخدم النهائي. |

المخطط الكامل موجود في [مرجع Embeddings API](https://phaseo.app/docs/ar/v1/api-reference/endpoint/embeddings.md).

## الاستجابة

```json theme={null}
{
  "data": [
    {
      "embedding": [0.1, 0.2, 0.3],
      "index": 0
    }
  ],
  "usage": {
    "input_tokens": 5,
    "output_tokens": 0,
    "total_tokens": 5,
    "embedding_tokens": 5
  }
}
```


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