CosmoTalker · REST API + Python Library · Docs
Talk to the Cosmos.
Award-winning offline-first Python library and REST API for astronomy. Access planets, satellites, SpaceX launches, NASA APOD, and real-time space data — all from one import.
50K+
Downloads
v2.62
Latest Version
0.0008s
Offline Speed
🏆
YASSC 2025
GET
cosmotalker.onrender.com/api/get?q={query}
00
Python Library
$ pip install cosmotalker==2.62
Quick Start
import cosmotalker
# ── Offline Core ────────────────────────────
print(cosmotalker.get("earth")) # Planet data (offline)
print(cosmotalker.get("gravity")) # Deep science query
print(cosmotalker.get("black hole")) # Cosmic phenomena
# ── Online Features ─────────────────────────
cosmotalker.apod() # NASA Astronomy Picture of the Day
cosmotalker.spacex() # SpaceX upcoming launches
cosmotalker.celestrak() # Live satellite tracking
cosmotalker.wiki("black hole") # Wikipedia summary
cosmotalker.search("yt") # Opens YouTube
# ── AI Chat ─────────────────────────────────
cosmotalker.chat() # Interactive chatbot (oolit ML model)
cosmotalker.oolit() # Fine-tuned astronomy AI
# ── Extras ──────────────────────────────────
cosmotalker.img() # Image viewer (Beta)
cosmotalker.feedback() # Send feedback
cosmotalker.get("query")
● OFFLINE
Instant space data with ~0.0008s response. Covers planets, moons, galaxies, black holes, scientific concepts, and astronaut bios. The core offline knowledge base.
cosmotalker.apod()
● ONLINE
Fetches NASA's Astronomy Picture of the Day with title, explanation, and HD image URL. Refreshes daily with breathtaking deep-space imagery.
cosmotalker.spacex()
● ONLINE
Live SpaceX mission data — upcoming launches, rocket details, launchpad info, and mission status. Powered by the SpaceX public API.
cosmotalker.wiki("topic")
● ONLINE
Pulls a Wikipedia summary for any space or astronomy topic. Great for expanding beyond the offline knowledge base with full encyclopedic coverage.
cosmotalker.search("yt")
● ONLINE
Eco-friendly Ecosia web search + shortcut launcher. Shortcuts:
yt YouTube, wa WhatsApp, gpt ChatGPT, insta, fb, and more.cosmotalker.celestrak()
● ONLINE
Real-time satellite tracking using CelesTrak data. Locate active satellites, the ISS, and space debris with up-to-date orbital parameters.
cosmotalker.chat()
● ONLINE
Interactive chatbot powered by Oolit — a custom ML model fine-tuned with LoRA on space-domain datasets for high-precision astronomy reasoning.
cosmotalker.img()
◐ BETA
Advanced image preview tool for astronomy visuals. Enhanced with high-res download options. Part of the v2 feature expansion.
Python · Detailed Usage
import cosmotalker
# ── offline .get() — the core function ──────
earth = cosmotalker.get("earth")
print(earth)
# Query any celestial body or phenomenon
for topic in ["mars", "saturn rings", "neutron star", "yuri gagarin"]:
result = cosmotalker.get(topic)
print(f"\n{topic.upper()}:\n{result}")
# ── APOD — NASA image of the day ────────────
apod_data = cosmotalker.apod()
# Returns title, url, explanation, date
# ── SpaceX — upcoming launches ───────────────
launches = cosmotalker.spacex()
# ── Wikipedia summary ────────────────────────
summary = cosmotalker.wiki("event horizon")
# ── Satellite tracking ───────────────────────
satellites = cosmotalker.celestrak()
# ── Search shortcuts ─────────────────────────
cosmotalker.search("yt") # → YouTube
cosmotalker.search("gpt") # → ChatGPT
cosmotalker.search("hubble") # → Ecosia web search
01
Live Playground
REST API · Live Query
Response
02
Response Format
JSON
{
"status": "success",
"data": "Jupiter is the largest planet in our solar system...",
"query": "jupiter",
"version": "2.62",
"timestamp": "2026-05-24T10:30:00.000Z"
}
| Field | Type | Description |
|---|---|---|
| status | string | "success" or "error" |
| data | string | The cosmic information requested |
| query | string | The term you queried |
| version | string | CosmoTalker library version |
| timestamp | string | ISO 8601 UTC timestamp |
| message | string? | Error message (only when status="error") |
03
JavaScript
Browser · Fetch API
fetch("https://cosmotalker.onrender.com/api/get?q=jupiter")
.then(res => res.json())
.then(data => console.log(data.data));
04
Node.js
axios
import fetch from 'node-fetch';
async function askCosmoTalker(question) {
const res = await fetch(
`https://cosmotalker.onrender.com/api/get?q=${encodeURIComponent(question)}`
);
return res.json();
}
const result = await askCosmoTalker("jupiter moons");
console.log(result.answer);
05
Python · REST API
requests
import requests
response = requests.get("https://cosmotalker.onrender.com/api/get?q=mars")
data = response.json()
print(data["data"])
06
PHP
cURL
<?php
function askCosmoTalker($question) {
$url = "https://cosmotalker.onrender.com/api/get?"
. http_build_query(['q' => $question]);
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30
]);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
$r = askCosmoTalker("mars");
echo $r['answer'];
?>
07
Java
HttpClient · Java 11+
import java.net.http.*;
import java.net.*;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://cosmotalker.onrender.com/api/get?q=mars"))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
08
C# / .NET
HttpClient async
using HttpClient client = new();
string json = await client.GetStringAsync("https://cosmotalker.onrender.com/api/get?q=jupiter");
Console.WriteLine(json);
09
Go
net/http
package main
import ("encoding/json"; "fmt"; "io"; "net/http"; "net/url")
type Response struct {
Success bool `json:"success"`
Answer string `json:"answer"`
}
func Ask(question string) (*Response, error) {
params := url.Values{}; params.Add("q", question)
fullURL := "https://cosmotalker.onrender.com/api/get?" + params.Encode()
resp, _ := http.Get(fullURL)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var r Response
json.Unmarshal(body, &r)
return &r, nil
}
func main() {
r, _ := Ask("earth")
fmt.Println(r.Answer)
}
10
Bash / cURL
Shell script
curl -s "https://cosmotalker.onrender.com/api/get?q=pluto" | jq -r '.data'
11
Swift
Foundation
import Foundation
let url = URL(string: "https://cosmotalker.onrender.com/api/get?q=mars")!
let (data, _) = try await URLSession.shared.data(from: url)
let json = try JSONSerialization.jsonObject(with: data)
print(json)
12
Rust
reqwest
use reqwest;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let response = reqwest::get("https://cosmotalker.onrender.com/api/get?q=jupiter")
.await?
.json::<serde_json::Value>()
.await?;
println!("{}", response["data"]);
Ok(())
}
13
Quick Reference
cURL
curl ".../api/get?q=mars"
Python (pip)
pip install cosmotalker==2.62
import cosmotalker
cosmotalker.get("earth")
import cosmotalker
cosmotalker.get("earth")
Python (REST)
requests.get(".../api/get", params={"q":"mars"}).json()
JavaScript
fetch(".../api/get?q=mars").then(r=>r.json())
PHP
file_get_contents(".../api/get?q=".urlencode("mars"))
Go
http.Get(".../api/get?q=mars")