/graphai.
Before you begin
- An API key from a model provider, such as Anthropic, OpenAI, or OpenRouter.
- Access to run SQL as the user that owns the CostGraph database.
- If your Postgres requires TLS, the CA certificate that signs it.
Turn on Graph AI
1
Create a read-only database login
Graph AI queries your cost data with its own login. For that login, the database shows only the rows of the tenant being asked about. Graph AI does not start without it.Run this as the database owner. Replace the password, database name, and owner.
2
Store the key and the login in a Secret
Name the key variable after your provider. See Choose a model.
3
Add Graph AI to your values file
helm upgrade with your values file. Graph AI appears in the dashboard after the upgrade finishes.Graph AI connects with
global.postgres.url exactly as written, so the URL must include the password.Choose a model
SetgraphAi.model to <provider>/<model>, and name the key variable as your provider expects.
Pick a strong model. Graph AI calls many tools in a single answer, and small models give poor results.
Use your own gateway
To send requests through a gateway such as LiteLLM, use anopenai/ or anthropic/ model and add OPENAI_BASE_URL or ANTHROPIC_BASE_URL to the Secret. For openai/ models, the gateway must support the OpenAI Responses API. This is also how you reach Azure OpenAI, Amazon Bedrock, or Google Vertex.
Databases that require TLS
Graph AI checks your database’s certificate whenever the connection uses TLS. Amazon RDS, Cloud SQL, and Azure Database use TLS by default, so give Graph AI the CA certificate.RDS_CA_PATH=/etc/ssl/certs/postgres/ca.pem to the costgraph-graph-ai Secret. Amazon RDS publishes its bundle at https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem. A Postgres in your cluster without TLS needs sslmode=disable in global.postgres.url.
Long answers
Graph AI streams its answers. If your ingress closes slow responses, long answers stop partway. On ingress-nginx, raise the timeouts.Connect MCP clients
Claude Desktop, Cursor, and other MCP clients can read your costs through CostGraph’s MCP server. It needs its own hostname.https://mcp.costgraph.internal.example.com/ as a server in the MCP client.
Clients that support OAuth, such as Claude Desktop’s custom connectors, open your CostGraph in the browser to sign you in. The client must be able to reach your CostGraph URL.
For clients without OAuth, use an API key.
- In CostGraph, open Settings > Personal API Keys and create a key.
- In the MCP client, add the header
X-API-Key: <your key>. - If you belong to more than one tenant, also add
X-CostGraph-Tenant-ID: <tenant ID>.