عرض الفئات

ChatGPT – AI Conversations in Scratch

💬 ChatGPT – AI Conversations in Scratch #

The ChatGPT extension brings the power of OpenAI’s language models directly into Scratch.
Create intelligent chatbots, build interactive storytelling projects, get coding help, generate creative content, and make AI-powered assistants – all with simple blocks that connect to OpenAI’s ChatGPT API.
Perfect for students, educators, and creators exploring AI.


🌟 Overview #

  • Real AI Conversations: Ask questions and get intelligent responses from OpenAI’s powerful language models.
  • Multiple Models: Choose from GPT-4o, GPT-4o-mini, and other models with different capabilities and speeds.
  • Customizable Personas: Set assistant names, roles (teacher, storyteller, robot, etc.), and custom personalities.
  • Context Memory: ChatGPT remembers the conversation history for natural, flowing interactions.
  • Fine-Tune Responses: Control answer length, creativity level, and response style.
  • Easy Setup: Just add your OpenAI API key and start chatting!

✨ Key Features #

  • Access to OpenAI’s latest ChatGPT models (GPT-4o-mini, GPT-4o, GPT-5-nano, etc.).
  • Automatic language detection – replies in the user’s language.
  • 6 preset persona roles: helper, robot, teacher, storyteller, kid, talking cat.
  • Custom persona text for unique character personalities.
  • Conversation memory – remembers your last 10 questions and answers for natural conversations.
  • Adjustable answer length (max tokens) and creativity (temperature).
  • Dynamic model listing – discover and use new models as OpenAI releases them.
  • Built-in safety checking – automatically blocks inappropriate content for kids.
  • Safe, brief, and kid-friendly default settings.
  • Smart error prevention – fixes common problems with API keys automatically.

🚀 How to Use #

  1. Go to: pishi.ai/play
  2. Open the Extensions section.
  3. Select the ChatGPT extension.
  4. Get an API Key:
    To use the ChatGPT extension, you need an OpenAI API key.
    Students: ask a parent or teacher to help you create an OpenAI account.

    • Go to: OpenAI Platform – API Keys
    • Sign in or create an account.
    • Open the “API Keys” page and click “Create new secret key”.
    • Copy the key (looks like sk-proj-...).
      Make sure there are no extra spaces when copying.
    • OpenAI may require adding billing information depending on your account type.
  5. set api key: Click on this block in Scratch. A prompt will appear – paste your API key and click OK.
  6. answer to: [TEXT]: Use this block, to ask ChatGPT anything!
  7. Customize (Optional): Set assistant name, role, persona, model, and response settings to create your perfect AI assistant.

Tips

  • Start with the default gpt-4o-mini model – it’s fast and affordable.
  • Keep questions clear and specific for better answers.
  • clear message logs:Use this block to start fresh conversations.
  • Experiment with different roles and personas to create unique characters.
  • Monitor your OpenAI usage to avoid unexpected costs – check the OpenAI Usage Dashboard.

🧱 Blocks and Functions #

 

💬 Main Interaction #

answer to: [TEXT]

Sends a question or message to ChatGPT and returns the AI’s response as text.
This is the core block for interacting with the AI – ask anything and get intelligent answers!

How it works:

  • Type your question or message in the [TEXT] field.
  • The extension checks your question to make sure it’s kid-friendly.
  • Your question is sent to OpenAI along with the recent conversation (so ChatGPT remembers what you talked about).
  • ChatGPT thinks about your question and creates an answer.
  • The answer is also checked to make sure it’s appropriate for kids.
  • You get the answer as text – you can make your sprite say it, display it, or use it however you want!
  • The conversation is saved automatically (your last 10 questions and answers) so ChatGPT can give better responses.

Examples:

  • answer to: [What is 5 + 3?] → ChatGPT replies: “8”
  • answer to: [Tell me a joke] → ChatGPT tells a short joke
  • answer to: [What fun Scratch project should I make?] → ChatGPT suggests a project idea

ملاحظة: This block requires a valid OpenAI API key. If no key is set, it returns:
“enter the api key obtained from the openai.com site”

 

last answer

Returns the most recent answer generated by ChatGPT without making a new API call.
This is useful when you need to access the previous answer multiple times in your project.

How it works:

  • Returns the text of the last answer from the “answer to:” block.
  • If no answer has been generated yet, it returns an empty string.
  • Does not make any API calls – it’s completely free and instant!
  • The value updates automatically each time you use the “answer to:” block.

Tip: Use this block to avoid unnecessary API calls when you need the same answer in multiple places in your code!

 


🎭 Persona & Role Customization #

set assistant name [TEXT]
Sets the display name for the AI assistant.
This affects how the AI introduces itself and how it behaves in conversations.
Default: بيشي.إي.آي

