Complete the following 4 steps to set up your account and purchase your API:
If you have any questions about Aidge or require any assistance from us, please contact us via navigation bar or email us (aidge_support@service.alibaba.com).
Step 1: Account setup
Learn where to find your authentication key and how to access the Aidge API.
First, create a new Aidge developer account or sign in with an existing account.
Next, find your authentication key to access the API in the 'API Key' page in your workplace. It is important to keep your keys confidential. You should not use an API key in publicly-distributed code.
Step 2: Test your API request
We offer 1000 trial quota to help you familiarize and test how to use the Aidge API in your account. Check your trial quota in the 'Dashboard' page.
Whether you're new to exploring the capabilities of the Aidge API or have an established integration in a live setting, it's always strongly recommended to establish a secure testing environment to test features before going live.
Step 3: Make your first API request
Currently, it is recommended to invoke the services using the Java SDK. Aidge's SDK offers functionalities for API request encapsulation, digest signature, response parsing, and message listening. By utilizing this SDK, you can effortlessly make API calls, retrieve API results, and monitor real-time messages. Here is the download link for the SDK.Environmental dependencies for the JAVA SDK require Java SE/EE 1.5 or higher. The Python SDK requires Python 2.7 or above.
For other languages, you can use your own http client to invoke the services. More examples can be found in 'API Key' and our git repositories.
Below is a sample code. Please note: The API domain for the call is https://api.aidc-ai.com.
IopClient client = new IopClientImpl("https://api.aidc-ai.com", "your key", "your secret");
IopRequest request = new IopRequest();
// Adding this trial tag in header means using the trial resource to test,
// please remove this trial tag after you purchased the API
request.addHeaderParameter("x-iop-trial","true")
request.setApiName("/ai/image/cut/out");
request.addApiParameter("simplify", "true");
//adding parameters as in the api doc we provide etc. I only listed one for example
request.addApiParameter("backGroundType", "WHITE_BACKGROUND");
request.addApiParameter("targetHeight", "1000");
request.addApiParameter("targetWidth", "800");
request.addApiParameter("imageUrl", "https://ae01.alicdn.com/kf/Sa78257f1d9a34dad8ee494178db12ec8l.jpg");
IopResponse response = client.execute(request);
System.out.println(response.getBody());
import iop
client = iop.IopClient("https://api.aidc-ai.com", "your appKey", "your appSecret")
request = iop.IopRequest('/ai/image/cut/out')
request.set_protocol('GOP')
# Adding this trial tag in header means using the trial resource to test,
# please remove this ##trial tag after you purchased the API
request.add_header("x-iop-trial","true")
request.add_api_param('backGroundType', 'WHITE_BACKGROUND')
request.add_api_param('targetHeight', '1000')
request.add_api_param('targetWidth', '800')
request.add_api_param('imageUrl', 'https://ae01.alicdn.com/kf/Sa78257f1d9a34dad8ee494178db12ec8l.jpg')
response = client.execute(request)
print(response.type)
print(response.body)
package main
import (
"bytes"
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"fmt"
"io/ioutil"
"net/http"
"strings"
"time"
)
func main() {
// Your personal data
accessKeyName := "your access key name" // e.g. 512345
accessKeySecret := "your access key secret"
apiName := "api name" // e.g. ai/text/translation/and/polishment
apiDomain := "api domain" // e.g. api.aidc-ai.com or cn-api.aidc-ai.com
data := "{your api request params}"
// Basic URL (placeholders included)
urlTemplate := "https://%s/rest/%s?partner_id=aidge&sign_method=sha256&sign_ver=v2&app_key=%s×tamp=%s&sign=%s"
// Timestamp in milliseconds
timestamp := fmt.Sprintf("%d", time.Now().UnixNano()/int64(time.Millisecond))
// Calculate SHA256 HMAC
h := hmac.New(sha256.New, []byte(accessKeySecret))
h.Write([]byte(accessKeySecret + timestamp))
sign := strings.ToUpper(hex.EncodeToString(h.Sum(nil)))
// Create the final URL with real values
finalURL := fmt.Sprintf(urlTemplate, apiDomain, apiName, accessKeyName, timestamp, sign)
// Add "x-iop-trial": "true" for trial
headers := map[string]string{
"Content-Type": "application/json",
}
// Do HTTP POST request
response, err := makeRequest("POST", finalURL, data, headers)
if err != nil {
fmt.Printf("Error making request: %s\n", err)
return
}
fmt.Printf("Response: %s\n", response)
}
// makeRequest handles the HTTP request to the specified URL with the given data and headers
func makeRequest(method, url, data string, headers map[string]string) (string, error) {
client := &http.Client{}
req, err := http.NewRequest(method, url, bytes.NewBuffer([]byte(data)))
if err != nil {
return "", err
}
for key, value := range headers {
req.Header.Set(key, value)
}
resp, err := client.Do(req)
if err != nil {
return "", err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
}
return string(body), nil
}
curl -X POST 'https://[api domain]/rest/[api name]?partner_id=aidge&sign_method=sha256&sign_ver=v2&app_key=[you api key name]×tamp=[timestamp]&sign=[sha256 sign]' \
--header 'Content-Type: application/json' \
--data '{your api request params}'
Add --header 'x-iop-trial: true' for trial
[api domain]: API domain. e.g. "api.aidc-ai.com" or "cn-api.aidc-ai.com"
[api name]: API name. e.g. "ai/text/translation/and/polishment"
[you api key name]: Your api key name. e.g. "512345"
[timestamp]: Timestamp with millisecond. e.g. "1733194861440"
[sha256 sign]: Sign the secret+timestamp with your api key secret using HmacSHA256 algorithm. e.g. HmacSHA256(secret+timestamp, secret).toUpperCase()
Step 4: Purchase API
After logging into the Aidge workplace, you can purchase the API that you need from the API list.
After entering the API ordering page, click on the blue button 'Increase API usage' will redirect you to the cashier to start the binding and payment process.
Note: The website currently offers offers individual API resource packages on a subscription basis. If you have demands for bulk orders, Please contact us via navigation bar or email us (aidge_support@service.alibaba.com)
After completing the purchase, you can view the current order in the Order Management, and the API list will be credited with new API quota.