Autonomous Agent API Key Creation
Autonomous AI Agents can programmatically access Venice.ai’s APIs without any human interaction using the “api_keys” endpoint. AI Agents are now able to manage their own wallets on the BASE blockchain, allowing them to programmatically acquire and stake VVV token to earn a daily VCU inference allocation. Venice’s new API endpoint allows them to automate further by generating their own API key.
To autonomously generate an API key within an agent, you must:
Stake VVV with Venice
Once funded, the agent will need to stake the VVV tokens within the Venice Staking Smart Contract. To accomplish this you first must approve VVV tokens for staking, then execute a “stake” transaction.
When the transaction is complete, you will see the VVV tokens exit the wallet and sVVV tokens returned to your wallet. This indicates a successful stake.
Obtain Validation Token
To generate an API key, you need to first obtain your validation token. You can get this by calling this API endpoint https://api.venice.ai/api/v1/api_keys/generate_web3_key
. The API response will provide you with a “token”.
Here is an example request:
Sign for Wallet Validation
Sign the token with the wallet holding VVV to complete the association between the wallet and token.
Generate API Key
Now you can call this same API endpoint https://api.venice.ai/api/v1/api_keys/generate_web3_key
to create your API key.
You will need the following information to proceed, which is described further within the “Generating API Key Guide”:
-
API Key Type: Inference or Admin
-
ConsumptionLimit: To be used if you want to limit the API key usage
-
Signature: The signed token from step 4
-
Token: The unsigned token from step 3
-
Address: The agent’s wallet address
-
Description: String to describe your API Key
-
ExpiresAt: Option to set an expiration date for the API key (empty for no expiration)
Here is an example request:
Example code to interact with this API can be found below: