Modellss Docs
  1. Image API
  • Send Request
  • Model List and Price
  • Model APIs
    • Chat API
      • Chat
      • GPTs
      • gemini-pro
      • gpt-4-all(Image)
      • gpt-4-vision-preview
    • Chat Completions API
      • Chat Completions API
    • Image API
      • Midjourney
        • InsightFace task submission
          • Submit swap_face task
        • Task Submission
          • Perform Action
          • Submit Blend Task
          • Submit a Describe task
          • Submit a Imagine task
          • Submit Modal
          • Submit Shorten Task
        • Task Inquiry
          • Inquire about all tasks
          • Inquire about tasks based on a list of IDs
          • Paged query for tasks
          • Inquire about the task queue
          • Cancel task
          • Retrieve task with specified ID
          • Get the seed for the task image
      • DALL·E 3
        POST
      • Stable Diffusion
        POST
      • MJ Chat
        POST
      • gpt-4-all(generate images)
        POST
    • Embedding Vector Generation Interface (Embeddings)
      • Create Embeddings
    • Audio
      • Create transcription
      • Create translation
      • Text to speech
  • Help Center
    • FAQ
  1. Image API

Stable Diffusion

POST
/v1/chat/completions
Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position. Create a completion for the provided prompt and parameters.

Request

Header Params
Content-Type
string 
required
Example:
application/json
Accept
string 
required
Example:
application/json
Authorization
string 
optional
Example:
Bearer {{YOUR_API_KEY}}
Body Params application/json
model
string 
required
ID of the model to use. See the model endpoint compatibility table for details on which models work with the Chat API.
Default:
stable-diffusion
Example:
stable-diffusion
messages
array [object {2}] 
required
A list of messages comprising the conversation so far. Example Python code.
role
string 
optional
content
string 
optional
temperature
integer 
optional
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.
top_p
integer 
optional
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.
n
integer 
optional
How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs.
stream
boolean 
optional
If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. Example Python code.
stop
string 
optional
Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
max_tokens
integer 
optional
The maximum number of tokens that can be generated in the completion.
presence_penalty
number 
optional
Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
frequency_penalty
number 
optional
Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
logit_bias
null 
optional
Modify the likelihood of specified tokens appearing in the completion.
user
string 
optional
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
Example
{
  "model": "stable-diffusion",
  "messages": [{"role": "user", "content": "striking poses, stunning backdrop of rocky coastline and golden hour lighting, fashion-forward wardrobe, eye-catching accessories, warm and inviting color palette, sharp and detailed digital rendering, stunning high definition finish, on eye level, scenic, masterpiece"}]
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.modelless.co/v1/chat/completions' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data-raw '{
  "model": "stable-diffusion",
  "messages": [{"role": "user", "content": "striking poses, stunning backdrop of rocky coastline and golden hour lighting, fashion-forward wardrobe, eye-catching accessories, warm and inviting color palette, sharp and detailed digital rendering, stunning high definition finish, on eye level, scenic, masterpiece"}]
}'

Responses

🟢200OK
application/json
Body
id
string 
required
object
string 
required
created
integer 
required
choices
array [object {3}] 
required
index
integer 
optional
message
object 
optional
finish_reason
string 
optional
usage
object 
required
prompt_tokens
integer 
required
completion_tokens
integer 
required
total_tokens
integer 
required
Example
{
    "id": "chatcmpl-123",
    "object": "chat.completion",
    "created": 1677652288,
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "\n\nHello there, how may I assist you today?"
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 9,
        "completion_tokens": 12,
        "total_tokens": 21
    }
}
Previous
DALL·E 3
Next
MJ Chat
Built with