Skip to main content

Integrate API using LLMs

Vibe code with the right information

Most large language models (LLMs) have an understanding of the ClearSKY API. However, to avoid working with outdated API endpoints and to limit hallucination, it's advisable to present our OpenAPI specification to the LLM. It's structured JSON data which makes building API integration a breeze with ChatGPT, Claude, Perplexity and more.

1. Base URL & Headers

The API is located at the following base URL.

{
"baseUrl": "https://api.clearsky.vision",
"headers": {
"Authorization": "Bearer $CLEARSKY_API_KEY",
"Content-Type": "application/json"
}
}

2. Download & Inspect the OpenAPI Spec

To avoid hallucination, provide your favorite LLM with the below specification.

curl -o specification.json https://api.clearsky.vision/api/specification.json

or copy the entire specification page here:

import json
with open("specification.json") as f:
spec = json.load(f)
print(spec["paths"].keys())

Paste the entire specification.json into ChatGPT so it knows every endpoint, parameter, schema, and example.

3. Prompt Templates for LLMs

You are a senior Python engineer. Here is the OpenAPI spec for ClearSKY API:

<PASTE specification.json here>

Write me a Python module that wraps these endpoints:

- satelliteimages/process/composite
- tasking/orders

under a class ClearSkyClient, with methods process_composite() and create_task_order(), including docstrings from the spec, proper type-hints, and error-handling. Use requests and the CLEARSKY_API_KEY env var.
important

Remember not to paste any secrets into any LLMs inc. ClearSKY API keys.