Examples:

  • set assistant name [Scratch Helper]
  • set assistant name [Professor Bot]
  • set assistant name [Felix the Cat]

Tip: Choose names that match your project’s theme or character!

 

act as [ROLE]
Sets the AI’s persona role from a menu of predefined options.
Each role changes how the AI communicates and responds.

Available Roles:

  • helper – Friendly assistant (default)
  • robot – Playful robot character
  • teacher – Patient Scratch teacher
  • storyteller – Creative story creator
  • kid – Friendly kid-like speech
  • talking-cat – Fun cat character from a Scratch project

Examples:

  • act as [teacher] → AI acts like a patient teacher explaining concepts clearly
  • act as [storyteller] → AI creates short, creative stories
  • act as [robot] → AI uses playful robot-like language

 

set persona [TEXT]
Adds custom personality instructions to the AI’s system prompt.
Use this for detailed character customization beyond the preset roles.
Limited to 500 characters for safety and performance.

How it works:

  • Type a brief description of the personality or behavior you want.
  • This text is appended to the system instructions, shaping the AI’s responses.
  • Keep it short and clear – the AI still follows safety rules and brevity guidelines.

Examples:

  • set persona [You are a pirate who loves treasure hunts]
  • set persona [You speak in rhymes and riddles]
  • set persona [You are enthusiastic about science experiments]

Tip: Combine with “set assistant name” and “act as” for rich, unique characters!

 


🤖 Model Selection #

set model [MODEL]
Chooses which OpenAI model to use for generating responses.
Different models have different capabilities, speeds, and costs.

Default Models:

  • gpt-4o-mini – Fast, affordable, great for most projects (default)
  • gpt-4.1-mini – Newer mini variant
  • gpt-4.1-nano – Very fast, minimal model
  • gpt-4o – More powerful, better reasoning, higher quality responses
  • gpt-5-nano – Very fast next-generation nano model with advanced reasoning capabilities

Note about GPT-5 models: GPT-5 models “think” before answering, which uses up some of the token limit. Don’t worry – the extension automatically gives these models extra space (×2 tokens, at least 240) so you still get complete answers!
ملاحظة: The list of models shown here can change. When you use the “update available models” block, the extension updates the model dropdown with the latest chat-compatible models from OpenAI – including newly released ones.

How to choose:

  • For everyday chatbots, simple questions, and cost-effective projects, use: gpt-4o-mini
  • For deeper reasoning, more accurate answers, or more detailed explanations, use: gpt-4.1-mini
  • For the latest models and pricing, check: OpenAI’s model documentation.

ملاحظة: Each model has different costs per token – monitor your usage to control expenses.

 

update available models, filter: [FILTER]
Fetches a list of available models from OpenAI and updates the model menu.
Returns a comma-separated list of models (up to 50) that match the filter.

How it works:

  • Queries the OpenAI API for all available models.
  • Filters out non-chat models (embeddings, audio, vision, moderation, etc.).
  • Optionally filters by a substring (e.g., “gpt-4” to see only GPT-4 models).
  • Returns the list as text and updates the model dropdown menu.

Examples:

  • update available models, filter: [gpt-4] → Lists all GPT-4 models
  • update available models, filter: [] → Lists all available chat models

Tip: Use this block at the start of your project to discover new models as OpenAI releases them!

 


⚙️ Response Configuration #

set max tokens [NUMBER]
Sets the maximum length of ChatGPT’s responses in tokens.
Tokens are word fragments – roughly 1 token = 0.75 words.

How it works:

  • Higher values = longer, more detailed answers.
  • Lower values = shorter, more concise answers.
  • Range: 1–2048 tokens (the extension keeps it within safe limits automatically).
  • Default: 360 tokens (~270 words) – keeps answers brief and kid-friendly.
  • GPT-5 Note: GPT-5 models use some tokens for internal “thinking,” which means they need a little extra max-token space to finish answers. This doesn’t make their responses longer – it just supports their reasoning. The extension automatically increases their limit (×2, minimum 240), but for very detailed answers you may still want to raise it further.

Examples:

  • set max tokens [50] → Very short answers (1–2 sentences)
  • set max tokens [200] → Moderate-length answers (a few sentences)
  • set max tokens [500] → Longer, detailed explanations

Tip: Shorter answers are faster, cheaper, and easier for kids to read!

 

answers type: [NUMBER]
Controls the creativity and randomness of ChatGPT’s responses (temperature setting).
Choose from a menu of preset styles or enter a custom value (0–2).

Options:

  • accurate (0) – Focused, consistent, predictable answers
  • normal (1) – Balanced creativity and accuracy (default)
  • creative (2) – More varied, imaginative, surprising responses

