Home/Models/google/nano-banana-pro/edit

google/nano-banana-pro/edit

Commercial use

Table of contents

1. Calling the API

Setup your APl Key
Submit a request

2. Authentication

API Key

3. Queue

Submit a request
Fetch request status

4. Schema

Input
Output

1. Calling the API#

Setup your API Key#

Set SHORTAPI_KEY as an environment variable in your runtime.

export SHORTAPI_KEY="YOUR_API_KEY"

Submit a request#

The client API handles the API submit protocol. It will handle the request status updates and return the result when the request is completed.

response=$(curl --request POST \
  --url https://api.shortapi.ai/api/v1/job/create \
  --header "Authorization: Bearer $SHORTAPI_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "model": "",
    "args": {

    },
    "callback_url": "$CALLBACK_URL"
}')
JOB_ID=$(echo "$response" | grep -o '"job_id": *"[^"]*"' | sed 's/"job_id": *//; s/"//g')

callback_url: optional parameter, the result of the request will be sent to this address.The URL should accept POST requests

2. Authentication#

The API uses an API Key for authentication. It is recommended you set the SHORTAPI_KEY environment variable in your runtime when possible.

API Key#

Protect your API Key

When running code on the client-side (e.g. in a browser, mobile app or GUI applications), make sure to not expose your SHORTAPI_KEY. Instead, use a server-side proxy to make requests to the API.

3. Queue#

Long-running requests

For long-running requests, such as training jobs or models with slower inference times, it is recommended to check the Queue status and rely on Webhooks instead of blocking while waiting for the result.

Submit a request#

The client API provides a convenient way to submit requests to the model.

response=$(curl --request POST \
  --url https://api.shortapi.ai/api/v1/job/create \
  --header "Authorization: Bearer $SHORTAPI_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "model": "",
    "args": {

    },
    "callback_url": "$CALLBACK_URL"
}')
JOB_ID=$(echo "$response" | grep -o '"job_id": *"[^"]*"' | sed 's/"job_id": *//; s/"//g')

Fetch request status#

You can fetch the status of a request to check if it is completed or still in progress.

curl --request GET \
  --url "https://api.shortapi.ai/api/v1/job/query?id=$JOB_ID" \
  --header "Authorization: Bearer $SHORTAPI_KEY"

5. Schema#

Input#

{
    "model": "",
    "args": {

    },
    "callback_url": "$CALLBACK_URL"
}

Output#

result
object