Inspiration
Getting an illustration commissioned is awkward on both sides. Clients don't want to pay in full before seeing anything; artists don't want to work unpaid. Existing commission platforms solve this with a human middleman holding the money. We wanted to see whether an AI agent plus PayPal's authorize/capture flow could replace that middleman entirely.
What it does
Atelier Agent is an AI agent that takes illustration commissions:
- A client describes the illustration they want in natural language.
- The agent creates a PayPal order and places an authorization hold — no money is captured yet.
- The agent interprets the request (art direction: composition, style, lighting) and generates the artwork.
- The client previews the result. On approval, the agent captures the payment and releases the full-resolution artwork.
- If the client asks for changes, the agent interprets the feedback and regenerates, while the authorization stays safely in place.
The payment rail is not bolted on: the authorize → generate → approve → capture loop is the product. It is escrow-like protection, implemented entirely with PayPal's developer platform in the sandbox environment.
How we built it
- A dependency-free Python (standard library only) web server that runs the commission state machine: CREATED → AUTHORIZED → GENERATED → CAPTURED.
- PayPal Orders API v2 (sandbox) with intent=AUTHORIZE: create order, buyer approval, authorize the hold, and capture only after the client approves the artwork.
- DeepSeek Chat as the agent brain: it expands a short client request into a full art-direction prompt and interprets revision feedback.
- OpenAI Images API (gpt-image-2) for generation, with a model fallback chain and an optional Google Gemini provider behind the same interface.
- Vanilla JavaScript frontend. A DEMO mode with a clearly labeled simulated flow is included so anyone can try the UX without API keys.
Challenges we ran into
- The PayPal approval redirect broke our page state: after returning from PayPal, the app had forgotten which commission was in progress. We fixed it by persisting the commission ID in localStorage and re-rendering from server state on load.
- Opening the approval page in a new tab made the return flow look duplicated; navigating in the same tab made authorize → return seamless.
- Image model availability differed from the documentation on our OpenAI account (only the gpt-image-2 generation was exposed), so we built a fallback chain across models and providers instead of hard-coding one model.
- Early API errors were opaque ("400 Bad Request"). Surfacing the providers' error bodies in the UI made the whole system dramatically easier to debug.
Accomplishments that we're proud of
- The complete loop works live against the real PayPal sandbox: authorize (hold) → AI generation → client approval → capture, verified end to end.
- The escrow-like guarantee is real, not a mockup: before approval there is only a hold; money moves only when the client says the artwork is good.
- The whole backend is standard-library Python — clone the repo, add your keys, and it runs.
What we learned
- Authorize/capture is a powerful primitive for agent commerce: an agent can hold funds conditionally and settle only when a human approves the result.
- Most of the hard problems were not the AI or the payment API in isolation, but the seams between them: redirects, state, and error visibility.
- Letting an LLM do art direction (turning "a girl reading under a tree in the rain" into composition, palette and lighting instructions) noticeably improves generation quality over passing the raw request through.
What's next for Atelier Agent
- A smoother revision loop with side-by-side versions and per-revision notes.
- Paying out to human artists as well: the same hold/release flow works when a person, not a model, delivers the artwork.
- Hosted deployment so clients can commission without running anything locally.
Built With
- deepseek
- javascript
- openai
- python