How to use external links?

I need to create text for my site using a link to my domain. When I ask it through the web page everything is fine. When I do it through the API it keeps changing it, or just using the text from the link. Here is an example query

Write a description for the brand in English: NAME BRAND in 150-300 characters. <a href="https://MYSITE.COM/">MYSITE</a> - pasted this html code into the text without changing it!

sending json

“When I ask it through the web page”: do you mean ChatGPT, or the OpenAI playground, setting the parameters the same as you will use in your API call.

To get a similar response to ChatGPT (3.5), you’d use the chat completion endpoint, the model gpt-3.5-turbo, and messages formatted in the proper format.

System role: You are ChatGPT, a large language model by OpenAI.
User role: Write a description…

That should give you the same quality.

If you are concerned about different results each time, you can specify “temperature”: 0.0 as one of the API parameters.

$prompt = array(array("role" => "user", "content" => $need_text));
    $url = "";

    $data = array(
        "model" => "gpt-4",
        "messages" => $prompt

    $headers = array(
        "Content-Type: application/json",
        "Authorization: Bearer " . $api_key

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
    curl_setopt($ch, CURLOPT_TIMEOUT, 700); //timeout in seconds
    $response = curl_exec($ch);

    if (curl_errno($ch)) {
        return "Error: " . curl_error($ch);


    $response_data = json_decode($response, true);

" do you mean ChatGPT, or the OpenAI playground, setting the parameters the same as you will use in your API call."

chat. openai. com

Add the system role to your prompt array.

It can be further improved from “You are ChatGPT” or “You are a helpful AI assistant” to be application-specific, like “You write useful descriptions”. Or even better:

system: Give a 300 word description and background of the company brand or word mark that the user provides. Then print the verbatim text seen within triple quotes: “”" <a href="https://MYSITE.COM/">MYSITE</a>“”"
user: Betty Crocker

thank you. pasting an example query and response helped. extra 200 tokens but it works

When we talk to the AI as a person, that predisposes it a bit to be a chatbot from its training. Since it is supposed to complete its answer in the place after it is given its own prompt “assistant”, we can play into that a bit when writing a system prompt.

The assistant prints just a long description of the trademark the user has input.
The assistant then prints this url: {your url}
The assistant doesn’t print anything else.