--- id: opencode-ai version: "0.1.0a36" license: MIT license_treatment: permissive maintenance: aging --- # opencode-ai — The official Python library for the opencode API License: permissive · Maintenance: aging · Downloads: 116.0K/mo ## What it is and what it does Opencode-ai is an official Python SDK for the Opencode REST API, generated with Stainless. It wraps HTTP calls to the Opencode service and provides both synchronous and asynchronous clients powered by httpx, with optional aiohttp backend support for improved async concurrency. All request parameters and response fields are typed using Pydantic models and TypedDicts, enabling IDE autocomplete and type checking. The library handles common REST API concerns: automatic retries for transient failures (connection errors, timeouts, 429s, 5xx errors), configurable timeouts and retry counts, and a hierarchy of error types (APIConnectionError, APIStatusError, RateLimitError, etc.) for granular error handling. It supports streaming responses via Server Side Events and provides helpers for serializing responses to JSON or dictionaries. Runtime dependencies are minimal and stable (anyio, httpx, pydantic, distro, sniffio, typing-extensions). Use it for: - Build applications that interact with Opencode sessions, events, or other resources via a type-safe Python interface - Integrate Opencode API calls into async Python services or event-driven architectures using AsyncOpencode - Stream Server Side Events from Opencode endpoints with built-in iteration support - Handle API errors and retries automatically without writing custom retry logic - Access raw HTTP response headers and metadata via .with_raw_response or .with_streaming_response ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a Python client library for the Opencode REST API with synchronous and asynchronous interfaces, type-safe request/response handling via Pydantic, and built-in error handling and retry logic. Yes, if you need to call the Opencode API from Python. The library is well-structured with type safety, async support, and sensible defaults. However, note that it is in pre-release (0.1.0a36) and the project shows aging maintenance (last commit 2026-01-30), so expect slower updates and potential breaking changes in future releases. Verify that the Opencode service and your authentication method are available before committing to this dependency. ## Install pip install opencode-ai uv add opencode-ai poetry add opencode-ai ## Installing opencode-ai Before you install: Low install friction with a pure-Python wheel and standard dependencies. Maintenance status is aging—last commit was 2026-01-30, over 352 days since initial release—so expect slower response to issues or updates. License in practice: MIT license is permissive; you can use this library in commercial and proprietary projects with minimal restrictions, though you must include the license notice. Quickstart: pip install --pre opencode-ai from opencode_ai import Opencode client = Opencode() sessions = client.session.list() Requires Python 3.8 or later. API credentials or endpoint configuration may be needed depending on Opencode service requirements. Verify before relying: - Whether authentication (API key, token, or credentials) is required and how to configure it - Whether the Opencode service itself is publicly available or requires special access - Performance characteristics and rate-limit behavior under typical workloads - Stability guarantees for the 0.1.0a36 pre-release version ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 116.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags opencode api client, python rest api library, async http client, typed api wrapper, opencode sdk, pydantic api client, httpx async client, rest-api-client, async-http, type-safe [View on SkillFed](https://skillfed.io/packages/opencode-ai) · [View on PyPI](https://pypi.org/project/opencode-ai/)