For AI agents: docs.octen.ai/resources/migrate-from-perplexity.md
Endpoint Map
| Perplexity | Octen |
|---|---|
Search (POST /search) | Web Search |
Search with search_type: "people" | Business Search |
Sonar (POST /v1/sonar) with sonar, sonar-pro, or sonar-reasoning-pro | Answer (always searches, then answers with numbered references) |
Sonar with response_format, disable_search, or sampling parameters | Auto Search (OpenAI Chat Completions format; the model decides when to search) |
Sonar with sonar-deep-research | Deep Research (a streamed report) |
Agent API (POST /v1/agent) | Auto Search (Chat Completions format instead of Responses format) |
Orchestrator Chat Completions and Messages (POST /orchestrator/v1/chat/completions, POST /orchestrator/v1/messages) | Auto Search for Chat Completions, Auto Search (Messages) for Messages |
Context (POST /v1/context) | Extract |
Monitors (POST /v1/monitors) | Monitor |
Embeddings (POST /v1/embeddings) | Embedding (different models, so re-embed stored vectors) |
Authentication
| Perplexity | Octen | |
|---|---|---|
| Base URL | https://api.perplexity.ai | https://api.octen.ai (OpenAI SDK with Auto Search: https://api.octen.ai/v1) |
| Auth header | Authorization: Bearer <key> | x-api-key: <key> or Authorization: Bearer <key> |
| Python SDK | perplexityai (Perplexity) | octen (Octen) |
Web Search
Request Parameters
| Perplexity | Octen |
|---|---|
query (one query, or a list of 1-5) | query (one query, up to 500 characters); send one request per query |
max_results (1-20; up to 50 for people) | count (1-100, default 5) |
search_domain_filter (prefix an entry with - to exclude it) | include_domains, exclude_domains (up to 1,200 each) |
search_recency_filter | time_range (day, week, month, or year) |
search_after_date_filter, search_before_date_filter (MM/DD/YYYY) | start_time, end_time (ISO 8601) with time_basis: "published" |
search_language_filter | language (a list of ISO 639-1 codes that results are restricted to) |
display_server_time | No parameter; meta.latency is always returned |
Response Fields
| Perplexity | Octen |
|---|---|
results | data.results |
results[].title | data.results[].title |
results[].url | data.results[].url |
results[].snippet | data.results[].highlight (highlight.max_tokens sets the length) |
results[].date (YYYY-MM-DD) | data.results[].time_published (ISO 8601) |
results[].last_updated | data.results[].time_last_crawled (last crawl time, not last update) |
id | request_id |
server_time | meta.latency (milliseconds) |
Code
from perplexity import Perplexity
client = Perplexity()
search = client.search.create(
query="latest stable Python release",
max_results=5,
search_domain_filter=["python.org"],
)
for result in search.results:
print(f"{result.title}: {result.url}")
print(result.snippet)
from octen import Octen
client = Octen()
response = client.search.search(
query="latest stable Python release",
count=5,
include_domains=["python.org"],
)
for result in response.results:
print(f"{result['title']}: {result['url']}")
print(result.get("highlight"))
Answer
Request Parameters
| Perplexity | Octen |
|---|---|
model (sonar, sonar-pro, or sonar-reasoning-pro) | model (an LLM ID, default openai/gpt-6.1-terra) |
messages | messages |
stream | stream (default false) |
search_domain_filter | web_search_options.include_domains, web_search_options.exclude_domains |
search_recency_filter | web_search_options.time_range |
search_after_date_filter, search_before_date_filter | web_search_options.start_time, web_search_options.end_time (ISO 8601) with web_search_options.time_basis: "published" |
search_language_filter | web_search_options.language |
return_images | web_search_options.include_images (per-result images) |
Response Fields
| Perplexity | Octen |
|---|---|
choices[0].message.content | choices[0].message.content (cites sources as [^N]) |
search_results[] | references[] (all search results, numbered; the answer cites them as [^N]) |
search_results[].title | references[].title |
search_results[].url | references[].url |
search_results[].snippet | references[].highlight |
search_results[].date | references[].time_published |
search_results[].last_updated | search_results[].results[].time_last_crawled (last crawl time) |
images | search_results[].results[].images (with web_search_options.include_images) |
usage.num_search_queries | meta.usage.num_search_queries |
usage.prompt_tokens, usage.completion_tokens, usage.total_tokens | meta.usage.prompt_tokens, meta.usage.completion_tokens, meta.usage.total_tokens |
model | model |
id | request_id |
Code
from perplexity import Perplexity
client = Perplexity()
completion = client.chat.completions.create(
model="sonar",
messages=[{"role": "user", "content": "What are the latest developments in AI agents?"}],
search_recency_filter="week",
)
print(completion.choices[0].message.content)
for result in completion.search_results:
print(result.url)
import os
import requests
response = requests.post(
"https://api.octen.ai/answer",
headers={"x-api-key": os.environ["OCTEN_API_KEY"]},
json={
"messages": [{"role": "user", "content": "What are the latest developments in AI agents?"}],
"web_search_options": {"time_range": "week"},
},
timeout=120,
)
response.raise_for_status()
answer = response.json()
print(answer["choices"][0]["message"]["content"])
for ref in answer["references"]:
print(f"[^{ref['num']}] {ref['url']}")
Auto Search
Request Parameters
| Perplexity | Octen |
|---|---|
input | messages |
instructions | A system message in messages |
model | model (such as openai/gpt-5.4) |
tools with type: "web_search" | tools with type: "octen_search" |
web_search filters.search_domain_filter | octen_search parameters.include_domains, parameters.exclude_domains |
web_search filters.search_recency_filter | octen_search parameters.time_range |
web_search filters.search_after_date_filter, filters.search_before_date_filter | octen_search parameters.start_time, parameters.end_time (ISO 8601) with parameters.time_basis: "published" |
web_search max_results | octen_search parameters.count (1-100, default 5) |
tools with type: "image_search" | tools with type: "octen_multimodal_search" |
tools with type: "function" | tools with type: "function" |
tool_choice | tool_choice |
max_output_tokens | max_completion_tokens |
reasoning.effort | reasoning.effort or reasoning_effort |
response_format | response_format (text, json_object, or json_schema) |
temperature, top_p | temperature, top_p |
previous_response_id | previous_response_id |
stream | stream |
Response Fields
| Perplexity | Octen |
|---|---|
output_text (SDK property) | choices[0].message.content (response.text in the Python SDK) |
output[] message item content[].annotations[] (url_citation) | choices[0].message.annotations[] (url_citation), for anthropic/ models only. Other models return sources in search_results. |
output[] item with type: "search_results" | search_results[] (one group per query the model searched) |
output[].queries | search_results[].query |
output[].results[].title, url | search_results[].results[].title, url |
output[].results[].snippet | search_results[].results[].highlights |
output[].results[].date | search_results[].results[].time_published |
usage.input_tokens, usage.output_tokens, usage.total_tokens | usage.prompt_tokens, usage.completion_tokens, usage.total_tokens |
usage.tool_calls_details | usage.num_search_queries |
id | id |
Code
from perplexity import Perplexity
client = Perplexity()
response = client.responses.create(
effort="fast",
input="What are the latest developments in AI agents?",
)
print(response.output_text)
from octen import ChatMessage, Octen, OctenSearchTool
client = Octen()
response = client.chat.create(
model="openai/gpt-5.4",
messages=[ChatMessage(role="user", content="What are the latest developments in AI agents?")],
tools=[OctenSearchTool()],
)
print(response.text)
for group in response.search_results or []:
for result in group.results:
print(result.url)
Extract
Request Parameters
| Perplexity | Octen |
|---|---|
urls (1-50) | urls (up to 20 URLs, each up to 2,048 characters) |
formats: ["markdown"] | format: "markdown" (default) |
formats: ["links"] | include_links (an object with scope and max_links up to 1,000) |
formats: ["highlights"] with highlights.query | query (returns highlights instead of full_content) |
max_age_seconds (0 fetches live) | max_age_seconds (300-31,536,000, default 86,400) |
timeout_ms (for the whole request) | timeout (seconds per URL, 1-60, default 30) |
Response Fields
| Perplexity | Octen |
|---|---|
results[].url | data.results[].url (data.results is response.items in the Python SDK) |
results[].markdown | data.results[].full_content |
results[].links (a list of URLs) | data.results[].links[] (url, anchor_text, is_external) |
results[].highlights (a string) | data.results[].highlights (a list of strings) |
results[].metadata.title | data.results[].title |
results[].metadata.published_date | data.results[].time_published |
results[].metadata.fetched_at | data.results[].time_last_crawled |
results[].status.type (ok or an error type) | data.results[].status (success or failed) |
results[].status.message | data.results[].error_message |
usage.fetched_urls | meta.usage.successful_urls |
request_id | request_id |
Code
from perplexity import Perplexity
client = Perplexity()
response = client.context.create(urls=["https://en.wikipedia.org/wiki/Web_crawler"])
for result in response.results:
if result.status.type == "ok":
print(result.markdown)
else:
print(f"{result.url}: {result.status.type}")
from octen import Octen
client = Octen()
response = client.extract.extract(urls=["https://en.wikipedia.org/wiki/Web_crawler"])
for item in response.items:
if item.status == "success":
print(item.full_content)
else:
print(f"{item.url}: {item.error_message}")
Monitor
Request Parameters
| Perplexity | Octen |
|---|---|
name | name (up to 256 characters) |
targets with one type: "search" target and its query | type: "topic" with topic.query (up to 500 characters) |
targets with 1-10 type: "page" targets | type: "page" with page.urls (1-10) |
Search target filters.include_domains, filters.exclude_domains | topic.include_domains, topic.exclude_domains (up to 1,200 each) |
goal | condition (when to notify, in natural language, up to 1,000 characters) |
schedule with type: "interval" (1m to 31d) | schedule.interval (5m to 59m, 1h to 100h, or 1d to 30d) |
schedule with type: "cron" | schedule.cron (runs at least 5 minutes apart) and schedule.timezone |
webhook.url | webhook.url (a public HTTPS URL) |
webhook.secret | No parameter; webhook.secret is generated automatically |
metadata (up to 16 pairs) | metadata (up to 8 pairs; keys up to 16 characters, values up to 512 characters) |
Response Fields
| Perplexity | Octen |
|---|---|
id | data.monitor_id |
status | data.status (active on creation) |
next_run_at | data.next_run_at |
current_run_id | data.first_run_id (the run started on creation) |
webhook.secret | data.webhook.secret (returned only in the create response) |
created_at | data.created_at |
changes[] from List a monitor’s runs (GET /v1/monitors/{monitor_id}/runs) | data.events[] from List monitor events |
changes[].url, changes[].title | data.events[].url, data.events[].title |
changes[].snippet | data.events[].highlight (topic monitors) |
changes[].confidence (0-1) | data.events[].judgment.confidence (high, medium, or low) |
changes[].published_at | data.events[].time_published (topic monitors) |
Code
from perplexity import Perplexity
client = Perplexity()
monitor = client.monitors.create(
name="Battery recycling research",
targets=[{"type": "search", "query": "battery recycling research", "max_results": 3}],
schedule={"type": "interval", "interval": "1d"},
)
print(monitor.id, monitor.status)
import os
import requests
response = requests.post(
"https://api.octen.ai/monitors",
headers={"x-api-key": os.environ["OCTEN_API_KEY"]},
json={
"type": "topic",
"name": "Battery recycling research",
"topic": {"query": "battery recycling research"},
"schedule": {"interval": "1d"},
},
timeout=30,
)
response.raise_for_status()
monitor = response.json()["data"]
print(monitor["monitor_id"], monitor["status"])
Last modified on November 24, 2026