Compare behavior, not just endpoint spelling
Images and videos use durable generation jobs instead of assuming immediate public media delivery. Text is non-streaming and can return either a confirmed completion or a durable uncertain job. Additional vendor-specific parameters should not be forwarded by default; unsupported fields are rejected. The website's character-mapping interface is also not an SDK compatibility layer. Model aliases, supported input and availability must come from AISwapLab's current catalog and schema, not another service's examples.
What to do next
- 01
Write a contract comparison for the intended operation
List the exact required input, allowed parameters, spending approval and output states. Include max_credits and creation Idempotency-Key, then note the expected immediate versus eventual response. Do not assume streaming, tools, attachments or vendor-only options because a general-purpose client exposes them.
- 02
Implement an explicit adapter boundary
Translate only fields you have verified, reject unsupported features clearly and keep keys server-side. For image/video work, return an application task state rather than fabricating an immediate media URL. For text, handle the confirmed completion and uncertain-job alternatives without hiding the latter as an empty answer.
- 03
Test recovery with local fixtures first
Exercise authentication errors, validation errors, HTTP 202, a 200 job replay, unknown work and private download failures without paying for generation. Verify that client timeouts cannot trigger a new task ID automatically. Introduce a real paid request only after the adapter's supported behavior and the user's budget are approved.
A concrete example
Illustrative mismatch: a generic client expects an image URL immediately after a successful response. AISwapLab instead returns a running job. An adapter stores its ID and shows processing, then later retrieves the authenticated content when completed. It does not turn the poll_url into an image src or call image creation again whenever rendering fails. The interface advertises only the behavior the adapter actually supports.
Adapter responsibility
| Boundary | Required handling |
|---|---|
| Input | Allow only documented fields and models |
| Approval | Quote and enforce max_credits |
| Lifecycle | Confirmed completion or durable job |
| Recovery | Same task identity on uncertainty |
| Delivery | Authenticated validated content |
Before you call it ready
- Unsupported vendor/client features are explicitly rejected.
- Job responses and content downloads have a real application path.
- Fixture tests cover uncertain outcomes without duplicate spending.
When to stop or choose another method
Stop calling the integration compatible if it cannot represent a required response or recovery state. Narrow the supported features or complete the adapter before offering them to users; changing the base URL alone is insufficient.
