GPT API

Access the GPT endpoint by sending a POST request to: https://www.jblanked.com/news/api/gpt/

Include a "content" key in your request body with your query as the value.

Pricing: 5 credits per POST request. GET requests are free. Purchase credits on our billing page and monitor usage here.

How it works:

  1. Send a POST request with your query. You'll receive a JSON response containing a "task_id" and a "message" confirming the task has started.
  2. Retrieve the response by sending a GET request to: https://www.jblanked.com/news/api/gpt/status/YOUR-TASK-ID

{
  "content": "In less than 8 words, what does bullish mean?"
}

{
  "status": "complete",
  "message": "Expecting rising prices or market growth."
}


Code Examples

url = "https://www.jblanked.com/news/api/gpt/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Api-Key YOUR-API-KEY"
}
data = {"content": "In less than 8 words, what does bullish mean?"}
response = requests.post(url, headers=headers, json=data)

if response.status_code == 200:
    task_id = response.json()["task_id"]
    print(task_id)
struct GPTResponsePost: Decodable {
    var task_id: String
    var message: String
}

let baseURL: String = "https://www.jblanked.com/news/api/gpt/mobile/"
var components = URLComponents(string: baseURL)
components?.queryItems = [
    URLQueryItem(name: "message", value: "In less than 8 words, what does bullish mean?")
]

if let url = components?.url {
    var request = URLRequest(url: url)
    request.addValue("Api-Key YOUR-API-KEY", forHTTPHeaderField: "Authorization")
    request.addValue("application/json", forHTTPHeaderField: "Content-Type")

    do {
        let (dataReturned, _) = try await URLSession.shared.data(for: request)
        let decoder = JSONDecoder()
        let response = try decoder.decode(GPTResponsePost.self, from: dataReturned)
        
        print(response.task_id)
    } catch {
        print("Error has occurred: \(error)")
    }
}
#include <jb-requests.mqh> 
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   CRequests request;
   request.url = "https://www.jblanked.com/news/gpt/";
   request.key = "YOUR_API_KEY";
   request.loader["content"] = "What does bullish mean?"

   if(!request.POST())
     {
      Print("Failed to send GPT request");
      return INIT_FAILED;
     }
   
   // Print result
   Print(request.result);

   // Or use the JSON data
   string taskID = request.loader["task_id"].ToStr();
   
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+


Library Usage

from jb_news.news import CJBNews 

jb = CJBNews()
api_key = "YOUR_API_KEY_HERE" 
gpt_response = jb.GPT(api_key, "What does bullish mean in forex?")
print(gpt_response)
import JBNews

let yourAPIKey: String = "YOUR-API-KEY"
let newsModel = JBNews(yourAPIKey)

Task {
    let messageResponse: String = await newsModel.gpt(message: "In less than 8 words, what does bullish mean?")
    print(messageResponse)
}
// MQL library usage is not available yet.
🤖 Ready to integrate AI-powered sentiment analysis into your trading app?

Get instant access to GPT-powered forex insights and predictions.