Examples:

  • answers type: [accurate] → Good for math, facts, consistent responses
  • answers type: [creative] → Good for storytelling, brainstorming, jokes

 

set timeout [NUMBER]
Sets the maximum time (in milliseconds) to wait for a response from OpenAI.
If the request takes longer, it will timeout and return an error.
Default: 30000 (30 seconds)

Examples:

  • set timeout [60000] → Wait up to 60 seconds
  • set timeout [15000] → Wait up to 15 seconds (faster failure for slow connections)

Tip: Longer timeouts are helpful for complex questions or slower internet connections.

 


🗑️ Conversation Management #

clear message logs
Clears the entire conversation history with ChatGPT.
Use this to start a fresh conversation without context from previous questions.

When to use:

  • Starting a new topic or conversation.
  • When ChatGPT seems confused or is talking about old stuff.
  • To give your assistant a “fresh start” for testing or demos.
  • When you’ve had a long conversation (the extension remembers your last 10 questions & answers, then starts forgetting older ones).

ملاحظة: Your assistant’s name, role, and personality stay the same – only the conversation memory is erased.

 


🔑 API Key Setup #

set api key
Opens a prompt to enter or update your OpenAI API key.
Your key is stored in the browser’s session storage (cleared when you close the tab).

How to use:

  • Click this block.
  • A text input prompt appears.
  • Paste your API key from OpenAI (starts with sk-proj-...).
  • Click OK to save.

Security Notes:

  • API keys are stored temporarily – only while your browser tab is open.
  • Keys are deleted when you close the browser tab.
  • Never share your API key publicly or in shared projects!
  • The extension automatically cleans up your API key – it removes invisible characters that sometimes get copied by accident.
  • Your key must use regular English letters and numbers only. If you paste something weird, you’ll get a friendly error message.
  • If you see an error about “invalid characters,” just copy the key again from OpenAI and paste it fresh.

Tip: Generate separate API keys for different projects to track usage and costs separately.

 


🎓 Educational Uses #

  • AI Literacy – Learn how AI models work, how prompts influence responses, and how to use AI responsibly.
  • Creative Learning – Build interactive tutors, storytellers, role-playing characters, and educational chatbots.
  • Language Skills – Practice real conversations in different languages with AI-driven characters.
  • API Understanding – Discover how Scratch connects to external services in a simple, visual way.
  • Physical Computing + AI:
    • Natural-Language Robot Control – Command robots using phrases like “drive in a square” or “wave hello.”
    • AI Decision Making – Combine sensors with ChatGPT so the robot decides what to do next.
    • Story-Acting Robots – ChatGPT writes scenes and the robot acts them out with motions or LEDs.

🎮 Example Projects #

– On-Screen Projects #

  • Interactive Storyteller – ChatGPT creates new story chapters based on player choices.
  • AI Quiz Generator – Endless trivia generated instantly during gameplay.
  • Creative Writing Partner – Get characters, worlds, and plot twists in seconds.
  • AI Dungeon Master – A full text-adventure narrator powered by ChatGPT.

– Physical Computing + ChatGPT #

  • AI Robot Assistant – Type or speak commands like “move forward slowly” or “spin like a dancer,” and the robot performs them.
  • Emotion-Aware Robot – ChatGPT interprets user messages and the robot reacts with gestures or LED mood colors.
  • Interactive Pet Robot – ChatGPT handles personality and dialogue while the robot moves or animates in response.
  • Adventure Robot – ChatGPT tells a story and the robot acts out moments with lights or movements.
  • AI Task Translator – High-level commands like “patrol the room” or “draw a square” are converted into step-by-step robot actions.

🧩 Try it yourself: pishi.ai/play

 


🔧 Tips and Troubleshooting #

 

