# Perplexity Sonar Pro

**API:** Data API

**Endpoint:** `POST /v1/beta/perplexity/sonar-pro`

**Tags:** Perplexity API

יצירת תשובה לשאלה מרובת חלקים באמצעות חיפוש באינטרנט וציטוטים. model ו-messages חובה; השתמשו במודל sonar-pro לנקודת קצה זו. חוזה ציבורי זה מכסה תגובות JSON ללא סטרימינג עם stream false. קראו את choices[].message.content, citations ו-search_results עבור התשובה ומקורותיה. usage מדווח על צריכת משאבים, לא על חיוב בקרדיטים של Felo.

### מראה תמחור

- מדידה: עלות תגובה מדווחת.
- אומדן בקשת ייחוס: 0.11273 דולר ארה״ב.
- מכפיל לקוח לייחוס: 1.0. אין להחיל אותו בשנית על סכום לקוח שכבר נקבע.

זהו מטא-נתון לעיון בלבד, לא הצעת מחיר לחשבון, לא מחיר מובטח ולא תקרת הוצאה. קרדיטי משאבים אינם קרדיטים של Felo. החיוב הסופי נעשה לפי רשומות החיוב של Felo.

## Base URL

- `https://openapi.felo.ai`

## Authentication

- `FeloBearerAuth` (http bearer, bearer format Felo API Key)
- `FeloApiKey` (apiKey in header `X-API-Key`)

## Request body

Required: **yes**

### application/json

Schema:

```json
{
  "type": "object",
  "required": [
    "model",
    "messages"
  ],
  "properties": {
    "model": {
      "type": "string",
      "description": "מודל Sonar לשימוש.",
      "enum": [
        "sonar",
        "sonar-pro",
        "sonar-reasoning-pro",
        "sonar-deep-research"
      ]
    },
    "messages": {
      "type": "array",
      "description": "רשימת הודעות שמרכיבות את השיחה עד כה.",
      "items": {
        "type": "object",
        "required": [
          "role",
          "content"
        ],
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "user",
              "assistant"
            ],
            "description": "התפקיד של כותב ההודעה."
          },
          "content": {
            "type": "string",
            "description": "תוכן ההודעה."
          }
        }
      }
    },
    "max_tokens": {
      "type": "integer",
      "description": "המספר המרבי של טוקנים ליצירה בתגובה."
    },
    "temperature": {
      "type": "number",
      "description": "טמפרטורת דגימה בין 0 ל-2. ערכים נמוכים יותר הופכים את הפלט לממוקד וחד-משמעי יותר.",
      "default": 0.2,
      "minimum": 0,
      "maximum": 2
    },
    "top_p": {
      "type": "number",
      "description": "פרמטר דגימת גרעין. המודל מתייחס לטוקנים בעלי מסת ההסתברות top_p.",
      "default": 0.9,
      "minimum": 0,
      "maximum": 1
    },
    "top_k": {
      "type": "integer",
      "description": "מספר הטוקנים לשמירה עבור סינון top-k.",
      "default": 0,
      "minimum": 0,
      "maximum": 2048
    },
    "stream": {
      "type": "boolean",
      "description": "האם להזרים את התגובה באמצעות אירועים שנשלחים מהשרת.",
      "default": false
    },
    "search_context": {
      "type": "string",
      "description": "שולט בכמה הקשר חיפוש להשתמש. משפיע על העלות לכל בקשה.",
      "enum": [
        "low",
        "medium",
        "high"
      ],
      "default": "low"
    },
    "frequency_penalty": {
      "type": "number",
      "description": "מעניש טוקנים חדשים לפי התדירות הקיימת שלהם בטקסט עד כה. ערכים חיוביים מפחיתים את הסיכוי לחזור על אותה שורה מילה במילה.",
      "default": 1,
      "minimum": 0,
      "maximum": 2
    },
    "presence_penalty": {
      "type": "number",
      "description": "מעניש טוקנים חדשים לפי האם הם מופיעים בטקסט עד כה. ערכים חיוביים מגבירים את הסיכוי לדבר על נושאים חדשים.",
      "default": 0,
      "minimum": -2,
      "maximum": 2
    },
    "return_citations": {
      "type": "boolean",
      "description": "האם להחזיר ציטוטים ותוצאות חיפוש בתגובה.",
      "default": true
    },
    "search_recency_filter": {
      "type": "string",
      "description": "סינון תוצאות החיפוש לפי עדכניות.",
      "enum": [
        "month",
        "week",
        "day",
        "hour"
      ]
    },
    "search_domain_filter": {
      "type": "array",
      "description": "הגבלת החיפוש לדומיינים ספציפיים.",
      "items": {
        "type": "string"
      }
    }
  }
}
```

