Skip to main content

Get an API Key

Create an account on app.costgraph.ai to obtain your API key.

Authenticate with the SDK

import (
    "fmt"
    "os"

    openapiclient "github.com/baselinehq/pricingapi-client-golang"
)

token := os.Getenv("COSTGRAPH_API_KEY")

configuration := openapiclient.NewConfiguration()
configuration.DefaultHeader["Authorization"] = fmt.Sprintf("Bearer %s", token)

client := openapiclient.NewAPIClient(configuration)

Raw HTTP

Include your API key in the X-API-KEY header:
curl -H "X-API-KEY: $COSTGRAPH_API_KEY" \
     -H "Content-Type: application/json" \
     -X POST https://pricing.baselinehq.cloud/pricing/compute \
     -d '{"instance_type": "s-2vcpu-2gb", "provider": "digitalocean", "region": "nyc1", "service": "Droplet", "usage_type": "ondemand", "operating_system": "linux", "vm": {"cpu_cores": 2, "ram_gb": 2}}'