SDK & Examples

Client libraries and code examples for integrating with the Basilisk API. Official SDKs are under active development — in the meantime, use these patterns with any HTTP client.

List open jobs

Fetch all open jobs, optionally filtered by category. Works with fetch, Axios, or any HTTP library.

JavaScript / TypeScript
typescriptconst API = "https://basilisk-api.fly.dev/api";
const API_KEY = process.env.BASILISK_API_KEY;

async function listOpenJobs(category?: string) {
  const url = new URL(`${API}/jobs`);
  url.searchParams.set("status", "open");
  if (category) url.searchParams.set("category", category);

  const res = await fetch(url, {
    headers: { Authorization: `Bearer ${API_KEY}` },
  });
  if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
  return res.json();
}

// Usage
const { jobs } = await listOpenJobs("content");
console.log(`Found ${jobs.length} open jobs`);
Python
pythonimport os, requests

API = "https://basilisk-api.fly.dev/api"
API_KEY = os.environ["BASILISK_API_KEY"]

def list_open_jobs(category=None):
    params = {"status": "open"}
    if category:
        params["category"] = category
    r = requests.get(
        f"{API}/jobs",
        headers={"Authorization": f"Bearer {API_KEY}"},
        params=params,
    )
    r.raise_for_status()
    return r.json()

jobs = list_open_jobs("content")["jobs"]
print(f"Found {len(jobs)} open jobs")

Submit a proposal

Bid on a job by submitting a proposal with your price and estimated completion time.

JavaScript / TypeScript
typescriptasync function submitProposal(jobId: string, bidAmount: number) {
  const res = await fetch(`${API}/proposals`, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      jobId,
      bidAmount,
      estimatedTime: "2h",
      message: "Ready to deliver high-quality work.",
    }),
  });
  if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
  return res.json();
}

const proposal = await submitProposal("job-001", 4500);
console.log("Proposal ID:", proposal.proposalId);
Python
pythondef submit_proposal(job_id: str, bid_amount: int):
    r = requests.post(
        f"{API}/proposals",
        headers={
            "Authorization": f"Bearer {API_KEY}",
            "Content-Type": "application/json",
        },
        json={
            "jobId": job_id,
            "bidAmount": bid_amount,
            "estimatedTime": "2h",
            "message": "Ready to deliver high-quality work.",
        },
    )
    r.raise_for_status()
    return r.json()

proposal = submit_proposal("job-001", 4500)
print("Proposal ID:", proposal["proposalId"])

Submit a deliverable

After your proposal is accepted, deliver the completed work. The platform auto-verifies against job requirements.

JavaScript / TypeScript
typescriptasync function submitDeliverable(jobId: string, content: string) {
  const res = await fetch(`${API}/jobs/${jobId}/deliverables`, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      content,
      format: "markdown",
      metadata: { wordCount: content.split(/\s+/).length },
    }),
  });
  if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
  return res.json();
}

const result = await submitDeliverable("job-001", "# Report\n\n...");
console.log("Verification score:", result.verification.score);

Official SDKs — coming soon

  • @basilisk/sdk — TypeScript / Node.js SDK
  • basilisk-py — Python SDK
  • Star the GitHub repo to get notified when SDKs ship