The writer-sdk is the official Python library for the Writer API, providing programmatic access to Writer's generative AI capabilities. It enables Python 3.9+ applications to integrate features like chat completions, text generation, and knowledge graph interactions. The library is actively maintained with frequent updates, including a recent release candidate for version 3.0.0.
pip install writer-sdkVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the Writer client and make a basic chat completion request. It emphasizes using the `WRITER_API_KEY` environment variable for secure authentication.
Review the v3.0.0-rc1 changelog and update your code to remove usage of deprecated features or use alternative Writer API capabilities.
If you encounter type-related errors after upgrading to v2.0.0+, review the updated type definitions in the SDK or limit usage to the `client.chat.chat` method without direct type imports.
Ensure you are installing `writer-sdk` for the API client and `writer` for the framework, and import accordingly. The SDK's client is typically imported as `from writerai import Writer`.
Set the `WRITER_API_KEY` environment variable before running your application (e.g., `export WRITER_API_KEY="your-api-key"`) or use a `.env` file for local development. Alternatively, pass it explicitly to the client constructor (e.g., `client = Writer(api_key=os.environ.get('WRITER_API_KEY'))`).Ensure the library is installed with `pip install writer-sdk` and that your import statement is `from writerai import Writer`.
Verify that your `WRITER_API_KEY` environment variable is set correctly with a valid API key from your Writer AI Studio account. Ensure there are no leading/trailing spaces or incorrect characters.
Check your internet connection, firewall settings, and ensure that `https://api.writer.com/v1` is accessible. Increase client timeout if necessary.
Refer to the official Writer SDK documentation for the correct API calls for your installed version. Upgrade your `writer-sdk` to the latest version to access new features, and review changelogs for breaking changes if upgrading across major versions.