CosmoTalker ยท LLM Prompt Templates
Prompt the Machines.
Use these carefully crafted prompts with any LLM (ChatGPT, Claude, Gemini, DeepSeek, etc.) to instantly generate API integration code in your preferred language or framework.
01
Universal Prompt Template
Copy and paste this prompt into your favorite AI, replacing [YOUR_LANGUAGE_HERE].
Prompt Text
You are an expert developer. Generate code to call the CosmoTalker API:
API Endpoint: https://cosmotalker.onrender.com/api/get?q={query}
Requirements:
- Make a GET request to the API
- Handle the JSON response
- Extract and display the "data" field
- Include error handling
Generate code for: [YOUR_LANGUAGE_HERE]
The code should be complete, runnable, and include comments.
02
๐ค AI Playground - Quick Test
Try this comprehensive prompt with any LLM to build a full integration:
Prompt Text
Act as a senior developer. I need to integrate the CosmoTalker API
(https://cosmotalker.onrender.com/api/get?q={query}) into my [YOUR_PROJECT_TYPE]
using [YOUR_LANGUAGE].
Generate complete, working code that:
1. Takes user input for planet name
2. Calls the API
3. Handles errors gracefully
4. Displays the information beautifully
5. Includes comments explaining each step
My project: [DESCRIBE_YOUR_PROJECT]
Language: [YOUR_LANGUAGE]
03
Language-Specific Prompts
๐ Python
Prompt
Generate Python code using the requests library to call the CosmoTalker API at https://cosmotalker.onrender.com/api/get?q=mars
Requirements:
- Install requests if not present
- Make GET request with query parameter
- Parse JSON response
- Print the "data" field
- Add try/except error handling
- Include a function that takes a planet name as parameter
Make it production-ready with comments.
๐ JavaScript (Browser)
Prompt
Generate JavaScript code for a web browser to call the CosmoTalker API at https://cosmotalker.onrender.com/api/get?q=jupiter
Requirements:
- Use fetch() API
- Handle async/await
- Parse JSON response
- Display the "data" field in an HTML element
- Add loading state and error handling
- Include a function that can be called with different planet names
Make it ready to embed in any HTML page.
๐ Node.js
Prompt
Generate Node.js code using axios to call the CosmoTalker API at https://cosmotalker.onrender.com/api/get?q=saturn
Requirements:
- Use axios or node-fetch
- Async/await pattern
- Parse JSON response
- Console.log the "data" field
- Add error handling for network issues
- Export as a reusable module function
Include package.json dependencies.
๐ PHP
Prompt
Generate PHP code to call the CosmoTalker API at https://cosmotalker.onrender.com/api/get?q=venus
Requirements:
- Use file_get_contents() or cURL
- Handle JSON decoding
- Display the "data" field
- Add error handling for failed requests
- Create a reusable function
Make it compatible with PHP 7.4+.
โ Java
Prompt
Generate Java 17+ code to call the CosmoTalker API at https://cosmotalker.onrender.com/api/get?q=earth
Requirements:
- Use HttpClient (built-in)
- Make async GET request
- Parse JSON response
- Print the "data" field
- Add exception handling
- Create a complete class with main method
Include all necessary imports.
๐ท C# / .NET
Prompt
Generate C# .NET code to call the CosmoTalker API at https://cosmotalker.onrender.com/api/get?q=neptune
Requirements:
- Use HttpClient
- Async/await pattern
- Parse JSON using System.Text.Json
- Display the "data" field
- Add error handling
- Create a console application
Include using statements and Main method.
๐ต Go
Prompt
Generate Go code to call the CosmoTalker API at https://cosmotalker.onrender.com/api/get?q=pluto
Requirements:
- Use net/http package
- Define a struct for JSON response
- Make GET request
- Decode JSON response
- Print the "data" field
- Add error handling
Make it a complete main.go file.
๐ Bash / Shell
Prompt
Generate Bash script using cURL to call the CosmoTalker API at https://cosmotalker.onrender.com/api/get?q=mars
Requirements:
- Use curl with -s flag
- Parse JSON using jq (or python3 -m json.tool)
- Extract and display the "data" field
- Take planet name as command line argument
- Add error handling for missing jq
Make it executable with shebang.
๐ Swift
Prompt
Generate Swift code for iOS/macOS to call the CosmoTalker API at https://cosmotalker.onrender.com/api/get?q=jupiter
Requirements:
- Use URLSession
- Async/await (Swift 5.5+)
- Decode JSON using Codable
- Display the "data" field
- Add error handling
- Create a reusable function
Include necessary imports and example usage.
๐ฆ Rust
Prompt
Generate Rust code using reqwest to call the CosmoTalker API at https://cosmotalker.onrender.com/api/get?q=saturn
Requirements:
- Use reqwest and tokio
- Define struct for JSON response with serde
- Make async GET request
- Parse JSON response
- Print the "data" field
- Add error handling
Include Cargo.toml dependencies and main function.
๐ฑ Kotlin (Android)
Prompt
Generate Kotlin code for Android to call the CosmoTalker API at https://cosmotalker.onrender.com/api/get?q=earth
Requirements:
- Use Retrofit or Ktor
- Define data class for response
- Make network request
- Handle JSON response
- Display the "data" field
- Add error handling and coroutines
Include Gradle dependencies.
๐ด Ruby
Prompt
Generate Ruby code to call the CosmoTalker API at https://cosmotalker.onrender.com/api/get?q=venus
Requirements:
- Use net/http or httparty gem
- Parse JSON response
- Display the "data" field
- Add error handling
- Create a reusable method
Make it runnable as a script.
๐ PowerShell
Prompt
Generate PowerShell script to call the CosmoTalker API at https://cosmotalker.onrender.com/api/get?q=mercury
Requirements:
- Use Invoke-RestMethod
- Handle JSON response
- Display the "data" field
- Accept query as parameter
- Add error handling using try/catch
Make it cross-platform compatible (PowerShell 7+).
๐ท Dart (Flutter)
Prompt
Generate Dart code for Flutter to call the CosmoTalker API at https://cosmotalker.onrender.com/api/get?q=uranus
Requirements:
- Use http package
- Make GET request
- Parse JSON using dart:convert
- Display the "data" field
- Add async/await and error handling
- Create a Future function
Include pubspec.yaml dependencies.
04
๐ฏ Advanced Prompt Templates
Build a CLI Tool
Prompt
Generate a complete command-line interface (CLI) tool in [LANGUAGE] that:
- Accepts planet name as argument or interactive input
- Calls the CosmoTalker API
- Displays formatted output with colors
- Caches recent queries
- Handles network errors gracefully
API: https://cosmotalker.onrender.com/api/get?q={query}
Make it production-ready with help text.
Create a Web Widget
Prompt
Generate HTML/CSS/JavaScript code for an embeddable widget that:
- Shows a search box for planet names
- Calls the CosmoTalker API
- Displays results with cosmic styling
- Shows loading animation
- Works on any website
API: https://cosmotalker.onrender.com/api/get?q={query}
Make it responsive and dark-themed.
Build a Discord Bot
Prompt
Generate Discord bot code in [LANGUAGE] that:
- Responds to !space [planet] command
- Calls the CosmoTalker API
- Formats response as Discord embed
- Handles rate limiting
- Includes error messages
API: https://cosmotalker.onrender.com/api/get?q={query}
Use discord.js (Node.js) or nextcord (Python).
Create a Telegram Bot
Prompt
Generate Telegram bot code in [LANGUAGE] that:
- Responds to /planet [name] command
- Calls the CosmoTalker API
- Returns formatted message with planet info
- Supports inline queries
- Handles API failures
API: https://cosmotalker.onrender.com/api/get?q={query}
Use python-telegram-bot or node-telegram-bot-api.
Build a Mobile App UI
Prompt
Generate React Native / Flutter code that:
- Has a search screen for planets
- Calls the CosmoTalker API
- Displays results with images/animations
- Saves recent searches
- Handles offline states
API: https://cosmotalker.onrender.com/api/get?q={query}
Make it production-ready with error boundaries.
05
๐ก Quick AI Code Generation Examples
| Task | Sample Prompt |
|---|---|
| Simple GET | "Write [LANGUAGE] code to GET planet data from https://cosmotalker.onrender.com/api/get?q=mars and print the response" |
| With Error Handling | "Add retry logic and timeout to the [LANGUAGE] code calling CosmoTalker API" |
| Async Version | "Convert the CosmoTalker API call to async/await in [LANGUAGE]" |
| With Caching | "Add file-based caching to the [LANGUAGE] code so repeated queries for same planet are instant" |
| CLI with Args | "Modify the [LANGUAGE] code to accept planet name as command-line argument" |
| JSON Pretty Print | "Format the API response as pretty-printed JSON in [LANGUAGE]" |
| Add Headers | "Add custom User-Agent header to the [LANGUAGE] request" |
| Batch Queries | "Write [LANGUAGE] code to query multiple planets: Mars, Jupiter, Saturn and compare their data" |