Skip to content

Go

Install

go get github.com/AccursedGalaxy/RunForge/sdk-go

Explicit tracker API

package main

import (
  "context"
  rf "github.com/AccursedGalaxy/RunForge/sdk-go"
)

func main() {
  client, _ := rf.New("$INGEST_API_KEY", "https://your-host/api/ingest", "$PROJECT_ID")
  _, _ = client.Track(context.Background(), map[string]any{
    "path": "openai.chat.completions.create",
    "model": "gpt-4o-mini",
    "request": map[string]any{"model": "gpt-4o-mini"},
  }, func(ctx context.Context) (any, error) {
    // Call your LLM client here; return the raw response object
    return map[string]any{
      "model": "gpt-4o-mini",
      "usage": map[string]any{"prompt_tokens": 10, "completion_tokens": 5, "total_tokens": 15},
    }, nil
  })
}

Behavior

  • Auto-extracts tokens and cost from provider response when possible.
  • Trusts OpenRouter usage.total_cost; estimates otherwise. Server recomputes authoritative cost.
  • Sends only usage metadata to /api/ingest (no prompts/outputs).

Environment variables

  • RUNFORGE_API_KEY, RUNFORGE_PROJECT_ID, RUNFORGE_ENDPOINT

See also: 05-apis.md, sdk-auto-extraction-guide.md