Skip to content

Commit 8acf5ce

Browse files
montyandersonclaude
andcommitted
v2: expose price response from inference API
Add opt-in `price` option to job requests that passes `?price=true` query parameter to the inference API. When enabled, the job result includes a `price` field with `product` and `dollars`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f9ec3d8 commit 8acf5ce

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

v2/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ export type ProdiaJob = {
2929
config?: Record<string, JsonValue>;
3030
};
3131

32+
export type ProdiaJobPrice = {
33+
product: string;
34+
dollars: number;
35+
};
36+
3237
type ProdiaJobResult = ProdiaJob & {
3338
id: string;
3439
created_at: string;
@@ -38,6 +43,7 @@ type ProdiaJobResult = ProdiaJob & {
3843
elapsed: number;
3944
ips?: number;
4045
};
46+
price?: ProdiaJobPrice;
4147
};
4248

4349
export type ProdiaJobOptions = {
@@ -49,6 +55,7 @@ export type ProdiaJobOptions = {
4955
| "multipart/form-data"
5056
| "video/mp4";
5157
inputs?: (File | Blob | ArrayBuffer | Uint8Array)[];
58+
price?: boolean;
5259
};
5360

5461
const defaultJobOptions: ProdiaJobOptions = {
@@ -152,8 +159,12 @@ export const createProdia = ({
152159
"job.json",
153160
);
154161

162+
const jobUrl = options.price
163+
? `${baseUrl}/job?price=true`
164+
: `${baseUrl}/job`;
165+
155166
do {
156-
response = await fetch(`${baseUrl}/job`, {
167+
response = await fetch(jobUrl, {
157168
method: "POST",
158169
headers: {
159170
Authorization: `Bearer ${token}`,

0 commit comments

Comments
 (0)