opencode-ai
The official Python library for the opencode API
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.8 or later.
- API credentials or endpoint configuration may be needed depending on Opencode service requirements.
- Low install friction with a pure-Python wheel and standard dependencies.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use this library in commercial and proprietary projects with minimal restrictions, though you must include the license notice.
last release 2025-08-27 (352 days) · last repo commit 2026-01-30 · 270 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 115,983 downloads/mo, #12,224 on PyPI
Alternatives
Verify before relying
pip install --pre opencode-ai
from opencode_ai import Opencode
client = Opencode()
sessions = client.session.list()- 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
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 on this page. Verify before relying on it.
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
opencode-ai on PyPI
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.
Requires Python 3.8 or later. API credentials or endpoint configuration may be needed depending on Opencode service requirements.
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()
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 the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 6 packagesanyiodistrohttpxpydanticsniffiotyping-extensions |
| Maintenance | Aging 352 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 115,983 / month, #12,224 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: OS IndependentOperating System :: POSIXOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTyping :: Typed |
Evidence: opencode_ai-0.1.0a36-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “opencode api client”
- opencode-aiProvides a Python client library for the Opencode REST API with…
- opencode-agent-hubCoordinates communication between multiple AI agents running in…
- jupyter-ai-acp-clientProvides a JupyterLab extension that integrates Agent Client Protocol…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also agentex-client · arcadepy · composio-client · hiddenlayer-sdk · linq-python · openlayer · orb-billing · parallel-web · retell-sdk · letta-client