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

Beta.Responses - Go SDK

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

Overview

beta.responses endpoints

Available Operations

  • Send - Create a response

Send

Creates a streaming or non-streaming response using OpenResponses API format

Example Usage: guardrail-blocked

go
package main import(	"context"	"os"	modelgates "github.com/ModelGatesTeam/go-sdk"	"github.com/ModelGatesTeam/go-sdk/models/components"	"log") func main() {    ctx := context.Background()     s := modelgates.New(        modelgates.WithSecurity(os.Getenv("MODELGATES_API_KEY")),    )     res, err := s.Beta.Responses.Send(ctx, components.ResponsesRequest{}, nil)    if err != nil {        log.Fatal(err)    }    if res != nil {        defer res.ResponsesStreamingResponse.Close()         for res.ResponsesStreamingResponse.Next() {            event := res.ResponsesStreamingResponse.Value()            log.Print(event)            // Handle the event	      }    }}

Example Usage: insufficient-permissions

go
package main import(	"context"	"os"	modelgates "github.com/ModelGatesTeam/go-sdk"	"github.com/ModelGatesTeam/go-sdk/models/components"	"log") func main() {    ctx := context.Background()     s := modelgates.New(        modelgates.WithSecurity(os.Getenv("MODELGATES_API_KEY")),    )     res, err := s.Beta.Responses.Send(ctx, components.ResponsesRequest{}, nil)    if err != nil {        log.Fatal(err)    }    if res != nil {        defer res.ResponsesStreamingResponse.Close()         for res.ResponsesStreamingResponse.Next() {            event := res.ResponsesStreamingResponse.Value()            log.Print(event)            // Handle the event	      }    }}

Parameters

ParameterTypeRequiredDescriptionExample
ctxcontext.Context:heavy_check_mark:The context to use for the request.
responsesRequestcomponents.ResponsesRequest:heavy_check_mark:N/A{"input": [{"content": "Hello, how are you?","role": "user","type": "message"}
],
"model": "anthropic/claude-4.5-sonnet-20250929",
"temperature": 0.7,
"tools": [
{"description": "Get the current weather in a given location","name": "get_current_weather","parameters": {"properties": {"location": {"type": "string"}
},
"type": "object"
},
"type": "function"
}
],
"top_p": 0.9
}
xModelGatesExperimentalMetadata*components.MetadataLevel:heavy_minus_sign:Opt-in to surface routing metadata on the response under modelgates_metadata. Defaults to disabled.enabled
opts[]operations.Option:heavy_minus_sign:The options for this request.

Response

*operations.CreateResponsesResponse, error

Errors

Error TypeStatus CodeContent Type
sdkerrors.BadRequestResponseError400application/json
sdkerrors.UnauthorizedResponseError401application/json
sdkerrors.PaymentRequiredResponseError402application/json
sdkerrors.ForbiddenResponseError403application/json
sdkerrors.NotFoundResponseError404application/json
sdkerrors.RequestTimeoutResponseError408application/json
sdkerrors.PayloadTooLargeResponseError413application/json
sdkerrors.UnprocessableEntityResponseError422application/json
sdkerrors.TooManyRequestsResponseError429application/json
sdkerrors.InternalServerResponseError500application/json
sdkerrors.BadGatewayResponseError502application/json
sdkerrors.ServiceUnavailableResponseError503application/json
sdkerrors.EdgeNetworkTimeoutResponseError524application/json
sdkerrors.ProviderOverloadedResponseError529application/json
sdkerrors.APIError4XX, 5XX*/*