Skill Tracer
Skills › Scientific Agent Skills › research-lookup › api-contracts.md

api-contracts.md

104 lines · skills/research-lookup/references/api-contracts.md at 5f2bc03

Open on GitHub
1# Reviewed service contracts
2
3Reviewed 2026-09-30 against official schemas, `parallel-web-tools` 0.9.3 source
4and local help, plus unauthenticated OpenRouter model metadata. No paid or
5authenticated generation/retrieval requests were submitted during this review.
6Mocked tests exercise request formation, response parsing, and packet behavior.
7

Reviewed service contracts

Reviewed 2026-09-30 against official schemas, parallel-web-tools 0.9.3 source and local help, plus unauthenticated OpenRouter model metadata. No paid or authenticated generation/retrieval requests were submitted during this review. Mocked tests exercise request formation, response parsing, and packet behavior.

Raw lines 1 to 7
8## Parallel Search and Extract through CLI 0.9.3
9
10- Search uses `POST https://api.parallel.ai/v1/search`; Extract uses
11 `POST https://api.parallel.ai/v1/extract`. API keys use `x-api-key`; the CLI
12 resolves `PARALLEL_API_KEY` before stored login credentials. Never put keys in
13 command arguments. Login is device OAuth by default; `--no-browser` suppresses
14 launching a local browser. The CLI guide's old `--device` example conflicts
15 with the reviewed 0.9.3 source/help.
16- V1 Search requires `search_queries`; `objective` adds context. The wrapper
17 always supplies both using its positional objective and repeated `-q` flags.
18 Modes are `turbo`, `fast`, `basic`, and `advanced`; the wrapper explicitly sets
19 one, avoiding the difference between CLI `basic` and raw API `advanced` defaults.
20- V1 request limits and filters are nested under `advanced_settings`, including
21 `max_results`, `source_policy`, and `excerpt_settings`. CLI flags construct this
22 shape. `after_date` filters page publication dates, not database indexing dates.
23 No cursor, page, or offset is documented: use distinct bounded queries to
24 improve coverage, without claiming exhaustive retrieval.
25- Search returns `search_id`, `session_id`, and ranked `results`; result objects
26 contain `url`, `excerpts`, and optional `title`/`publish_date`. `usage` and
27 `warnings` can be absent/null. CLI adds its own status wrapper; raw V1 has no
28 top-level status. The ledger uses application status and preserves warnings.
29- Extract accepts up to **20 URLs per request**; the wrapper defaults to batches
30 of 10. It uses objective-focused excerpts, not structured bibliographic JSON or
31 guaranteed full text. V1 excerpts are always returned; full content is optional.
32- Extract returns `extract_id`, `session_id`, `results`, and **`errors`**. Each
33 error identifies `url` and `error_type`, with optional HTTP status/content.
34 Reconcile success and error records per URL; empty excerpts never count as
35 retrieval verification. Sessions are propagated from Search through Extract.
36 Errors, warnings, and unresolved URLs remain in the ledger; redirected URLs may
37 need manual identity reconciliation.
39Sources: [Search schema](https://docs.parallel.ai/api-reference/search/search),
40[Extract schema](https://docs.parallel.ai/api-reference/extract/extract),
41[Search migration](https://docs.parallel.ai/search/search-migration-guide),
42[Extract migration](https://docs.parallel.ai/extract/extract-migration-guide),
43[CLI 0.9.3 source](https://github.com/parallel-web/parallel-web-tools/tree/v0.9.3),
44[release metadata](https://pypi.org/project/parallel-web-tools/0.9.3/).

Parallel Search and Extract through CLI 0.9.3

  • Search uses POST https://api.parallel.ai/v1/search; Extract uses POST https://api.parallel.ai/v1/extract. API keys use x-api-key; the CLI resolves PARALLEL_API_KEY before stored login credentials. Never put keys in command arguments. Login is device OAuth by default; --no-browser suppresses launching a local browser. The CLI guide's old --device example conflicts with the reviewed 0.9.3 source/help.
  • V1 Search requires search_queries; objective adds context. The wrapper always supplies both using its positional objective and repeated -q flags. Modes are turbo, fast, basic, and advanced; the wrapper explicitly sets one, avoiding the difference between CLI basic and raw API advanced defaults.
  • V1 request limits and filters are nested under advanced_settings, including max_results, source_policy, and excerpt_settings. CLI flags construct this shape. after_date filters page publication dates, not database indexing dates. No cursor, page, or offset is documented: use distinct bounded queries to improve coverage, without claiming exhaustive retrieval.
  • Search returns search_id, session_id, and ranked results; result objects contain url, excerpts, and optional title/publish_date. usage and warnings can be absent/null. CLI adds its own status wrapper; raw V1 has no top-level status. The ledger uses application status and preserves warnings.
  • Extract accepts up to 20 URLs per request; the wrapper defaults to batches of 10. It uses objective-focused excerpts, not structured bibliographic JSON or guaranteed full text. V1 excerpts are always returned; full content is optional.
  • Extract returns extract_id, session_id, results, and **errors**. Each error identifies url and error_type, with optional HTTP status/content. Reconcile success and error records per URL; empty excerpts never count as retrieval verification. Sessions are propagated from Search through Extract. Errors, warnings, and unresolved URLs remain in the ledger; redirected URLs may need manual identity reconciliation.

Sources: Search schema, Extract schema, Search migration, Extract migration, CLI 0.9.3 source, release metadata.

Raw lines 8 to 45
46## Explicit Research
48`parallel-cli research run --text --json -o BASE` creates a Task with
49`POST /v1/tasks/runs`, polls `GET /v1/tasks/runs/{run_id}`, and retrieves
50`GET /v1/tasks/runs/{run_id}/result`. Auth uses the same CLI credentials. The
51payload includes `input`, `processor`, `task_spec.output_schema.type="text"`,
52and optional `previous_interaction_id`; it is not a Search session ID.
54The raw API result has `run` and `output` objects. CLI 0.9.3 normalizes metadata
55to top-level `run_id`, `interaction_id`, `status`, and `output`. Saving a text
56result writes `BASE.md` and replaces JSON `output.content` with
57`output.content_file`; `--json` prints that same saved shape. The wrapper reads
58the known sibling Markdown file, retains `output.basis`, and rejects empty or
59unfinished reports. It rejects inputs exceeding 15,000 characters before the CLI
60can silently truncate them. Client timeout does not cancel the server run.
62Sources: [create Task](https://docs.parallel.ai/api-reference/tasks/create-task-run),
63[retrieve result](https://docs.parallel.ai/api-reference/tasks/retrieve-task-run-result),
64[interactions](https://docs.parallel.ai/task-api/guides/interactions),
65[CLI source](https://github.com/parallel-web/parallel-web-tools/tree/v0.9.3).

Explicit Research

parallel-cli research run --text --json -o BASE creates a Task with POST /v1/tasks/runs, polls GET /v1/tasks/runs/{run_id}, and retrieves GET /v1/tasks/runs/{run_id}/result. Auth uses the same CLI credentials. The payload includes input, processor, task_spec.output_schema.type="text", and optional previous_interaction_id; it is not a Search session ID.

The raw API result has run and output objects. CLI 0.9.3 normalizes metadata to top-level run_id, interaction_id, status, and output. Saving a text result writes BASE.md and replaces JSON output.content with output.content_file; --json prints that same saved shape. The wrapper reads the known sibling Markdown file, retains output.basis, and rejects empty or unfinished reports. It rejects inputs exceeding 15,000 characters before the CLI can silently truncate them. Client timeout does not cancel the server run.

Sources: create Task, retrieve result, interactions, CLI source.

Raw lines 46 to 66
67## Explicit beta Chat
69The current reference documents `POST https://api.parallel.ai/v1beta/chat/completions`
70with `x-api-key`. The wrapper sends `model`, `messages`, and `stream=false` and
71reads `choices[0].message.content`, optional `basis`, and `usage`. The published
72research-model announcement names `speed`, `lite`, `base`, and `core`; the current
73schema leaves model as a string and does not enumerate availability. No live model
74execution was checked. Basis is retained, not treated as independent validation.
76The old unversioned `/chat/completions` URL and Bearer auth appeared in older
77SDK examples. The wrapper now follows the versioned current schema. The former
78Chat quickstart redirects to Responses; that API uses `/v1/responses`, a different
79model and response envelope, and is not implemented by this wrapper.
81Sources: [Chat reference](https://docs.parallel.ai/api-reference/chat-api-beta/chat-completions),
82[research-model announcement](https://parallel.ai/blog/research-models-chat),
83[Responses quickstart](https://docs.parallel.ai/responses-api/responses-quickstart).

Explicit beta Chat

The current reference documents POST https://api.parallel.ai/v1beta/chat/completions with x-api-key. The wrapper sends model, messages, and stream=false and reads choices[0].message.content, optional basis, and usage. The published research-model announcement names speed, lite, base, and core; the current schema leaves model as a string and does not enumerate availability. No live model execution was checked. Basis is retained, not treated as independent validation.

The old unversioned /chat/completions URL and Bearer auth appeared in older SDK examples. The wrapper now follows the versioned current schema. The former Chat quickstart redirects to Responses; that API uses /v1/responses, a different model and response envelope, and is not implemented by this wrapper.

Sources: Chat reference, research-model announcement, Responses quickstart.

Raw lines 67 to 84
85## Explicit or authorized fallback Perplexity
87The wrapper calls `POST https://openrouter.ai/api/v1/chat/completions` with
88`Authorization: Bearer` and model `perplexity/sonar-pro-search`. The public model
89catalog and endpoint listing confirmed this model and `web_search_options`
90support. Search context is nested as `web_search_options.search_context_size`.
91The former top-level `search_mode="academic"` is not part of the documented
92OpenRouter contract used here; academic focus comes from the prompt.
94Read text from `choices[0].message.content` and citations from
95`choices[0].message.annotations[].url_citation` (`url`, `title`, optional
96`content` and character offsets). Legacy `search_results`/`citations` fields are
97also accepted, deduplicated by URL. Keep raw response data for provenance; a
98source link or a model's synthesis still requires verification. Neither key
99presence nor an unavailable Parallel CLI authorizes provider switching.
101Sources: [request format](https://openrouter.ai/docs/api_reference/overview),
102[web search and citations](https://openrouter.ai/docs/guides/features/plugins/web-search),
103[model catalog](https://openrouter.ai/api/v1/models),
104[model endpoints](https://openrouter.ai/api/v1/models/perplexity/sonar-pro-search/endpoints).

Explicit or authorized fallback Perplexity

The wrapper calls POST https://openrouter.ai/api/v1/chat/completions with Authorization: Bearer and model perplexity/sonar-pro-search. The public model catalog and endpoint listing confirmed this model and web_search_options support. Search context is nested as web_search_options.search_context_size. The former top-level search_mode="academic" is not part of the documented OpenRouter contract used here; academic focus comes from the prompt.

Read text from choices[0].message.content and citations from choices[0].message.annotations[].url_citation (url, title, optional content and character offsets). Legacy search_results/citations fields are also accepted, deduplicated by URL. Keep raw response data for provenance; a source link or a model's synthesis still requires verification. Neither key presence nor an unavailable Parallel CLI authorizes provider switching.

Sources: request format, web search and citations, model catalog, model endpoints.

Raw lines 85 to 104