---
title: Midjourney Abbrevia prompt | RunAPI
description: Usa l'endpoint di abbreviazione del prompt per ricevere un risultato
  nella stessa risposta.
url: https://runapi.ai/it/docs/api/midjourney/shorten-prompt.md
canonical: https://runapi.ai/it/docs/api/midjourney/shorten-prompt
locale: it
---

> Versione HTML: https://runapi.ai/it/docs/api/midjourney/shorten-prompt
> Indice del sito per gli agenti: https://runapi.ai/llms.txt

# Midjourney Abbrevia prompt

## Panoramica

Usa l'endpoint di abbreviazione del prompt e leggi il risultato dalla stessa risposta.

### Avvio rapido

1. Crea una Chiave API e impostala come RUNAPI_API_KEY.
2. Invia una richiesta POST il cui corpo corrisponde allo schema della richiesta.
3. Leggi il risultato dal corpo della risposta positiva.

## Endpoint

POST /api/v1/midjourney/shorten_prompt

URL di base: https://runapi.ai

Versione API: v1

Autenticazione: Authorization: Bearer YOUR_API_TOKEN

## Modelli supportati

Apri la pagina di un modello per i prezzi correnti, i limiti di frequenza e i dettagli sull'uso commerciale.

- [Midjourney](https://runapi.ai/it/models/midjourney)

## Schema della richiesta

Invia solo i campi dichiarati per questo endpoint.

### Corpo della richiesta

```json
{
  "prompt": {
    "required": true,
    "type": "string"
  }
}
```

## Risposta di successo

HTTP 200 - POST /api/v1/midjourney/shorten_prompt

### Schema della risposta

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "prompts": {
      "items": {
        "type": "string"
      },
      "maxItems": 5,
      "minItems": 1,
      "type": "array"
    }
  },
  "required": [
    "prompts",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "prompts": [
    "Cinematic mountain landscape at sunrise.",
    "Mountain vista in warm morning light."
  ]
}
```

## Errori

HTTP 401 - POST /api/v1/midjourney/shorten_prompt

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "Authentication required"
}
```

## Errori

HTTP 400 - POST /api/v1/midjourney/shorten_prompt

### Schema della risposta

```json
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "Messaggio di errore leggibile.",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "Riepilogo di convalida leggibile dall'utente.",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "Messaggi di convalida con chiave per campo della richiesta pubblica, con un array di stringhe leggibili dall'utente per ogni campo.",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}
```

### Esempio di risposta

```json
{
  "error": "prompt is required"
}
```

## Errori

HTTP 402 - POST /api/v1/midjourney/shorten_prompt

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "Insufficient balance"
}
```

## Errori

HTTP 429 - POST /api/v1/midjourney/shorten_prompt

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "API key credit limit exceeded"
}
```

## Errori

HTTP 409 - POST /api/v1/midjourney/shorten_prompt

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "The request uses features that are not supported for the selected model"
}
```

## Errori

HTTP 429 - POST /api/v1/midjourney/shorten_prompt

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "Rate limit reached. Please retry later."
}
```

## Errori

HTTP 503 - POST /api/v1/midjourney/shorten_prompt

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "Service under maintenance, please try again later"
}
```

## Errori

HTTP 504 - POST /api/v1/midjourney/shorten_prompt

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "The request timed out"
}
```

## Errori

HTTP 400 - POST /api/v1/midjourney/shorten_prompt

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "Bad Request"
}
```

## Errori

HTTP 429 - POST /api/v1/midjourney/shorten_prompt

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "Too Many Requests"
}
```

## Errori

HTTP 500 - POST /api/v1/midjourney/shorten_prompt

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "Internal Server Error"
}
```

## Errori

HTTP 502 - POST /api/v1/midjourney/shorten_prompt

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "Bad Gateway"
}
```

## Esempi di Codice Generati

Usa cURL direttamente, oppure installa un SDK per il tuo linguaggio. Ogni esempio invia la richiesta validata mostrata in questo riferimento.

### curl

```curl
curl -X POST https://runapi.ai/api/v1/midjourney/shorten_prompt \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"prompt":"A detailed cinematic mountain landscape at sunrise."}'
```

### javascript

#### Installa

```bash
npm install @runapi.ai/midjourney
```

```javascript
import { MidjourneyClient } from "@runapi.ai/midjourney";

const client = new MidjourneyClient({ apiKey: process.env.RUNAPI_API_KEY });
const result = await client.shortenPrompt.run({
  "prompt": "A detailed cinematic mountain landscape at sunrise."
});
```

