For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://modelgates.ai/docs/_mcp/server.

Generations - Go SDK

The Go SDK and docs are currently in beta. Report issues on GitHub.

Overview

Generation history endpoints

Available Operations

GetGeneration

Get request & usage metadata for a generation

Example Usage

go
package main import(	"context"	"os"	modelgates "github.com/ModelGatesTeam/go-sdk"	"log") func main() {    ctx := context.Background()     s := modelgates.New(        modelgates.WithSecurity(os.Getenv("MODELGATES_API_KEY")),    )     res, err := s.Generations.GetGeneration(ctx, "<id>")    if err != nil {        log.Fatal(err)    }    if res != nil {        // handle response    }}

Parameters

ParameterTypeRequiredDescriptionExample
ctxcontext.Context:heavy_check_mark:The context to use for the request.
idstring:heavy_check_mark:The generation IDgen-1234567890
opts[]operations.Option:heavy_minus_sign:The options for this request.

Response

*components.GenerationResponse, error

Errors

Error TypeStatus CodeContent Type
sdkerrors.UnauthorizedResponseError401application/json
sdkerrors.PaymentRequiredResponseError402application/json
sdkerrors.NotFoundResponseError404application/json
sdkerrors.TooManyRequestsResponseError429application/json
sdkerrors.InternalServerResponseError500application/json
sdkerrors.BadGatewayResponseError502application/json
sdkerrors.EdgeNetworkTimeoutResponseError524application/json
sdkerrors.ProviderOverloadedResponseError529application/json
sdkerrors.APIError4XX, 5XX*/*

ListGenerationContent

Get stored prompt and completion content for a generation

Example Usage

go
package main import(	"context"	"os"	modelgates "github.com/ModelGatesTeam/go-sdk"	"log") func main() {    ctx := context.Background()     s := modelgates.New(        modelgates.WithSecurity(os.Getenv("MODELGATES_API_KEY")),    )     res, err := s.Generations.ListGenerationContent(ctx, "gen-1234567890")    if err != nil {        log.Fatal(err)    }    if res != nil {        // handle response    }}

Parameters

ParameterTypeRequiredDescriptionExample
ctxcontext.Context:heavy_check_mark:The context to use for the request.
idstring:heavy_check_mark:The generation IDgen-1234567890
opts[]operations.Option:heavy_minus_sign:The options for this request.

Response

*components.GenerationContentResponse, error

Errors

Error TypeStatus CodeContent Type
sdkerrors.UnauthorizedResponseError401application/json
sdkerrors.ForbiddenResponseError403application/json
sdkerrors.NotFoundResponseError404application/json
sdkerrors.TooManyRequestsResponseError429application/json
sdkerrors.InternalServerResponseError500application/json
sdkerrors.BadGatewayResponseError502application/json
sdkerrors.EdgeNetworkTimeoutResponseError524application/json
sdkerrors.ProviderOverloadedResponseError529application/json
sdkerrors.APIError4XX, 5XX*/*