For the complete documentation index, see llms.txt. This page is also available as Markdown.
Python
Install
cURL
pip install scispaceRequires Python 3.9 or later.
Configure
Python
from scispace import Scispace
client = Scispace(
api_key=None, # defaults to SCISPACE_API_KEY
timeout=60.0, # seconds, per request
max_retries=4, # on 429 and 5xx
api_version="2026-08-01",
)Minimal example
Python
search = client.searches.create(
query="How does climate change affect biodiversity?",
depth="standard",
).wait()
print(search.answer.text)Ergonomics
Waiting on async resources
Python
extraction = client.extractions.create(schema_id="exsc_2hq7bnv6ld",
document_ids=[...]).wait(timeout=900)Auto-pagination
Python
for paper in client.papers.list(query="transformer architecture"):
print(paper.doi) # fetches further pages as neededStreaming
Python
with client.chats.messages.stream(chat_id="chat_1r8eaidwoq",
content="What datasets were used?") as stream:
for event in stream:
if event.type == "message.delta":
print(event.delta, end="", flush=True)
elif event.type == "citation.added":
print(f"\n[{event.citation.index}] p.{event.citation.locations[0].page}")
message = stream.get_final_message()Errors
Python
from scispace import (ScispaceError, InvalidRequestError, AuthenticationError,
PermissionError, NotFoundError, RateLimitError,
InsufficientCreditsError, APIError)
try:
client.searches.create(query="")
except InvalidRequestError as e:
print(e.code, e.param, e.request_id)
except InsufficientCreditsError:
...Every exception carries code, param, request_id, and status_code.
Async client
Python
from scispace import AsyncScispace
client = AsyncScispace()
search = await (await client.searches.create(query="…")).wait()Identical surface, async/await throughout, with async for on paginators and streams.
Full reference
Generated API surface: https://docs.scispace.com/sdks/python/reference.
Related
Last updated