<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: luke</title>
    <description>The latest articles on DEV Community by luke (@ttapi).</description>
    <link>https://dev.to/ttapi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1284439%2F6e8e1d09-cb82-4527-97a6-e250c8406c24.png</url>
      <title>DEV Community: luke</title>
      <link>https://dev.to/ttapi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ttapi"/>
    <language>en</language>
    <item>
      <title>How to use Midjourney API by Python</title>
      <dc:creator>luke</dc:creator>
      <pubDate>Fri, 31 May 2024 05:10:24 +0000</pubDate>
      <link>https://dev.to/ttapi/how-to-use-midjourney-api-by-python-1i3a</link>
      <guid>https://dev.to/ttapi/how-to-use-midjourney-api-by-python-1i3a</guid>
      <description>&lt;p&gt;Are you looking to integrate Midjourney’s cutting-edge AI image generation capabilities into your application or workflow? Look no further! While Midjourney does not provide direct API services, the TTAPI Platform brings you the ultimate solution to leverage all of Midjourney's powerful features seamlessly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Choose TTAPI for Midjourney Integration?&lt;/strong&gt;&lt;br&gt;
TTAPI offers a comprehensive set of services that mirror Midjourney’s functionality, making it easier than ever to incorporate these advanced tools into your projects. Here’s what sets &lt;a href="https://ttapi.io"&gt;TTAPI apart&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Complete Midjourney Functionality: Enjoy all the capabilities of Midjourney, including imagine, U, V, zoom, pan, vary, blend, describe, seed, and more.&lt;/li&gt;
&lt;li&gt;Full Command Support: Utilize all Midjourney commands such as --v, --cref, --ar, and more.&lt;/li&gt;
&lt;li&gt;Webhook and Status Interaction: Get real-time updates on task status through webhook callbacks and active query features.&lt;/li&gt;
&lt;li&gt;Generous Free Quota: New users receive 30 credits, allowing for 10 free requests to the imagine endpoint.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to Get Started&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Register on TTAPI: Visit &lt;a href="https://ttapi.io/register"&gt;TTAPI Registration&lt;/a&gt; and use your own github or google account to registration.&lt;/li&gt;
&lt;li&gt;Access Your &lt;strong&gt;TT-API-Key&lt;/strong&gt;: Find your TT-API-KEY in the dashboard after successful activation.&lt;/li&gt;
&lt;li&gt;Start Using the API: Integrate the Midjourney capabilities into your application with our easy-to-use endpoints.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example Imagine endpoint For Python&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import requests

endpoint = "https://api.ttapi.io/midjourney/v1/imagine"

headers = {
     "TT-API-KEY": your_key
}

data = {
     "prompt": "a cute cat",
     "mode": "fast",
     "hookUrl": "",
     "timeout": 300
}

response = requests.post(endpoint, headers=headers, json=data)

print(response.status_code)
print(response.json())

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example Imagine endpoint Response&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "status": "SUCCESS",
    "message": "",
    "data": {
        "jobId": "afa774a3-1aee-5aba-4510-14818d6875e4"
     }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After submitting the image generation task using the &lt;strong&gt;&lt;a href="https://ttapi.io/docs/apiReference/midjourney#generate-imagine-"&gt;imagine endpoint&lt;/a&gt;&lt;/strong&gt;, you will get a jobId in response json, then use the &lt;strong&gt;&lt;a href="https://ttapi.io/docs/apiReference/midjourney#fetch-job"&gt;fetch endpoint&lt;/a&gt;&lt;/strong&gt; to get the task status&lt;/p&gt;

&lt;p&gt;Example Fetch Result For Python&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import requests
endpoint = "https://api.ttapi.io/midjourney/v1/fetch"
headers = {
    "TT-API-KEY": your_key
}
data = {
    "jobId": "afa774a3-1aee-5aba-4510-14818d6875e4", // You will get the jobId from the previous step by requesting the imagine endpoint
}
response = requests.post(endpoint, headers=headers, json=data)