### python

#### Installa

```bash
pip install runapi-midjourney
```

```python
import os
from runapi.midjourney import MidjourneyClient

client = MidjourneyClient(api_key=os.environ["RUNAPI_API_KEY"])
result = client.shorten_prompt.run(
  prompt="A detailed cinematic mountain landscape at sunrise."
)
```

### go

#### Installa

```bash
go get github.com/runapi-ai/midjourney-sdk/go@latest
```

```go
package main

import (
  "context"
  "log"
  "os"

  "github.com/runapi-ai/core-sdk/go/option"
  midjourney "github.com/runapi-ai/midjourney-sdk/go/midjourney"
)

func main() {
  client, err := midjourney.NewClient(option.WithAPIKey(os.Getenv("RUNAPI_API_KEY")))
  if err != nil {
    log.Fatal(err)
  }

  result, err := client.ShortenPrompt.Run(context.Background(), midjourney.ShortenPromptParams{
    Prompt: "A detailed cinematic mountain landscape at sunrise.",
  })
  if err != nil {
    log.Fatal(err)
  }
  _ = result
}
```

### ruby

#### Installa

```bash
gem install runapi-midjourney
```

```ruby
require "runapi/midjourney"

client = RunApi::Midjourney::Client.new(api_key: ENV.fetch("RUNAPI_API_KEY"))
result = client.shorten_prompt.run(
  prompt: "A detailed cinematic mountain landscape at sunrise."
)
```

### java

#### Installa

```kotlin
implementation("ai.runapi:runapi-midjourney")
```

```java
import ai.runapi.midjourney.MidjourneyClient;
import ai.runapi.midjourney.types.ShortenPromptParams;
import ai.runapi.midjourney.types.ShortenPromptResponse;

public final class Example {
  public static void main(String[] args) {
    MidjourneyClient client = MidjourneyClient.builder()
        .apiKey(System.getenv("RUNAPI_API_KEY"))
        .build();
    ShortenPromptResponse result = client.shortenPrompt().run(
        ShortenPromptParams.builder()
        .prompt("A detailed cinematic mountain landscape at sunrise.")
            .build()
    );
  }
}
```

### php

#### Installa

```bash
composer require runapi-ai/midjourney
```

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use RunApi\Core\ClientOptions;
use RunApi\Midjourney\MidjourneyClient;

$client = new MidjourneyClient(new ClientOptions(apiKey: getenv('RUNAPI_API_KEY')));
$result = $client->shortenPrompt->run([
  "prompt" => "A detailed cinematic mountain landscape at sunrise."
]);
```

## Guide correlate

- [Autenticazione](https://runapi.ai/it/docs/guides/authentication.md)
- [Guida introduttiva](https://runapi.ai/it/docs/guides/task-api/quickstart.md)

---

## Altre risorse di RunAPI

- [Home](https://runapi.ai/it/.md)
- [Catalogo dei modelli](https://runapi.ai/it/models.md)
- [Prezzi](https://runapi.ai/it/pricing.md)
- [Fornitori](https://runapi.ai/it/models)
- [Documentazione](https://runapi.ai/it/docs/guides)
- [SDK](https://runapi.ai/it/sdk.md)
- [CLI](https://runapi.ai/it/cli.md)
- [MCP Server](https://runapi.ai/it/mcp.md)
- [Claude Code vs Cursor](https://runapi.ai/it/claude-code-vs-cursor.md)
- [Configurazione Cursor API](https://runapi.ai/it/cursor-api-setup.md)
- [RunAPI vs OpenRouter](https://runapi.ai/it/openrouter-alternative.md)
- [Enterprise](https://runapi.ai/it/contact.md)
- [Contatti](https://runapi.ai/it/contact.md)
- [Termini](https://runapi.ai/it/terms.md)
- [Privacy](https://runapi.ai/it/privacy.md)
- [Indice del sito per gli agenti](https://runapi.ai/llms.txt)

Contatti: contact@runapi.ai

## Dati strutturati

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "it",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/it",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/it/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "it",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/it",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/iticon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "it",
    "@type": "TechArticle",
    "headline": "Midjourney Abbrevia prompt",
    "description": "Usa l'endpoint di abbreviazione del prompt per ricevere un risultato nella stessa risposta.",
    "url": "https://runapi.ai/it/docs/api/midjourney/shorten-prompt",
    "mainEntityOfPage": "https://runapi.ai/it/docs/api/midjourney/shorten-prompt"
  }
]
```
