Skip to main content

Python SDK for the 2ndOpinion API

Project description

secondopinion-sdk

Official Python SDK for 2ndOpinion — AI-to-AI code review where Claude, Codex, and Gemini review your code together.

Installation

pip install secondopinion-sdk

Quick Start

from secondopinion import SecondOpinion

client = SecondOpinion(api_key="sk_2op_...")

# Get a code review
result = client.opinion(diff="your git diff here", llm="codex")
print(result["analysis"]["summary"])

# Ask a question
answer = client.ask(question="Is this SQL query safe?", code="SELECT * FROM users WHERE id = " + user_id)
print(answer["response"])

# Check usage
status = client.status()
print(f"Credits: {status['totalAvailable']}")

Available Methods

Method Description Credits
opinion(diff, llm, context) Single-model code review 1
ask(question, llm, code, context) Ask an AI model a question 1
review(diff, llm, context) Code review (alias for opinion) 1
explain(diff, audience) Explain changes 1
consensus(diff, context) 3-model consensus review 3
bug_hunt(diff, context) 3-model bug detection 3
security_audit(diff, context) OWASP security scan 1-3
generate_tests(diff, llm, framework) Generate tests 1
status() Check account credits 0

Get an API Key

  1. Sign up at get2ndopinion.dev/signup
  2. Go to Dashboard > API Keys
  3. Create a key and pass it to the constructor

Free tier includes 5 credits/month. See all plans.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

secondopinion_sdk-0.2.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

secondopinion_sdk-0.2.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file secondopinion_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: secondopinion_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for secondopinion_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3f2db17d9c772f3b2ae188c3cfc9a504ffcfc8571c01fe1e2c847f2a1e7755a5
MD5 dfcbc120f67e56a0216d4906c6aa92cf
BLAKE2b-256 c5f4be17bd721661165524446007d1894f107f3d419f5d7756c00244846ede4c

See more details on using hashes here.

File details

Details for the file secondopinion_sdk-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for secondopinion_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e52daad82de0ac05bed534ebbbb2cd0a4b627ec2a333060c0b33923b62517ef3
MD5 76827c851d44acb3533966c026915b95
BLAKE2b-256 0b1a5b86a9873a2fcd97e4a00f84c48306d5332a6b6f3df97665a2fb5beb3b26

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page