print(response.status_code)
print(response.json())
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example Fetch Result Response&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "status": "SUCCESS",
    "jobId": "f5850038-90a3-8a97-0476-107ea4b8dac4",
    "message": "success",
    "data": {
        "actions": "imagine",
        "jobId": "f5850038-90a3-8a97-0476-107ea4b8dac4",
        "progress": "100",
        "prompt": "Soccer star Max Kruse and Jan-Peter Jachtmann victims of €528,695 poker scam, German soccer star Max Kruse and WSOP Main Event finalist Jan-Peter Jachtmann are among the players who have been swindled out of €528,695., poker, realistic --ar 1280:720",
        "discordImage": "https://cdn.discordapp.com/attachments/1107938555931656214/1176340921227423844/voyagel_Soccer_star_Max_Kruse_and_Jan-Peter_Jachtmann_victims_o_c513a87b-eed3-4a3b-ab97-6be4dbc3ea99.png?ex=656e83da&amp;amp;is=655c0eda&amp;amp;hm=6e06a1dec3c6c1be209799884681969878eabb81ce81f8db22d54480379fcd9b&amp;amp;",
        "cdnImage": "http://127.0.0.1/8080/pics/452020f2-6793-4525-a1b5-472cac439610.png",
        "hookUrl": "",
        "components": [
            "upsample1",
            "upsample2",
            "upsample3",
            "upsample4",
            "variation1",
            "variation2",
            "variation3",
            "variation4"
        ],
        "seed":"",
        "images":[
            "https://cdnb.ttapi.io/2024-04-02/27024084bcd54b1c38d085d11d8dc841037a2262ebeda29b3f67b741441f6736.png",
            "https://cdnb.ttapi.io/2024-04-02/e15e39f6eb39191fdf3f176f8c979b6e57254114a8bfea826e30f23850d0d485.png",
            "https://cdnb.ttapi.io/2024-04-02/4b7910497a0d79d0155cd8b33eea313425cf2b809efef4b6ba3960aa1c2bd484.png",
            "https://cdnb.ttapi.io/2024-04-02/98b162a1da713eef23c3cfd5f166aee8e4ee09f8cf1f7bbc24bf72990eb80adf.png"
        ]
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;TTAPI offers flexible billing options that align with your usage needs, whether you’re operating in fast, relax, or turbo mode. For detailed pricing, visit our Expense Document.&lt;/p&gt;

&lt;p&gt;Don’t miss out on the opportunity to enhance your projects with the incredible features of Midjourney through TTAPI. Start now and experience the future of AI-driven creativity!&lt;/p&gt;

&lt;p&gt;Learn More and &lt;a href="https://ttapi.io/docs#how-to-use"&gt;Get Started&lt;/a&gt; ​&lt;/p&gt;

</description>
      <category>midjourney</category>
      <category>midjourneyapi</category>
      <category>mjapi</category>
    </item>
    <item>
      <title>How to use Midjourney API</title>
      <dc:creator>luke</dc:creator>
      <pubDate>Mon, 25 Mar 2024 06:06:50 +0000</pubDate>
      <link>https://dev.to/ttapi/how-to-use-midjourney-api-3dof</link>
      <guid>https://dev.to/ttapi/how-to-use-midjourney-api-3dof</guid>
      <description>&lt;p&gt;Hello developers, this is a popular science document on how to use Midjourney API. If you have the same needs, congratulations, you finally have a suitable solution&lt;/p&gt;

&lt;p&gt;First of all, let me state that Midjourney does not officially provide any API services, so this is not the official API of Midjourney. This set of services was originally designed to solve our own needs. Later, we found that more and more companies and individuals had the same needs as us, and then we decided to develop such a set of products.&lt;/p&gt;

&lt;p&gt;Now I start to introduce how to use Midjourney Api in &lt;a href="https://ttapi.io"&gt;TTApi&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First of all&lt;/strong&gt;, the documentation of &lt;a href="https://docs.mjapiapp.com/reference/midjourney-api"&gt;Midjourney Api&lt;/a&gt; is shown in the figure below. You can take a look to see if there are functions that meet your needs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvdgy465q9w54d1m7dvvg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvdgy465q9w54d1m7dvvg.png" alt="Image description" width="800" height="348"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If there is a endpoint you need&lt;/strong&gt;, please go to &lt;a href="https://ttapi.io/register"&gt;TTApi's registration page&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First step&lt;/strong&gt; Enter your email, password, and repeat the password to register&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3zbbz8znzht6gt23dksr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3zbbz8znzht6gt23dksr.png" alt="Image description" width="800" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Second step&lt;/strong&gt; Activate the account. After filling in the registration information, you will jump to the activation page, click the "Send Activate Email" button to send the activation email, and then you will find the activation link in your email, click and activate your account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6asw37yfzz0ksdsgnvff.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6asw37yfzz0ksdsgnvff.png" alt="Image description" width="800" height="251"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr2scg4s68y1kzp6q579t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr2scg4s68y1kzp6q579t.png" alt="Image description" width="800" height="310"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Third step&lt;/strong&gt; Using Midjourney Api, after activating the account, you will receive a TT-API-KEY with 100 quota in your email. &lt;/p&gt;

&lt;p&gt;Then you can use TT-API-KEY to access the &lt;a href="https://docs.mjapiapp.com/reference/midjourney-api"&gt;Midjourney API&lt;/a&gt; of the TTApi platform&lt;/p&gt;

&lt;p&gt;The following is a python example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import requests

endpoint = "https://api.ttapi.io/midjourney/v1/imagine"

headers = {
    "TT-API-KEY": your_key
}

data = {
    "prompt": "a cute cat",
    "model": "fast",
    "hookUrl": ""
}

response = requests.post(endpoint, headers=headers, json=data)

print(response.status_code)
print(response.json())

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And for response&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "status": "SUCCESS",
  "message": "",
  "data": {
    "jobId": "afa774a3-1aee-5aba-4510-14818d6875e4"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you can get the status of the task through the webhook address set in your request or the &lt;a href="https://docs.mjapiapp.com/reference/midjourney-api#fetch-job"&gt;fetch endpoint&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Support for other related endpoint, such as U1-U4, V1-V4, blend, etc., are described in detail in the &lt;a href="https://docs.mjapiapp.com/"&gt;document&lt;/a&gt;. The above is about the Midjourney Api if TTApi is used. If you have any usage questions or suggestions, you can leave a message to me. Thank you very much for taking your precious time to read this article. Have a good day D:)&lt;/p&gt;

</description>
      <category>midjourney</category>
      <category>midjourneyapi</category>
      <category>mjapi</category>
      <category>python</category>
    </item>
  </channel>
</rss>
