{"uid":"cap_yWOQMYifwJprXnT0eGRIZ","slug":"sonar-async-chat-completion-a97ccabe","name":"Sonar Async Chat Completion","description":"Create Async Chat Completion","url":"https://pplx.x402.paysponge.com/v1/async/sonar","method":"POST","headers":{},"bodySchema":{"type":"object","title":"AsyncApiChatCompletionsRequest","required":["request"],"properties":{"request":{"type":"object","title":"ApiChatCompletionsRequest","required":["model","messages"],"properties":{"stop":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"Stop","description":"Stop sequences. Generation stops when one of these strings is produced"},"model":{"enum":["sonar","sonar-pro","sonar-deep-research","sonar-reasoning-pro"],"type":"string","title":"Model","description":"Model to use, for example, sonar-pro"},"top_p":{"anyOf":[{"type":"number","maximum":1,"minimum":0},{"type":"null"}],"title":"Top P","description":"Nucleus sampling parameter. Controls diversity via nucleus sampling"},"stream":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Stream","default":false,"description":"If true, returns streaming SSE response"},"messages":{"type":"array","items":{"type":"object","title":"ChatMessage","required":["role","content"],"properties":{"role":{"enum":["system","user","assistant","tool"],"type":"string","title":"ChatMessageRole","description":"Chat roles enum"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"anyOf":[{"$ref":"#/components/schemas/ChatMessageContentTextChunk"},{"$ref":"#/components/schemas/ChatMessageContentImageChunk"},{"$ref":"#/components/schemas/ChatMessageContentFileChunk"},{"$ref":"#/components/schemas/ChatMessageContentPDFChunk"},{"$ref":"#/components/schemas/ChatMessageContentVideoChunk"}]},"title":"Structured Content"},{"type":"null"}],"title":"Content"}}},"title":"Messages","description":"Array of messages forming the conversation history"},"max_tokens":{"anyOf":[{"type":"integer","maximum":128000,"exclusiveMinimum":0},{"type":"null"}],"title":"Max Tokens","description":"Maximum number of completion tokens to generate"},"search_mode":{"anyOf":[{"enum":["web","academic","sec"],"type":"string"},{"type":"null"}],"title":"Search Mode","description":"Source of search results (web, academic, or sec)"},"stream_mode":{"enum":["full","concise"],"type":"string","title":"Stream Mode","default":"full","description":"Controls the format of streaming events. 'full' suppresses reasoning events and includes metadata inline; 'concise' emits reasoning events separately"},"temperature":{"anyOf":[{"type":"number","maximum":2,"minimum":0},{"type":"null"}],"title":"Temperature","description":"Controls randomness in the response. Higher values make output more random. Range: 0-2"},"return_images":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Return Images","description":"When true, include image results in the response"},"disable_search":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Disable Search","description":"When true, disables all web search capabilities. The model responds based solely on its training data"},"response_format":{"anyOf":[{"type":"object","title":"ResponseFormatText","required":["type"],"properties":{"type":{"type":"string","const":"text","title":"Type","description":"Must be `text`."}}},{"type":"object","title":"ResponseFormatJSONSchema","required":["type","json_schema"],"properties":{"type":{"type":"string","const":"json_schema","title":"Type","description":"Must be `json_schema`."},"json_schema":{"type":"object","title":"JSONSchema","required":["schema"],"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","default":"schema"},"schema":{"type":"object","title":"Schema","additionalProperties":true},"strict":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Strict","default":true},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}}}},"description":"Constrains the model output to match the provided JSON schema."},{"type":"null"}],"title":"Response Format","description":"Optional. Controls the output format. Omit for default text output. Set `type` to `json_schema` for structured output.","discriminator":{"mapping":{"text":"#/components/schemas/ResponseFormatText","json_schema":"#/components/schemas/ResponseFormatJSONSchema"},"propertyName":"type"}},"reasoning_effort":{"anyOf":[{"enum":["minimal","low","medium","high"],"type":"string"},{"type":"null"}],"title":"Reasoning Effort","description":"Controls how much effort the model spends on reasoning"},"web_search_options":{"type":"object","title":"WebSearchOptions","properties":{"search_type":{"anyOf":[{"enum":["fast","pro","auto"],"type":"string"},{"type":"null"}],"title":"Search Type","description":"Search type (fast for speed, pro for quality, auto to let the model decide)"},"user_location":{"anyOf":[{"type":"object","title":"UserLocation","properties":{"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City","description":"City name"},"region":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Region","description":"State or region name"},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country","description":"ISO 3166-1 alpha-2 country code"},"latitude":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Latitude","description":"Latitude coordinate"},"longitude":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Longitude","description":"Longitude coordinate"}},"description":"User's geographic location for search personalization"},{"type":"null"}]},"search_context_size":{"enum":["low","medium","high"],"type":"string","title":"Search Context Size","default":"low","description":"Amount of search context to include (low, medium, or high)"},"image_results_enhanced_relevance":{"type":"boolean","title":"Image Results Enhanced Relevance","default":false,"description":"When true, applies enhanced relevance filtering to image results"}},"description":"Configuration options for web search behavior"},"image_domain_filter":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"Image Domain Filter","description":"Limit image results to specific domains"},"image_format_filter":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"Image Format Filter","description":"Filter image results by format (e.g. png, jpg)"},"language_preference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language Preference","description":"ISO 639-1 language code for preferred response language"},"search_domain_filter":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"Search Domain Filter","description":"Limit search results to specific domains (e.g. github.com, wikipedia.org)"},"search_recency_filter":{"anyOf":[{"enum":["hour","day","week","month","year"],"type":"string"},{"type":"null"}],"title":"Search Recency Filter","description":"Filter by publication recency (hour, day, week, month, or year)"},"search_language_filter":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"Search Language Filter","description":"Filter results by language using ISO 639-1 codes (e.g. en, fr, de)"},"enable_search_classifier":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enable Search Classifier","description":"When true, uses a classifier to determine if web search is needed for the query"},"return_related_questions":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Return Related Questions","description":"When true, generates suggested follow-up queries based on the search results"},"search_after_date_filter":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search After Date Filter","description":"Return results published after this date (MM/DD/YYYY)"},"last_updated_after_filter":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Updated After Filter","description":"Return results last updated after this date (MM/DD/YYYY)"},"search_before_date_filter":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search Before Date Filter","description":"Return results published before this date (MM/DD/YYYY)"},"last_updated_before_filter":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Updated Before Filter","description":"Return results last updated before this date (MM/DD/YYYY)"}}},"idempotency_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency Key","description":"Unique key to prevent duplicate requests"}},"description":"Request body for creating an asynchronous chat completion"},"responseSchema":{"type":"object","title":"AsyncApiChatCompletionsResponse","required":["id","model","created_at","status"],"properties":{"id":{"type":"string","title":"Id","description":"Unique identifier for the async request"},"model":{"type":"string","title":"Model","description":"Model used for the request"},"status":{"enum":["CREATED","IN_PROGRESS","COMPLETED","FAILED"],"type":"string","title":"AsyncProcessingStatus","description":"Status enum for async processing."},"response":{"anyOf":[{"type":"object","title":"CompletionResponse","required":["id","model","created","choices"],"properties":{"id":{"type":"string","title":"Id","description":"Unique identifier for the completion"},"model":{"type":"string","title":"Model","description":"Model used for generation"},"usage":{"anyOf":[{"type":"object","title":"UsageInfo","required":["prompt_tokens","completion_tokens","total_tokens","cost"],"properties":{"cost":{"$ref":"#/components/schemas/Cost","description":"Cost breakdown for the request"},"total_tokens":{"type":"integer","title":"Total Tokens","description":"Total tokens used (prompt + completion)"},"prompt_tokens":{"type":"integer","title":"Prompt Tokens","description":"Number of tokens in the prompt/input"},"citation_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Citation Tokens","description":"Number of tokens used for citations"},"reasoning_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Reasoning Tokens","description":"Number of tokens used for reasoning"},"completion_tokens":{"type":"integer","title":"Completion Tokens","description":"Number of tokens in the completion/output"},"num_search_queries":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Num Search Queries","description":"Number of search queries executed"},"search_context_size":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search Context Size","description":"Size of search context used"}},"description":"Token usage and cost information for a request"},{"type":"null"}]},"images":{"anyOf":[{"type":"array","items":{"type":"object","title":"ImageResult","required":["image_url","origin_url","title","width","height"],"properties":{"title":{"type":"string","title":"Title","description":"Title or description of the image"},"width":{"type":"integer","title":"Width","description":"Width of the image in pixels"},"height":{"type":"integer","title":"Height","description":"Height of the image in pixels"},"image_url":{"type":"string","title":"Image Url","description":"URL of the image"},"origin_url":{"type":"string","title":"Origin Url","description":"Original URL where the image was found"}}}},{"type":"null"}],"title":"Images","description":"Array of images returned when return_images is true"},"object":{"type":"string","title":"Object","default":"chat.completion","description":"Object type identifier"},"choices":{"type":"array","items":{"type":"object","title":"Choice","required":["index","message","delta"],"properties":{"delta":{"$ref":"#/components/schemas/ChatMessage-Output","description":"Incremental message delta (streaming)"},"index":{"type":"integer","title":"Index","description":"Index of the choice in the array"},"message":{"$ref":"#/components/schemas/ChatMessage-Output","description":"Complete message (non-streaming)"},"finish_reason":{"anyOf":[{"enum":["stop","length"],"type":"string"},{"type":"null"}],"title":"Finish Reason","description":"Reason generation stopped (stop or length)"}},"description":"A single completion choice"},"title":"Choices","description":"Array of completion choices"},"created":{"type":"integer","title":"Created","description":"Unix timestamp when the completion was created"},"citations":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"Citations","description":"URLs of sources used to generate the response"},"search_results":{"anyOf":[{"type":"array","items":{"type":"object","title":"ApiPublicSearchResult","required":["title","url"],"properties":{"url":{"type":"string","title":"Url","description":"URL of the search result page"},"date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date","description":"Publication date of the result"},"title":{"type":"string","title":"Title","description":"Title of the search result page"},"source":{"enum":["web","attachment"],"type":"string","title":"Source","default":"web","description":"Source type of the result (web or attachment)"},"snippet":{"type":"string","title":"Snippet","default":"","description":"Text snippet from the search result"},"last_updated":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Updated","description":"Date the result was last updated"}},"description":"A single search result from the web"}},{"type":"null"}],"title":"Search Results","description":"Search results used for context in the response"},"related_questions":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"Related Questions","description":"Array of related questions returned when return_related_questions is true"}}},{"type":"null"}]},"failed_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Failed At","description":"Unix timestamp when the request failed (if applicable)"},"created_at":{"type":"integer","title":"Created At","description":"Unix timestamp when the request was created"},"started_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Started At","description":"Unix timestamp when processing started"},"completed_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completed At","description":"Unix timestamp when processing completed"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message","description":"Error message if the request failed"}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_hiRbMrwWSG2CIU3Q6RPoZ","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Submits an asynchronous chat completion request to Perplexity's Sonar models, returning a job ID for polling the result.","exampleAgentPrompt":"Use Sonar deep research to answer this asynchronously: 'What are the latest breakthroughs in room-temperature superconductors as of 2025?' — use the sonar-deep-research model, search the web, and give me up to 4000 tokens in your response.","exampleUseCases":null,"resultDescription":"Returns a job object with a unique async request ID, the model used, creation timestamp, and a status field (CREATED, IN_PROGRESS, COMPLETED, or FAILED). When completed, includes the full chat completion response with generated text, citations, and token usage/cost breakdown.","failureModes":["Invalid or missing model enum value returns a validation error","Messages array missing required role or content fields causes a 422","Exceeding max_tokens limit of 128000 returns a validation error","Payment failure or insufficient USDC balance blocks the request","Polling a non-existent job ID returns a not-found error","Job enters FAILED status if the underlying model or search query fails","Timeout or service unavailability may leave job stuck in IN_PROGRESS"],"whenToPreferThis":"Use this endpoint when you need Perplexity Sonar completions but cannot block on a synchronous response — ideal for deep research queries, sonar-reasoning-pro tasks, or long-form generation that may take significant time. Prefer over the synchronous endpoint when integrating into workflows that benefit from polling or webhooks. Choose this over the generic Agent or Search sibling endpoints when you need full chat-style message history and model selection control.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T12:35:16.193Z","isFirstParty":false}