curl --request POST \
--url https://api.venice.ai/api/v1/api_keys/generate_web3_key \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"apiKeyType": "ADMIN",
"address": "0x45B73055F3aDcC4577Bb709db10B19d11b5c94eE",
"signature": "0xbb5ff2e177f3a97fa553057864ad892eb64120f3eaf9356b4742a10f9a068d42725de895b5e45160b679cbe6961dc4cb552ba10dc97bdd8258d9154810785c451c",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"consumptionLimit": {
"usd": 50,
"diem": 10,
"vcu": 30
},
"limitPeriod": "MONTH",
"description": "Web3 API Key",
"expiresAt": "2023-10-01T12:00:00.000Z"
}
'import requests
url = "https://api.venice.ai/api/v1/api_keys/generate_web3_key"
payload = {
"apiKeyType": "ADMIN",
"address": "0x45B73055F3aDcC4577Bb709db10B19d11b5c94eE",
"signature": "0xbb5ff2e177f3a97fa553057864ad892eb64120f3eaf9356b4742a10f9a068d42725de895b5e45160b679cbe6961dc4cb552ba10dc97bdd8258d9154810785c451c",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"consumptionLimit": {
"usd": 50,
"diem": 10,
"vcu": 30
},
"limitPeriod": "MONTH",
"description": "Web3 API Key",
"expiresAt": "2023-10-01T12:00:00.000Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
apiKeyType: 'ADMIN',
address: '0x45B73055F3aDcC4577Bb709db10B19d11b5c94eE',
signature: '0xbb5ff2e177f3a97fa553057864ad892eb64120f3eaf9356b4742a10f9a068d42725de895b5e45160b679cbe6961dc4cb552ba10dc97bdd8258d9154810785c451c',
token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',
consumptionLimit: {usd: 50, diem: 10, vcu: 30},
limitPeriod: 'MONTH',
description: 'Web3 API Key',
expiresAt: '2023-10-01T12:00:00.000Z'
})
};
fetch('https://api.venice.ai/api/v1/api_keys/generate_web3_key', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.venice.ai/api/v1/api_keys/generate_web3_key",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'apiKeyType' => 'ADMIN',
'address' => '0x45B73055F3aDcC4577Bb709db10B19d11b5c94eE',
'signature' => '0xbb5ff2e177f3a97fa553057864ad892eb64120f3eaf9356b4742a10f9a068d42725de895b5e45160b679cbe6961dc4cb552ba10dc97bdd8258d9154810785c451c',
'token' => 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',
'consumptionLimit' => [
'usd' => 50,
'diem' => 10,
'vcu' => 30
],
'limitPeriod' => 'MONTH',
'description' => 'Web3 API Key',
'expiresAt' => '2023-10-01T12:00:00.000Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.venice.ai/api/v1/api_keys/generate_web3_key"
payload := strings.NewReader("{\n \"apiKeyType\": \"ADMIN\",\n \"address\": \"0x45B73055F3aDcC4577Bb709db10B19d11b5c94eE\",\n \"signature\": \"0xbb5ff2e177f3a97fa553057864ad892eb64120f3eaf9356b4742a10f9a068d42725de895b5e45160b679cbe6961dc4cb552ba10dc97bdd8258d9154810785c451c\",\n \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\",\n \"consumptionLimit\": {\n \"usd\": 50,\n \"diem\": 10,\n \"vcu\": 30\n },\n \"limitPeriod\": \"MONTH\",\n \"description\": \"Web3 API Key\",\n \"expiresAt\": \"2023-10-01T12:00:00.000Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.venice.ai/api/v1/api_keys/generate_web3_key")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"apiKeyType\": \"ADMIN\",\n \"address\": \"0x45B73055F3aDcC4577Bb709db10B19d11b5c94eE\",\n \"signature\": \"0xbb5ff2e177f3a97fa553057864ad892eb64120f3eaf9356b4742a10f9a068d42725de895b5e45160b679cbe6961dc4cb552ba10dc97bdd8258d9154810785c451c\",\n \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\",\n \"consumptionLimit\": {\n \"usd\": 50,\n \"diem\": 10,\n \"vcu\": 30\n },\n \"limitPeriod\": \"MONTH\",\n \"description\": \"Web3 API Key\",\n \"expiresAt\": \"2023-10-01T12:00:00.000Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.venice.ai/api/v1/api_keys/generate_web3_key")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"apiKeyType\": \"ADMIN\",\n \"address\": \"0x45B73055F3aDcC4577Bb709db10B19d11b5c94eE\",\n \"signature\": \"0xbb5ff2e177f3a97fa553057864ad892eb64120f3eaf9356b4742a10f9a068d42725de895b5e45160b679cbe6961dc4cb552ba10dc97bdd8258d9154810785c451c\",\n \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\",\n \"consumptionLimit\": {\n \"usd\": 50,\n \"diem\": 10,\n \"vcu\": 30\n },\n \"limitPeriod\": \"MONTH\",\n \"description\": \"Web3 API Key\",\n \"expiresAt\": \"2023-10-01T12:00:00.000Z\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"apiKey": "<string>",
"apiKeyType": "ADMIN",
"consumptionLimit": {
"usd": 50,
"diem": 10,
"vcu": 30
},
"limitPeriod": "MONTH",
"expiresAt": "2023-10-01T12:00:00.000Z",
"id": "e28e82dc-9df2-4b47-b726-d0a222ef2ab5",
"description": "Example API Key"
},
"success": true
}Genera API key con wallet Web3
Authenticates a wallet holding sVVV and creates an API key.
curl --request POST \
--url https://api.venice.ai/api/v1/api_keys/generate_web3_key \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"apiKeyType": "ADMIN",
"address": "0x45B73055F3aDcC4577Bb709db10B19d11b5c94eE",
"signature": "0xbb5ff2e177f3a97fa553057864ad892eb64120f3eaf9356b4742a10f9a068d42725de895b5e45160b679cbe6961dc4cb552ba10dc97bdd8258d9154810785c451c",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"consumptionLimit": {
"usd": 50,
"diem": 10,
"vcu": 30
},
"limitPeriod": "MONTH",
"description": "Web3 API Key",
"expiresAt": "2023-10-01T12:00:00.000Z"
}
'import requests
url = "https://api.venice.ai/api/v1/api_keys/generate_web3_key"
payload = {
"apiKeyType": "ADMIN",
"address": "0x45B73055F3aDcC4577Bb709db10B19d11b5c94eE",
"signature": "0xbb5ff2e177f3a97fa553057864ad892eb64120f3eaf9356b4742a10f9a068d42725de895b5e45160b679cbe6961dc4cb552ba10dc97bdd8258d9154810785c451c",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"consumptionLimit": {
"usd": 50,
"diem": 10,
"vcu": 30
},
"limitPeriod": "MONTH",
"description": "Web3 API Key",
"expiresAt": "2023-10-01T12:00:00.000Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
apiKeyType: 'ADMIN',
address: '0x45B73055F3aDcC4577Bb709db10B19d11b5c94eE',
signature: '0xbb5ff2e177f3a97fa553057864ad892eb64120f3eaf9356b4742a10f9a068d42725de895b5e45160b679cbe6961dc4cb552ba10dc97bdd8258d9154810785c451c',
token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',
consumptionLimit: {usd: 50, diem: 10, vcu: 30},
limitPeriod: 'MONTH',
description: 'Web3 API Key',
expiresAt: '2023-10-01T12:00:00.000Z'
})
};
fetch('https://api.venice.ai/api/v1/api_keys/generate_web3_key', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.venice.ai/api/v1/api_keys/generate_web3_key",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'apiKeyType' => 'ADMIN',
'address' => '0x45B73055F3aDcC4577Bb709db10B19d11b5c94eE',
'signature' => '0xbb5ff2e177f3a97fa553057864ad892eb64120f3eaf9356b4742a10f9a068d42725de895b5e45160b679cbe6961dc4cb552ba10dc97bdd8258d9154810785c451c',
'token' => 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',
'consumptionLimit' => [
'usd' => 50,
'diem' => 10,
'vcu' => 30
],
'limitPeriod' => 'MONTH',
'description' => 'Web3 API Key',
'expiresAt' => '2023-10-01T12:00:00.000Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.venice.ai/api/v1/api_keys/generate_web3_key"
payload := strings.NewReader("{\n \"apiKeyType\": \"ADMIN\",\n \"address\": \"0x45B73055F3aDcC4577Bb709db10B19d11b5c94eE\",\n \"signature\": \"0xbb5ff2e177f3a97fa553057864ad892eb64120f3eaf9356b4742a10f9a068d42725de895b5e45160b679cbe6961dc4cb552ba10dc97bdd8258d9154810785c451c\",\n \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\",\n \"consumptionLimit\": {\n \"usd\": 50,\n \"diem\": 10,\n \"vcu\": 30\n },\n \"limitPeriod\": \"MONTH\",\n \"description\": \"Web3 API Key\",\n \"expiresAt\": \"2023-10-01T12:00:00.000Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.venice.ai/api/v1/api_keys/generate_web3_key")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"apiKeyType\": \"ADMIN\",\n \"address\": \"0x45B73055F3aDcC4577Bb709db10B19d11b5c94eE\",\n \"signature\": \"0xbb5ff2e177f3a97fa553057864ad892eb64120f3eaf9356b4742a10f9a068d42725de895b5e45160b679cbe6961dc4cb552ba10dc97bdd8258d9154810785c451c\",\n \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\",\n \"consumptionLimit\": {\n \"usd\": 50,\n \"diem\": 10,\n \"vcu\": 30\n },\n \"limitPeriod\": \"MONTH\",\n \"description\": \"Web3 API Key\",\n \"expiresAt\": \"2023-10-01T12:00:00.000Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.venice.ai/api/v1/api_keys/generate_web3_key")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"apiKeyType\": \"ADMIN\",\n \"address\": \"0x45B73055F3aDcC4577Bb709db10B19d11b5c94eE\",\n \"signature\": \"0xbb5ff2e177f3a97fa553057864ad892eb64120f3eaf9356b4742a10f9a068d42725de895b5e45160b679cbe6961dc4cb552ba10dc97bdd8258d9154810785c451c\",\n \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\",\n \"consumptionLimit\": {\n \"usd\": 50,\n \"diem\": 10,\n \"vcu\": 30\n },\n \"limitPeriod\": \"MONTH\",\n \"description\": \"Web3 API Key\",\n \"expiresAt\": \"2023-10-01T12:00:00.000Z\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"apiKey": "<string>",
"apiKeyType": "ADMIN",
"consumptionLimit": {
"usd": 50,
"diem": 10,
"vcu": 30
},
"limitPeriod": "MONTH",
"expiresAt": "2023-10-01T12:00:00.000Z",
"id": "e28e82dc-9df2-4b47-b726-d0a222ef2ab5",
"description": "Example API Key"
},
"success": true
}Creazione di API key per agenti autonomi
Consulta questa guida per imparare a usare questo endpoint.Autorizzazioni
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Corpo
The API Key type. Admin keys have full access to the API while inference keys are only able to call inference endpoints.
INFERENCE, ADMIN "ADMIN"
The wallet's address
"0x45B73055F3aDcC4577Bb709db10B19d11b5c94eE"
The token, signed with the wallet's private key
"0xbb5ff2e177f3a97fa553057864ad892eb64120f3eaf9356b4742a10f9a068d42725de895b5e45160b679cbe6961dc4cb552ba10dc97bdd8258d9154810785c451c"
The token obtained from https://api.venice.ai/api/v1/api_keys/generate_web3_key
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
The API Key consumption limits, evaluated against the window selected by limitPeriod.
Show child attributes
Show child attributes
{ "usd": 50, "diem": 10, "vcu": 30 }Reset window the consumption limits apply to. EPOCH resets every UTC day (legacy default). MONTH resets on the 1st of each UTC calendar month. LIFETIME never resets, so the limit acts as a permanent cap on the key.
EPOCH, MONTH, LIFETIME "MONTH"
The API Key description
"Web3 API Key"
The API Key expiration date. If not provided, the key will not expire.
"2023-10-01T12:00:00.000Z"
Questa pagina è stata utile?