💬 ChatGPT Specific Tips #

  • “Enter the api key” error? You need to set your OpenAI API key first – click “set api key” and paste your key from OpenAI Platform.
  • “API key contains invalid characters” error? Sometimes when you copy and paste, invisible characters sneak in! The extension checks for these automatically. Just go back to OpenAI, copy your key again carefully, and paste it fresh.
  • “Insufficient quota” error? Your OpenAI account ran out of money/credits. Add funds at OpenAI Billing or try a cheaper model like GPT-4o-mini.
  • “Let’s talk about coding and creativity instead!” This means your question or ChatGPT’s answer was flagged as not kid-friendly. Don’t worry – just ask something about coding, art, games, or stories instead!
  • “The answer was too long. Raise the max tokens and try again.” ChatGPT had more to say but ran out of space! Increase the max tokens setting to get longer answers.
  • Slow responses? GPT-4o is more powerful but slower. Try GPT-4o-mini for faster answers. Also check your internet connection.
  • Answers too long? Lower the max tokens (try 50–120 for short answers).
  • Answers too short? Increase the max tokens (try 200–500 for detailed responses). GPT-5 models use some tokens for “thinking,” so they might need a bit extra.
  • AI not following instructions? Try rephrasing your question or clearing message logs to start fresh.
  • Unexpected costs? Monitor usage at: OpenAI Usage Dashboard. Use GPT-4o-mini for cost-effective projects.
  • Context confusion? ChatGPT remembers your last 10 questions and answers. Use “clear message logs” to make it forget and start over.
  • Timeout errors? Increase the timeout value or check your internet connection. Complex questions may take longer.
  • Want more creative answers? Set answers type to “creative” or increase temperature.
  • Want consistent, factual answers? Set answers type to “accurate” or lower temperature.
  • Same question = same answer? If you ask the exact same thing twice in a row, the extension reuses the previous answer to save time and money. For short questions (3 words or less), this lasts 2 seconds. For longer questions, it lasts until you ask something different or change settings. Smart, right?
  • Need the last answer again? Use the “last answer” block to get the previous response without making a new API call – it’s free and instant!

🔒 Privacy and Safety #

  • Your API key is saved temporarily in your browser – it disappears when you close the tab.
  • All conversations are sent to OpenAI’s servers for processing – review: OpenAI’s Privacy Policy.
  • Conversation data may be used by OpenAI for model improvement unless you opt out in your OpenAI account settings.
  • Automatic Safety Checking: Both your questions and ChatGPT’s answers are checked to make sure everything is kid-friendly. Anything inappropriate gets blocked automatically – you’ll just see a message suggesting to talk about coding and creativity instead!
  • The extension is set up to give short, safe, kid-friendly answers by default.
  • Only your last 10 questions and answers are remembered, so conversations don’t get too long or confusing.
  • Always have a parent or teacher nearby when using AI tools – AI is smart but can still make mistakes!
  • Never share personal information (names, addresses, passwords) with AI chatbots.
  • Costs are charged to your OpenAI account – monitor usage to avoid unexpected bills.
  • API keys grant access to your OpenAI account – never share them publicly or in shared Scratch projects!

💰 Costs and Usage #

  • OpenAI charges per token (input + output). Check current pricing at: OpenAI Pricing.
  • GPT-4o-mini is the most affordable option – great for educational projects and experimentation.
  • GPT-4o is more expensive but provides higher quality responses for complex tasks.
  • Monitor your usage in real-time at: OpenAI Usage Dashboard.
  • Set usage limits in your OpenAI account settings to prevent overspending.
  • Use shorter max tokens to reduce costs per request.
  • Educational discounts or credits may be available – check OpenAI for educator programs.

🧪 Technical Info #

  • API: OpenAI Chat Completions API + Moderation API (for safety checking)
  • Default Models List: GPT-4o, GPT-4o-mini, GPT-4.1-mini, GPT-4.1-nano, GPT-5-nano
  • Default Model: gpt-4o-mini (fast, affordable, high quality)
  • Conversation Memory: Automatically remembers your last 10 questions and answers
  • Answer Caching: Repeated questions return cached answers instantly – short questions (≤3 words) cache for 2 seconds, longer questions cache indefinitely until changed
  • Max Tokens Range: 1–2048 (default: 360)
  • GPT-5 Smart Handling: These models need extra space for “thinking,” so the extension automatically doubles the tokens (minimum 240) to make sure you get complete answers
  • Temperature Range: 0–2 (default: 1 / “normal”)
  • Timeout: 30 seconds default (adjustable)
  • Language Detection: Automatic – ChatGPT replies in whatever language you use
  • Safety Settings: Built-in rules to keep answers short, safe, and perfect for kids
  • Safety Checking: Both your questions and ChatGPT’s answers are checked automatically (takes up to 10 seconds)
  • API Key Storage: Saved temporarily in your browser (deleted when you close the tab)
  • Smart Key Cleanup: Automatically removes invisible “junk” characters that sometimes sneak in when you copy/paste
  • Smart Answer Reuse: If you ask the same question twice in a row, you get the same answer instantly (saves time and money!)
  • Advanced Format Support: Works with all types of responses, including the special “reasoning” format from GPT-5 models
  • Internet Required: Yes – all requests are sent to OpenAI servers

🔗 Related Extensions #

  • 🎤 Speech Recognition – convert voice to text, then send to ChatGPT
  • 🔊 نص إلى كلام – speak ChatGPT’s responses out loud
  • 📝 الترجمة – translate ChatGPT responses between languages
  • 🖼️ Image Trainer – train custom models directly inside Scratch

📚 Learn More #


Scroll to Top