Skip to main content
Method: client.Generations.GenerationGet().

Example

import (
    "context"
    "fmt"
    "log"

    aistats "packages/sdk-go"
)

ctx := context.Background()
client := aistats.New("your-api-key", "https://api.ai-stats.dev")

record, _, err := client.Generations.GenerationGet(ctx).Id("G-01ABC...").Execute()
if err != nil {
    log.Fatal(err)
}
fmt.Println("Generation record:", record)

Parameters

  • id (string, required): Request id returned by a previous call.

Returns

GatewayGenerationRecord
{
  "request_id": "G-01ABC123",
  "team_id": "team-123",
  "app_id": "app-123",
  "endpoint": "chat/completions",
  "model_id": "openai/gpt-4o-mini",
  "provider": "openai",
  "native_response_id": "chatcmpl-123",
  "stream": false,
  "byok": false,
  "status_code": 200,
  "success": true,
  "error_code": null,
  "error_message": null,
  "latency_ms": 1500,
  "generation_ms": 1400,
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 9,
    "total_tokens": 18
  },
  "cost_nanos": 1000000,
  "currency": "USD",
  "pricing_lines": [],
  "key_id": "key-123",
  "throughput": null
}