godo.AgentPlatform.ListAgentsByOpenAIAPIKey()

Generated on 5 Nov 2026 from godo version v1.236.0

Usage

client.AgentPlatform.ListAgentsByOpenAIAPIKey(ctx context.Context, openaiApiKeyId string, opt *godo.ListOptions) ([]*godo.Agent, *godo.Response, error)

Description

This method sends a GET request to /v2/gen-ai/openai/keys/{}/agents.

Parameters

openaiApiKeyId string required
opt *godo.ListOptions

Fields of godo.ListOptions

ListOptions specifies the optional parameters to various List methods that support pagination.

Page int

For paginated result sets, page of results to retrieve.

PerPage int

For paginated result sets, the number of results to include per page.

WithProjects bool

Whether App responses should include project_id fields. The field will be empty if false or if omitted. (ListApps)

Deployed bool

This parameter is used to only list agents that are deployed in the response.

PublicOnly bool

This parameter is used to include models that are publicly available.

Usecases []string

This parameter is used to include models according to the use cases.

Returns

[]*godo.Agent
*godo.Response

The HTTP response, with pagination Links, Meta, and Rate limit information.

error

Non-nil when the request fails. API errors are returned as *godo.ErrorResponse.

Fields of godo.Agent

Agent represents an Agent Platform Agent

AnthropicApiKey *godo.AnthropicApiKeyInfo

Omitted from JSON when empty. JSON key: anthropic_api_key

ApiKeyInfos []*godo.ApiKeyInfo

Omitted from JSON when empty. JSON key: api_key_infos

ApiKeys []*godo.ApiKey

Omitted from JSON when empty. JSON key: api_keys

ChatBot *godo.ChatBot

Omitted from JSON when empty. JSON key: chatbot

ChatbotIdentifiers []*godo.AgentChatbotIdentifier

Omitted from JSON when empty. JSON key: chatbot_identifiers

CreatedAt *godo.Timestamp

Omitted from JSON when empty. JSON key: created_at

ChildAgents []*godo.Agent

Omitted from JSON when empty. JSON key: child_agents

ConversationLogsEnabled bool

Omitted from JSON when empty. JSON key: conversation_logs_enabled

Deployment *godo.AgentDeployment

Omitted from JSON when empty. JSON key: deployment

Description string

Omitted from JSON when empty. JSON key: description

Functions []*godo.AgentFunction

Omitted from JSON when empty. JSON key: functions

Guardrails []*godo.AgentGuardrail

Omitted from JSON when empty. JSON key: guardrails

IfCase string

Omitted from JSON when empty. JSON key: if_case

Instruction string

Omitted from JSON when empty. JSON key: instruction

K int

Omitted from JSON when empty. JSON key: k

KnowledgeBases []*godo.KnowledgeBase

Omitted from JSON when empty. JSON key: knowledge_bases

MaxTokens int

Omitted from JSON when empty. JSON key: max_tokens

Model *godo.Model

Omitted from JSON when empty. JSON key: model

Name string

Omitted from JSON when empty. JSON key: name

OpenAiApiKey *godo.OpenAiApiKey

Omitted from JSON when empty. JSON key: open_ai_api_key

ParentAgents []*godo.Agent

Omitted from JSON when empty. JSON key: parent_agents

ProjectId string

Omitted from JSON when empty. JSON key: project_id

ProvideCitations bool

Omitted from JSON when empty. JSON key: provide_citations

Region string

Omitted from JSON when empty. JSON key: region

RetrievalMethod string

Omitted from JSON when empty. JSON key: retrieval_method

RouteCreatedAt *godo.Timestamp

Omitted from JSON when empty. JSON key: route_created_at

RouteCreatedBy string

Omitted from JSON when empty. JSON key: route_created_by

RouteUuid string

Omitted from JSON when empty. JSON key: route_uuid

RouteName string

Omitted from JSON when empty. JSON key: route_name

Tags []string

Omitted from JSON when empty. JSON key: tags

Template *godo.AgentTemplate

Omitted from JSON when empty. JSON key: template

Temperature float64

Omitted from JSON when empty. JSON key: temperature

TopP float64

Omitted from JSON when empty. JSON key: top_p

UpdatedAt *godo.Timestamp

Omitted from JSON when empty. JSON key: updated_at

Url string

Omitted from JSON when empty. JSON key: url

UserId string

Omitted from JSON when empty. JSON key: user_id

Uuid string

Omitted from JSON when empty. JSON key: uuid

VersionHash string

Omitted from JSON when empty. JSON key: version_hash

VPCEgressIPs []string

Omitted from JSON when empty. JSON key: vpc_egress_ips

VPCUuid string

Omitted from JSON when empty. JSON key: vpc_uuid

Workspace godo.Workspace

Omitted from JSON when empty. JSON key: workspace

Request Sample

Show Request Sample
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/digitalocean/godo"
)

func main() {
	client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN"))
	ctx := context.TODO()

	result, _, err := client.AgentPlatform.ListAgentsByOpenAIAPIKey(ctx, "<your-openai-api-key-id>", &godo.ListOptions{Page: 1, PerPage: 50})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", result)
}

Pagination

This method returns one page of results. Response.Links carries the pagination state; loop until IsLastPage reports true.

Show Pagination Sample
opt := &godo.ListOptions{Page: 1, PerPage: 50}
for {
	items, resp, err := client.AgentPlatform.ListAgentsByOpenAIAPIKey(ctx, "<your-openai-api-key-id>", opt)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", items)

	if resp.Links == nil || resp.Links.IsLastPage() {
		break
	}
	page, err := resp.Links.CurrentPage()
	if err != nil {
		log.Fatal(err)
	}
	opt.Page = page + 1
}

More Information

See GET /v2/gen-ai/openai/keys/{}/agents in the API reference for additional detail on responses, headers, parameters, and more.

See the Go package documentation for the source of this method.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.