Example:

```json
{
  "model": "sonar-pro",
  "messages": [
    {
      "role": "user",
      "content": "Compare Cache-Control no-cache and no-store, citing HTTP documentation."
    }
  ],
  "max_tokens": 1024,
  "stream": false
}
```

## Responses

### 200 — תגובה מוצלחת עם תשובת AI וציטוטים

Headers:
- `X-Request-Id` (string) — מזהה בקשה לכלול בעת פנייה לתמיכת Felo.

**application/json**

Schema: `ResponseD5E2470Dd28B_ChatCompletionResponse` (`#/components/schemas/ResponseD5E2470Dd28B_ChatCompletionResponse`)

Example:

```json
{
  "id": "example-sonar-pro-completion",
  "model": "sonar-pro",
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "no-cache requires validation before reuse; no-store prohibits storage. [1]"
      },
      "finish_reason": "stop"
    }
  ],
  "citations": [
    "https://www.rfc-editor.org/rfc/rfc9111.html"
  ],
  "search_results": [
    {
      "title": "HTTP Caching",
      "url": "https://www.rfc-editor.org/rfc/rfc9111.html"
    }
  ],
  "usage": {
    "prompt_tokens": 25,
    "completion_tokens": 40,
    "total_tokens": 65
  }
}
```

### 400 — לא ניתן היה לעבד את הבקשה. בדקו את פרמטרי הבקשה.

### 401 — נדרש מפתח API תקף של Felo.

### 402 — לא ניתן להמשיך את הבקשה משום שדרישת חיוב אינה מתקיימת.

### 403 — החשבון אינו מורשה לבצע את הפעולה הזו.

### 429 — הגעתם למגבלת בקשות או לתקרת הוצאה.

### 502 — השירות לא הצליח להשלים את הבקשה.

### 503 — שירות ה-API או החיוב אינו זמין באופן זמני.

### 504 — השירות פג בזמן הטיפול בבקשה.

### default — תגובת שגיאה; תגובות מעבר מהמעלה הזרם עשויות להשתמש בפורמטים של הספק

**application/json**

Schema:

```json
{}
```

## Schema definitions

### ResponseD5E2470Dd28B_ChatCompletionResponse

`#/components/schemas/ResponseD5E2470Dd28B_ChatCompletionResponse`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "מזהה ייחודי של ההשלמה."
    },
    "model": {
      "type": "string",
      "description": "המודל ששימש להשלמה."
    },
    "object": {
      "type": "string",
      "example": "chat.completion"
    },
    "created": {
      "type": "integer",
      "description": "חותמת זמן Unix של מועד יצירת ההשלמה."
    },
    "choices": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer"
          },
          "message": {
            "type": "object",
            "properties": {
              "role": {
                "type": "string"
              },
              "content": {
                "type": "string",
                "description": "התשובה שנוצרה על ידי AI, עם הפניות ציטוט בתוך הטקסט כגון [1][2]."
              }
            }
          },
          "finish_reason": {
            "type": "string",
            "enum": [
              "stop",
              "length"
            ]
          }
        }
      }
    },
    "citations": {
      "type": "array",
      "description": "רשימת כתובות URL של מקורות שאליהם מפנה התשובה.",
      "items": {
        "type": "string"
      }
    },
    "search_results": {
      "type": "array",
      "description": "תוצאות חיפוש מפורטות עם כותרות, קטעי טקסט וכתובות URL.",
      "items": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "snippet": {
            "type": "string"
          },
          "date": {
            "type": "string"
          },
          "source": {
            "type": "string"
          }
        }
      }
    },
    "usage": {
      "type": "object",
      "properties": {
        "prompt_tokens": {
          "type": "integer"
        },
        "completion_tokens": {
          "type": "integer"
        },
        "total_tokens": {
          "type": "integer"
        },
        "search_context_size": {
          "type": "string"
        }
      }
    }
  }
}
```
