GET
/v1/schemas/perplexity/chat/v1/sonar?kind=output
Accept:
| field | recorded source |
|---|---|
| schema | Source linked above. upstream-spec Source trace1a269d5596e506d3189e57c3ae84874a21c3532afe8c95de6f21e55f17001f15{
"fetchedAt": 1791005478,
"extractorVersion": "1",
"verifiedAt": null
} |
Response body
10 properties · 4 required · 14 $defs| property | type | description | constraints |
|---|---|---|---|
| id* | string | Unique identifier for the completion | |
| model* | string | Model used for generation | |
| created* | integer | Unix timestamp when the completion was created | |
| choices* | Choice[] | Array of completion choices | |
| usage | UsageInfo | Token usage and cost information for a request | nullable |
| object | string | Object type identifier | default: "chat.completion" |
| citations | string[] | URLs of sources used to generate the response | nullable |
| search_results | ApiPublicSearchResult[] | Search results used for context in the response | nullable |
| images | ImageResult[] | Array of images returned when return_images is true | nullable |
| related_questions | string[] | Array of related questions returned when return_related_questions is true | nullable |
Types
14 $defsApiPublicSearchResultobject
A single search result from the web
| title* | string | Title of the search result page | |
| url* | string | URL of the search result page | |
| date | string | Publication date of the result | nullable |
| last_updated | string | Date the result was last updated | nullable |
| snippet | string | Text snippet from the search result | default: "" |
| source | enum | Source type of the result (web or attachment) | web | attachment · default: "web" |
ChatMessage-Outputobject
| role* | enum | Chat roles enum | system | user | assistant | tool |
| content* | string | ChatMessageContentTextChunk | ChatMessageContentImageChunk | ChatMessageContentFileChunk[] | nullable |
ChatMessageContentFileChunkobject
| type* | const | "file_url" | |
| file_url* | URL | string | ||
| file_name | string | nullable |
ChatMessageContentImageChunkobject
| type* | const | "image_url" | |
| image_url* | URL | string |
ChatMessageContentPDFChunkobject
| type* | const | "pdf_url" | |
| pdf_url* | URL | string |
ChatMessageContentTextChunkobject
| type* | const | "text" | |
| text* | string |
ChatMessageContentVideoChunkobject
| type* | const | "video_url" | |
| video_url* | VideoURL | string |
ChatMessageRoleenum
Chat roles enum
system | user | assistant | tool
Choiceobject
A single completion choice
| index* | integer | Index of the choice in the array | |
| finish_reason | enum | Reason generation stopped (stop or length) | stop | length · nullable |
| message* | ChatMessage-Output | Complete message (non-streaming) | |
| delta* | ChatMessage-Output | Incremental message delta (streaming) |
Costobject
Cost breakdown for a chat completion request
| input_tokens_cost* | number | Cost for input tokens in USD | |
| output_tokens_cost* | number | Cost for output tokens in USD | |
| reasoning_tokens_cost | number | Cost for reasoning tokens in USD | nullable |
| request_cost | number | Cost for web search requests in USD (includes pro search cost if applicable) | nullable |
| citation_tokens_cost | number | Cost for citation tokens in USD | nullable |
| search_queries_cost | number | Cost for search queries in USD | nullable |
| total_cost* | number | Total cost for the request in USD |
ImageResultobject
A single image search result
| image_url* | string | URL of the image | |
| origin_url* | string | Original URL where the image was found | |
| height* | integer | Height of the image in pixels | format: int64 |
| width* | integer | Width of the image in pixels | format: int64 |
| title | string | Title or description of the image |
URLobject
| url* | string |
UsageInfoobject
Token usage and cost information for a request
| prompt_tokens* | integer | Number of tokens in the prompt/input | |
| completion_tokens* | integer | Number of tokens in the completion/output | |
| total_tokens* | integer | Total tokens used (prompt + completion) | |
| search_context_size | string | Size of search context used | nullable |
| citation_tokens | integer | Number of tokens used for citations | nullable |
| num_search_queries | integer | Number of search queries executed | nullable |
| reasoning_tokens | integer | Number of tokens used for reasoning | nullable |
| cost* | Cost | Cost breakdown for the request |
VideoURLobject
| url* | string | ||
| frame_interval | string | integer | default: 25 |
Validate a payload
before you spend tokensshell
$ curl -X POST https://modelschemas.com/v1/validate \
-d '{"provider":"perplexity","endpointId":"v1/sonar","payload":{…}}'
→ {"valid": false, "errors": [{"path": "#", "keyword": "required", …}]}