POST
https://api.cryptohopper.com/v1/strategy/{strategy_id}/aigenerate
Asks an AI model to build a strategy config from a plain-language prompt and returns it. This uses the user's AI credits; the strategy itself is not changed.
When generation fails, for example because the user has too few AI credits, the endpoint still returns HTTP 200, with status 0 and an error message. An unknown or missing model falls back to the default model. To keep the result, save it with Update strategy. Needs a valid access token, but no specific scope.
Example request
curl -X POST "https://api.cryptohopper.com/v1/strategy/STRATEGY_ID/aigenerate" \
-H "access-token: YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"prompt":"Buy when the RSI on the 15 minute chart is oversold, sell when it is overbought","model":"google/gemini-2.5-flash-lite"}'
const response = await fetch('https://api.cryptohopper.com/v1/strategy/STRATEGY_ID/aigenerate', {
method: 'POST',
headers: {
"access-token": "YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"prompt": "Buy when the RSI on the 15 minute chart is oversold, sell when it is overbought",
"model": "google/gemini-2.5-flash-lite"
})
});
const data = await response.json();
import requests
response = requests.post(
"https://api.cryptohopper.com/v1/strategy/STRATEGY_ID/aigenerate",
headers={
"access-token": "YOUR_ACCESS_TOKEN"
},
json={
"prompt": "Buy when the RSI on the 15 minute chart is oversold, sell when it is overbought",
"model": "google/gemini-2.5-flash-lite"
},
)
data = response.json()
$ch = curl_init('https://api.cryptohopper.com/v1/strategy/STRATEGY_ID/aigenerate');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'access-token: YOUR_ACCESS_TOKEN',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'prompt' => 'Buy when the RSI on the 15 minute chart is oversold, sell when it is overbought',
'model' => 'google/gemini-2.5-flash-lite',
]),
]);
$data = json_decode(curl_exec($ch), true);
Parameters
Headers
| Name | Type | Required | Description |
|---|---|---|---|
access-token |
string | Required | The OAuth access token of the user. |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
strategy_id |
string | Required | ID of one of the user's own strategies. |
Response
{
"data": {
"status": 1,
"config": {
"strategy_config": [
{
"id": "121",
"name": "RSI with region crossovers (RSI)",
"type": "buy",
"params": {
"candle_value": {
"type": "select",
"name": "OHLCV Value",
"options": [
"open",
"close",
"high",
"low",
"volume"
],
"default": "close"
},
"period": {
"type": "number",
"step": 1,
"min": 1,
"max": 500,
"name": "RSI Period",
"default": 14
},
"oversold": {
"type": "number",
"step": 0.01,
"min": 0,
"max": 100,
"name": "Oversold threshold",
"default": 30
},
"overbought": {
"type": "number",
"step": 0.01,
"min": 0,
"max": 100,
"name": "Overbought threshold",
"default": 70
},
"region_type": {
"type": "select",
"name": "Signal on region",
"options": [
"in",
"out"
],
"default": "in"
}
},
"chartperiod": "900",
"candle_pattern": 0,
"necessary": 1,
"keep_signal": 0
}
],
"minimum_buy_signals": 1,
"minimum_sell_signals": 1,
"description": "Buys when the 15 minute RSI moves back out of the oversold region."
}
}
}