Repository navigation
feat: images.generate (AI image generation), generation credits in usage — 0.2.0 - #1
Merged
Merged
Conversation
… usage, 0.2.0 - images.generate(prompt, model=, folder=, visibility=, expires_in=, sign_expires_in=) on the sync and async clients -> POST /v1/images/generate. Returns the image plus ["generation"] (model, credits_charged, credits_remaining). Never retried after a 5xx/network error, so a lost response cannot spend credits twice. - Types: GeneratedImage, Generation, GenerationUsage; Usage gains generation; Image gains optimized_url. - spec-coverage: generate_image is now covered. The live spec had also gained dashboard_delete_image, start_checkout and open_billing_portal, which would have turned the next scheduled run red; they are ignored on purpose (dashboard session / a person pays). - README documents it; version 0.2.0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019sMZVurbKqZ6zsbUYCsLJn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds AI image generation to the Python SDK (API:
POST /v1/images/generate, live since 2026-10-30).pv.images.generate(prompt, model=, folder=, visibility=, expires_in=, sign_expires_in=)on the sync and async clients. Returns the image plus["generation"](model,credits_charged,credits_remaining).429is retried: the API refunds before returning it.GeneratedImage,Generation,GenerationUsage;Usagegainsgeneration;Imagegainsoptimized_url.CI
spec-coveragefetches the live OpenAPI spec and fails on any operation the SDK neither wraps nor ignores.generate_imageis now covered. The live spec had also gaineddashboard_delete_image,start_checkoutandopen_billing_portalsince the last run (Oct 26), which would have turned the next scheduled run (Monday) red regardless of this feature. I added them toIGNOREDon purpose: a dashboard-session endpoint, and billing (a person pays or cancels; not an SDK flow). Say if you'd rather wrap billing.Verification
mypy clean; pytest 23 passed (6 new: request body/headers, omitted options, credit-error code, no retry after 5xx, usage credits, async);
check_spec_coverage.pypasses against the live spec (14 covered, 14 ignored).Release
Tag-triggered (
v0.2.0→ PyPI trusted publishing); not tagged yet.🤖 Generated with Claude Code
https://claude.ai/code/session_019sMZVurbKqZ6zsbUYCsLJn