Skip to content

Add client.literature (public /v1 API), API-key login and an MCP server - #10

Merged
man4ish merged 1 commit into
mainfrom
claude/literature-api
Oct 3, 2026
Merged

man4ish merged 1 commit into
mainfrom
claude/literature-api

Conversation

@man4ish

@man4ish man4ish commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator
  • OmniBioAI(api_key="omni_sk_...") (or OMNIBIOAI_API_KEY) sends the key as the bearer token; no refresh applies. access_token and api_key are mutually exclusive; a refresh_token with an API key is rejected.
  • client.literature.ask(question, study, top_k, mode, hybrid_search, idempotency_key) -> POST {gateway}/v1/literature/answers, always with an Idempotency-Key (generated unless given) so a retry is never billed twice. client.literature.studies() -> GET /v1/literature/studies.
  • New exceptions: QuotaExceededError (402) and RateLimitError (429, .retry_after from Retry-After), both subclasses of ValidationError so existing handlers keep catching them. The /v1 error envelope's message is used as the exception text.
  • omnibioai-mcp (optional extra "mcp", mcp>=2,<3): stdio MCP server with answer_with_citations, find_pmids and list_studies tools, configured by OMNIBIOAI_API_KEY and OMNIBIOAI_BASE_URL. import omnibioai still needs only requests.

Coverage stays at 100% (112 tests).

Claude-Session: https://claude.ai/code/session_016nxi4bp7DP1ancERNUUfzj

- OmniBioAI(api_key="omni_sk_...") (or OMNIBIOAI_API_KEY) sends the key
  as the bearer token; no refresh applies. access_token and api_key are
  mutually exclusive; a refresh_token with an API key is rejected.
- client.literature.ask(question, study, top_k, mode, hybrid_search,
  idempotency_key) -> POST {gateway}/v1/literature/answers, always with
  an Idempotency-Key (generated unless given) so a retry is never billed
  twice. client.literature.studies() -> GET /v1/literature/studies.
- New exceptions: QuotaExceededError (402) and RateLimitError (429,
  .retry_after from Retry-After), both subclasses of ValidationError so
  existing handlers keep catching them. The /v1 error envelope's message
  is used as the exception text.
- omnibioai-mcp (optional extra "mcp", mcp>=2,<3): stdio MCP server with
  answer_with_citations, find_pmids and list_studies tools, configured by
  OMNIBIOAI_API_KEY and OMNIBIOAI_BASE_URL. `import omnibioai` still
  needs only requests.

Coverage stays at 100% (112 tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016nxi4bp7DP1ancERNUUfzj
@man4ish
man4ish merged commit 05781c6 into main Oct 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants