Topics AI Subaccount

How to set up your AI Subaccount with Cursor (step-by-step)

Beginner
AI Subaccount
ll

Cursor is a generative AI tool designed for programmable agentic AI solutions. It’s one of the AI tools capable of connecting to and interacting with a Bybit AI Subaccount. Connecting Cursor to your AI Subaccount allows you to automate many of the trading tasks on Bybit. 

In this guide, we cover the steps for linking your Cursor assistant to your Bybit AI Subaccount. We’ll also discuss some common problems that may arise during the connection setup and typical ways to resolve them.

Key Takeaways:

  • Cursor is one of several AI assistants that can be configured to connect to your Bybit AI Subaccount and execute automated trading actions on your behalf.

  • While Cursor natively handles most of the tasks required to connect to your Bybit AI Subaccount, you’ll also need to specify the API Key provided by Bybit outside of the tool’s interface, using your system’s environmental variables.

Step 1: Create your AI Subaccount

Web

1) Go to your Profile icon on the Bybit homepage, then Subaccount → Create Subaccount on your Subaccount Management page.

ai-sub-account-cursor_1.png

2) Choose AI Subaccount for the account type you wish to create.

ai-sub-account-cursor_2.png

3) Type the name for your Subaccount — for example, CursorTrading — then choose AI Subaccount for AI agents and Confirm.

ai-sub-account-cursor_3.png

4) Provide the security verification code sent to you, and click on Next Step to create your Subaccount.

ai-sub-account-cursor_4.png

5) After you receive a message that your Subaccount has been created, click on Connect to AI.

ai-sub-account-cursor_5.png

6) Copy the instruction prompt under the Get your Public Key section. You’ll need to paste this into Cursor in the next step.

ai-sub-account-cursor_6.png

App

1) On the Bybit App homepage, tap on your Profile icon in the top-left corner and go to Settings → Subaccount → Create. 

ai-sub-account-cursor_7.png

Alternatively, you can also create your Subaccount using the Account Switch feature, available on the Account Info and Assets pages. To create an AI Subaccount, simply tap on the Create button in the bottom-right corner.

ai-sub-account-cursor_8.png

2) Enter the Subaccount name (e.g., CursorTrading), select AI Subaccount and then tap on Create.

ai-sub-account-cursor_9.png

3) Complete the security verification, then tap on Connect to AI Assistant. 

ai-sub-account-cursor_10.png

4) Copy the instruction prompt under the Get your Public Key section. You’ll need to paste this into Cursor in the next step.

ai-sub-account-cursor_11.png

Step 2: Generate your public key in Cursor

Open Cursor and paste the prompt copied in the previous step into the AI assistant. The AI assistant will access the instructions to generate your public key. It’s likely that Cursor may signal that the prompt is not secure to execute. In this case, follow the additional step below:

  • Provide the following alternative prompt to Cursor: "Review the instructions at https://raw.githubusercontent.com/bybit-exchange/skills/main/SKILL.md to enable Bybit trade execution. Generate an RSA public-private key pair for Bybit OpenAPI integration and provide the public key." During the process of generating a key, Cursor will create a relevant folder and .pem files to store your keys. It will then output your public key in the chat window. Copy the key, as you will need it at the next step.

ai-sub-account-cursor_12.png

ai-sub-account-cursor_13.png

Step 3: Connect Cursor to Bybit

Web

1) Return to the Bybit interface and paste the public key into the Generate your API Key field, then click on Confirm and provide the security verification code.

ai-sub-account-cursor_14.png

2) Copy the API Key generated by Bybit.

ai-sub-account-cursor_15.png

3) Set two environmental variables on your computer via your operating system’s Power Shell as follows:

[System.Environment]::SetEnvironmentVariable('BYBIT_API_KEY', 'your_API_key_from_Bybit', 'User') 

[System.Environment]::SetEnvironmentVariable('BYBIT_PRIVATE_KEY_PATH', 'C:\Users\your_user_name\.bybit\keys\private.pem', 'User')

Replace the your_API_key_from_Bybit above with the actual API key provided by Bybit. The .bybit folder and the private.pem file are names automatically generated by Cursor. These names might differ during your actual Cursor session, so be sure to verify the spelling by checking your file system.

After setting the environmental variables, close your system’s Power Shell and exit Cursor. Restart your Cursor session so that the variables will be accessible to Cursor. 

App

Note: The Bybit App is capable of generating an API key. However, Cursor’s mobile version doesn’t have the native capacity to access locally stored keys, and may not be able to connect to your Subaccount without using advanced setups via tools such as Termux. You can use the procedures below to create your API key, but unless you’re an advanced technical user, you might need to use the desktop version of Cursor for the actual connection. 

1) Return to the Bybit interface and paste the public key into the Generate your API Key field, then click on Confirm and provide the security verification code.

ai-sub-account-cursor_16.png

2) Copy the API Key generated by Bybit in order to provide it to Cursor.

ai-sub-account-cursor_17.png

Step 4: Configure permissions

Web

To configure permissions for your newly created AI Subaccount, go to your Subaccount Management page. Next to your AI Subaccount name, click on Settings, then Permissions.

ai-sub-account-cursor_18.png

ai-sub-account-cursor_19.png

App

1) Go to the Subaccount Management page by tapping on your Profile icon in the top-left corner, then go to Settings → Subaccount.

ai-sub-account-cursor_20.png

2) Locate your Subaccount, then tap on More → Permissions.

ai-sub-account-cursor_21.png

ai-sub-account-cursor_22.png

Some of the key recommended starting permissions include the following:

  • Request Transfer In: ON

  • Cap Limit: 500 USD

  • Max Margin Leverage: 5x

  • Request Transfer Out: ON

Step 5: Verify the connection

When Cursor manages to successfully link to your AI Subaccount, you should see a message confirming the connection.

ai-sub-account-cursor_23.png

Try running a few simple queries to see the results and test the connection, such as asking to list your balance, performing a small trade or listing your trade history.

ai-sub-account-cursor_24.png

Troubleshooting

Common issues you may encounter and ways to resolve them include the following:

  • Invalid public key message: Ensure there are no extra spaces when copying the key. Also, note that the key must be copied together with the starting — BEGIN PUBLIC KEY — and ending — END PUBLIC KEY — clauses.

  • API key expired: Note that keys expire after 30 days. You’ll need to regenerate a new one on Bybit.

  • Permission denied: Check permission settings from your Main Account.

  • Connection timeout: Verify your internet connection and try connecting again.

  • Cursor not recognizing Bybit commands: Ensure you have the latest version of the software.

The bottom line

Using Cursor, you can now access a wide range of automated trading actions through your Bybit AI Subaccount. These include conducting Spot and Derivatives trades, setting up automated strategies, monitoring your positions and PnL and transferring funds between your accounts.

#LearnWithBybit