File size: 4,437 Bytes
5ef6e9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/**
 * Generated by orval v8.5.3 🍺
 * Do not edit manually.
 * Api
 * API specification
 * OpenAPI spec version: 0.1.0
 */
import * as zod from "zod";

/**
 * Returns server health status
 * @summary Health check
 */
export const HealthCheckResponse = zod.object({
  status: zod.string(),
});

/**
 * Check if a Bearer token is configured
 * @summary Get API token status
 */
export const GetConfigTokenResponse = zod.object({
  configured: zod.boolean(),
  token: zod.string().nullish(),
});

/**
 * Save the Bearer token for geminigen.ai API
 * @summary Set API token
 */
export const SetConfigTokenBody = zod.object({
  token: zod.string(),
});

export const SetConfigTokenResponse = zod.object({
  success: zod.boolean(),
  message: zod.string().optional(),
});

/**
 * Remove the stored Bearer token
 * @summary Delete API token
 */
export const DeleteConfigTokenResponse = zod.object({
  success: zod.boolean(),
  message: zod.string().optional(),
});

/**
 * Generate an image using AI based on a text prompt
 * @summary Generate image
 */
export const generateImageBodyStyleDefault = `realistic`;
export const generateImageBodyAspectRatioDefault = `1:1`;
export const generateImageBodyModelDefault = `grok`;
export const generateImageBodyIsPrivateDefault = false;

export const GenerateImageBody = zod.object({
  prompt: zod.string().describe("Text description for image generation"),
  style: zod
    .enum([
      "none",
      "realistic",
      "anime",
      "artistic",
      "cartoon",
      "sketch",
      "oil_painting",
      "watercolor",
      "digital_art",
    ])
    .default(generateImageBodyStyleDefault)
    .describe("Style of image to generate"),
  aspectRatio: zod
    .enum(["1:1", "16:9", "9:16", "4:3", "3:4", "2:3", "3:2"])
    .default(generateImageBodyAspectRatioDefault)
    .describe("Aspect ratio for the image"),
  model: zod
    .enum([
      "grok",
      "meta",
      "imagen-pro",
      "imagen-4",
      "imagen-flash",
      "nano-banana-pro",
      "nano-banana-2",
    ])
    .default(generateImageBodyModelDefault)
    .describe("AI model to use"),
  resolution: zod
    .enum(["1K", "2K", "4K"])
    .optional()
    .describe(
      "Output resolution for supported models (Nano Banana Pro \/ Nano Banana 2)",
    ),
  referenceImageBase64: zod
    .string()
    .optional()
    .describe(
      "Base64-encoded reference image for image-to-image generation (optional)",
    ),
  referenceImageMime: zod
    .string()
    .optional()
    .describe("MIME type of the reference image (e.g. image\/jpeg)"),
  isPrivate: zod
    .boolean()
    .default(generateImageBodyIsPrivateDefault)
    .describe(
      "Whether this image should be private (only visible to the creator)",
    ),
});

export const GenerateImageResponse = zod.object({
  id: zod.number(),
  imageUrl: zod.string(),
  prompt: zod.string(),
  style: zod.string(),
  aspectRatio: zod.string(),
  model: zod.string(),
  createdAt: zod.coerce.date(),
  apiDebug: zod.object({
    requestUrl: zod.string(),
    requestMethod: zod.string(),
    requestHeaders: zod.record(zod.string(), zod.string()),
    requestBody: zod.object({}).passthrough(),
    responseStatus: zod.number(),
    responseBody: zod.object({}).passthrough(),
    durationMs: zod.number(),
    usedFallback: zod.boolean(),
    fallbackReason: zod.string().optional(),
  }),
});

/**
 * Retrieve the list of previously generated images
 * @summary Get image history
 */
export const getImageHistoryQueryLimitDefault = 20;
export const getImageHistoryQueryOffsetDefault = 0;

export const GetImageHistoryQueryParams = zod.object({
  limit: zod.coerce.number().default(getImageHistoryQueryLimitDefault),
  offset: zod.coerce.number().default(getImageHistoryQueryOffsetDefault),
});

export const GetImageHistoryResponse = zod.object({
  images: zod.array(
    zod.object({
      id: zod.number(),
      imageUrl: zod.string(),
      prompt: zod.string(),
      style: zod.string(),
      aspectRatio: zod.string(),
      model: zod.string(),
      isPrivate: zod.boolean(),
      userId: zod.number().nullish(),
      createdAt: zod.coerce.date(),
    }),
  ),
  total: zod.number(),
});

/**
 * Delete a generated image from history
 * @summary Delete image
 */
export const DeleteImageParams = zod.object({
  id: zod.coerce.number(),
});

export const DeleteImageResponse = zod.object({
  success: zod.boolean(),
  message: zod.string().optional(),
});