Registry / ai-ml / opencode-ai

opencode-ai

JSON →
library0.1.0a36pypypi✓ verified 80d ago

The official Python library for the opencode API. Currently at version 0.1.0a36 (alpha). Provides synchronous and asynchronous clients for interacting with opencode services. Under active development with frequent alpha releases.

pip install opencode-ai
INSTALL
IMPORT
SIG · OPENCODE-AI
O
opencode-ai
ai-mlpythonv0.1.0a36
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Client
from opencode_ai import Client
from opencode import OpenCode
AsyncClient
from opencode_ai import AsyncClient
from opencode import OpenCode
AsyncOpencode
from opencode_ai import AsyncOpencode
from opencode import OpenCode

Initialize the client and list available models.

from opencode import OpenCode client = OpenCode(api_key='your_api_key_here') response = client.models.list() print(response)
Debug
Known issues
gotchaThe library is in alpha (0.1.0a36). API surface and client interfaces may change without notice. Pin to a specific version in production.
fix
Use `opencode-ai==0.1.0a36` in requirements.txt.
affects: <1.0.0
gotchaThe client expects the API key to be passed as a parameter or set as `OPENCODE_API_KEY` environment variable. If neither is provided, the client will raise an authentication error at the first API call.
fix
Always set the API key: `client = OpenCode(api_key='...')` or export `OPENCODE_API_KEY`.
affects: all
deprecatedImporting `opencode` directly (without `.OpenCode`) is deprecated. In future versions, `import opencode` may change behavior.
fix
Use `from opencode import OpenCode`.
affects: 0.1.x
Upgrade
Version history
0.1.0a36latest on PyPI · released Aug 27, 2025
Audit
Dependencies
httpxrequiredHTTP client used by the library
pydanticrequiredData validation and serialization
Agent activity
7 hits · last 30 days
node
6
Resources
opencode-ai — pip install opencode-ai · libregistry