Class: LiteLLMClient::ImagesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/litellm_client/api/images_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ImagesApi

Returns a new instance of ImagesApi.



19
20
21
# File 'lib/litellm_client/api/images_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/litellm_client/api/images_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#image_edit_api_images_edits_post(image, opts = {}) ⇒ Object

Image Edit Api Follows the OpenAI Images API spec: platform.openai.com/docs/api-reference/images/create “‘bash curl -s -D >(grep -i x-request-id >&2) -o >(jq -r ’.data.b64_json’ | base64 –decode > gift-basket.png) -X POST "localhost:4000/v1/images/edits" -H "Authorization: Bearer sk-1234" -F "model=gpt-image-1" -F "image[][email protected]" -F ‘prompt=Create a studio ghibli image of this’ “‘

Parameters:

  • image (Array<File>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :model (String)
  • :mask (Array<File>)

Returns:

  • (Object)


29
30
31
32
# File 'lib/litellm_client/api/images_api.rb', line 29

def image_edit_api_images_edits_post(image, opts = {})
  data, _status_code, _headers = image_edit_api_images_edits_post_with_http_info(image, opts)
  data
end

#image_edit_api_images_edits_post_with_http_info(image, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Image Edit Api Follows the OpenAI Images API spec: platform.openai.com/docs/api-reference/images/create &#x60;&#x60;&#x60;bash curl -s -D &gt;(grep -i x-request-id &gt;&amp;2) -o &gt;(jq -r &#39;.data.b64_json&#39; | base64 –decode &gt; gift-basket.png) -X POST &quot;localhost:4000/v1/images/edits&quot; -H &quot;Authorization: Bearer sk-1234&quot; -F &quot;model&#x3D;gpt-image-1&quot; -F &quot;image[]&#x3D;@soap.png&quot; -F &#39;prompt&#x3D;Create a studio ghibli image of this&#39; &#x60;&#x60;&#x60;

Parameters:

  • image (Array<File>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :model (String)
  • :mask (Array<File>)

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



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
# File 'lib/litellm_client/api/images_api.rb', line 41

def image_edit_api_images_edits_post_with_http_info(image, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ImagesApi.image_edit_api_images_edits_post ...'
  end
  # verify the required parameter 'image' is set
  if @api_client.config.client_side_validation && image.nil?
    fail ArgumentError, "Missing the required parameter 'image' when calling ImagesApi.image_edit_api_images_edits_post"
  end
  # resource path
  local_var_path = '/images/edits'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'model'] = opts[:'model'] if !opts[:'model'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['image'] = @api_client.build_collection_param(image, :csv)
  form_params['mask'] = @api_client.build_collection_param(opts[:'mask'], :csv) if !opts[:'mask'].nil?

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['APIKeyHeader']

  new_options = opts.merge(
    :operation => :"ImagesApi.image_edit_api_images_edits_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ImagesApi#image_edit_api_images_edits_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#image_edit_api_openai_deployments_model_images_edits_post(model, image, opts = {}) ⇒ Object

Image Edit Api Follows the OpenAI Images API spec: platform.openai.com/docs/api-reference/images/create “‘bash curl -s -D >(grep -i x-request-id >&2) -o >(jq -r ’.data.b64_json’ | base64 –decode > gift-basket.png) -X POST "localhost:4000/v1/images/edits" -H "Authorization: Bearer sk-1234" -F "model=gpt-image-1" -F "image[][email protected]" -F ‘prompt=Create a studio ghibli image of this’ “‘

Parameters:

  • model (String)
  • image (Array<File>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :mask (Array<File>)

Returns:

  • (Object)


104
105
106
107
# File 'lib/litellm_client/api/images_api.rb', line 104

def image_edit_api_openai_deployments_model_images_edits_post(model, image, opts = {})
  data, _status_code, _headers = image_edit_api_openai_deployments_model_images_edits_post_with_http_info(model, image, opts)
  data
end

#image_edit_api_openai_deployments_model_images_edits_post_with_http_info(model, image, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Image Edit Api Follows the OpenAI Images API spec: platform.openai.com/docs/api-reference/images/create &#x60;&#x60;&#x60;bash curl -s -D &gt;(grep -i x-request-id &gt;&amp;2) -o &gt;(jq -r &#39;.data.b64_json&#39; | base64 –decode &gt; gift-basket.png) -X POST &quot;localhost:4000/v1/images/edits&quot; -H &quot;Authorization: Bearer sk-1234&quot; -F &quot;model&#x3D;gpt-image-1&quot; -F &quot;image[]&#x3D;@soap.png&quot; -F &#39;prompt&#x3D;Create a studio ghibli image of this&#39; &#x60;&#x60;&#x60;

Parameters:

  • model (String)
  • image (Array<File>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :mask (Array<File>)

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



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
# File 'lib/litellm_client/api/images_api.rb', line 116

def image_edit_api_openai_deployments_model_images_edits_post_with_http_info(model, image, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ImagesApi.image_edit_api_openai_deployments_model_images_edits_post ...'
  end
  # verify the required parameter 'image' is set
  if @api_client.config.client_side_validation && image.nil?
    fail ArgumentError, "Missing the required parameter 'image' when calling ImagesApi.image_edit_api_openai_deployments_model_images_edits_post"
  end
  # resource path
  local_var_path = '/openai/deployments/{model}/images/edits'.sub('{' + 'model' + '}', CGI.escape(model.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['image'] = @api_client.build_collection_param(image, :csv)
  form_params['mask'] = @api_client.build_collection_param(opts[:'mask'], :csv) if !opts[:'mask'].nil?

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['APIKeyHeader']

  new_options = opts.merge(
    :operation => :"ImagesApi.image_edit_api_openai_deployments_model_images_edits_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ImagesApi#image_edit_api_openai_deployments_model_images_edits_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#image_edit_api_v1_images_edits_post(image, opts = {}) ⇒ Object

Image Edit Api Follows the OpenAI Images API spec: platform.openai.com/docs/api-reference/images/create “‘bash curl -s -D >(grep -i x-request-id >&2) -o >(jq -r ’.data.b64_json’ | base64 –decode > gift-basket.png) -X POST "localhost:4000/v1/images/edits" -H "Authorization: Bearer sk-1234" -F "model=gpt-image-1" -F "image[][email protected]" -F ‘prompt=Create a studio ghibli image of this’ “‘

Parameters:

  • image (Array<File>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :model (String)
  • :mask (Array<File>)

Returns:

  • (Object)


178
179
180
181
# File 'lib/litellm_client/api/images_api.rb', line 178

def image_edit_api_v1_images_edits_post(image, opts = {})
  data, _status_code, _headers = image_edit_api_v1_images_edits_post_with_http_info(image, opts)
  data
end

#image_edit_api_v1_images_edits_post_with_http_info(image, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Image Edit Api Follows the OpenAI Images API spec: platform.openai.com/docs/api-reference/images/create &#x60;&#x60;&#x60;bash curl -s -D &gt;(grep -i x-request-id &gt;&amp;2) -o &gt;(jq -r &#39;.data.b64_json&#39; | base64 –decode &gt; gift-basket.png) -X POST &quot;localhost:4000/v1/images/edits&quot; -H &quot;Authorization: Bearer sk-1234&quot; -F &quot;model&#x3D;gpt-image-1&quot; -F &quot;image[]&#x3D;@soap.png&quot; -F &#39;prompt&#x3D;Create a studio ghibli image of this&#39; &#x60;&#x60;&#x60;

Parameters:

  • image (Array<File>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :model (String)
  • :mask (Array<File>)

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/litellm_client/api/images_api.rb', line 190

def image_edit_api_v1_images_edits_post_with_http_info(image, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ImagesApi.image_edit_api_v1_images_edits_post ...'
  end
  # verify the required parameter 'image' is set
  if @api_client.config.client_side_validation && image.nil?
    fail ArgumentError, "Missing the required parameter 'image' when calling ImagesApi.image_edit_api_v1_images_edits_post"
  end
  # resource path
  local_var_path = '/v1/images/edits'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'model'] = opts[:'model'] if !opts[:'model'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['image'] = @api_client.build_collection_param(image, :csv)
  form_params['mask'] = @api_client.build_collection_param(opts[:'mask'], :csv) if !opts[:'mask'].nil?

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['APIKeyHeader']

  new_options = opts.merge(
    :operation => :"ImagesApi.image_edit_api_v1_images_edits_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ImagesApi#image_edit_api_v1_images_edits_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#image_generation_images_generations_post(opts = {}) ⇒ Object

Image Generation

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :model (String)

Returns:

  • (Object)


250
251
252
253
# File 'lib/litellm_client/api/images_api.rb', line 250

def image_generation_images_generations_post(opts = {})
  data, _status_code, _headers = image_generation_images_generations_post_with_http_info(opts)
  data
end

#image_generation_images_generations_post_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>

Image Generation

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :model (String)

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/litellm_client/api/images_api.rb', line 259

def image_generation_images_generations_post_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ImagesApi.image_generation_images_generations_post ...'
  end
  # resource path
  local_var_path = '/images/generations'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'model'] = opts[:'model'] if !opts[:'model'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['APIKeyHeader']

  new_options = opts.merge(
    :operation => :"ImagesApi.image_generation_images_generations_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ImagesApi#image_generation_images_generations_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#image_generation_openai_deployments_model_images_generations_post(model, opts = {}) ⇒ Object

Image Generation

Parameters:

  • model (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


308
309
310
311
# File 'lib/litellm_client/api/images_api.rb', line 308

def image_generation_openai_deployments_model_images_generations_post(model, opts = {})
  data, _status_code, _headers = image_generation_openai_deployments_model_images_generations_post_with_http_info(model, opts)
  data
end

#image_generation_openai_deployments_model_images_generations_post_with_http_info(model, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Image Generation

Parameters:

  • model (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/litellm_client/api/images_api.rb', line 317

def image_generation_openai_deployments_model_images_generations_post_with_http_info(model, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ImagesApi.image_generation_openai_deployments_model_images_generations_post ...'
  end
  # resource path
  local_var_path = '/openai/deployments/{model}/images/generations'.sub('{' + 'model' + '}', CGI.escape(model.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['APIKeyHeader']

  new_options = opts.merge(
    :operation => :"ImagesApi.image_generation_openai_deployments_model_images_generations_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ImagesApi#image_generation_openai_deployments_model_images_generations_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#image_generation_v1_images_generations_post(opts = {}) ⇒ Object

Image Generation

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :model (String)

Returns:

  • (Object)


365
366
367
368
# File 'lib/litellm_client/api/images_api.rb', line 365

def image_generation_v1_images_generations_post(opts = {})
  data, _status_code, _headers = image_generation_v1_images_generations_post_with_http_info(opts)
  data
end

#image_generation_v1_images_generations_post_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>

Image Generation

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :model (String)

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/litellm_client/api/images_api.rb', line 374

def image_generation_v1_images_generations_post_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ImagesApi.image_generation_v1_images_generations_post ...'
  end
  # resource path
  local_var_path = '/v1/images/generations'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'model'] = opts[:'model'] if !opts[:'model'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['APIKeyHeader']

  new_options = opts.merge(
    :operation => :"ImagesApi.image_generation_v1_images_generations_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ImagesApi#image_generation_v1_images_generations_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end