AI Prativa – Smart Farming Assistant – OpenAI API Key Setup


Smart Farming Assistant -OpenAI API Key Setup

https://platform.openai.com/ 

API Key

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

Trying Out New API Key

#1 - Run this curl command in a terminal to generate a haiku for free using the gpt-5-nano model via the Responses API.
curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer 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" \
  -d '{
    "model": "gpt-5-nano",
    "input": "write a haiku about ai",
    "store": true
  }'
#2 - Install the OpenAI Node SDK and execute the code below to generate a haiku for free using the gpt-5-nano model via the Responses API.
npm install openai
import OpenAI from "openai";

const openai = new OpenAI({
  apiKey: "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",
});

const response = openai.responses.create({
  model: "gpt-5-nano",
  input: "write a haiku about ai",
  store: true,
});

response.then((result) => console.log(result.output_text));
#3 - Install the OpenAI Python SDK and execute the code below to generate a haiku for free using the gpt-5-nano model via the Responses API.
pip install openai
from openai import OpenAI

client = OpenAI(
  api_key="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"
)

response = client.responses.create(
  model="gpt-5-nano",
  input="write a haiku about ai",
  store=True,
)

print(response.output_text);

Leave a Reply

Your email address will not be published. Required fields are marked *