Skip to content

List Model API Keys

client.Inference.APIKeys.List(ctx, query) (*InferenceAPIKeyListResponse, error)
get/v2/gen-ai/models/api_keys

To list all model API keys, send a GET request to /v2/gen-ai/models/api_keys.

ParametersExpand Collapse
query InferenceAPIKeyListParams
Page param.Field[int64]optional

Page number.

PerPage param.Field[int64]optional

Items per page.

ReturnsExpand Collapse
type InferenceAPIKeyListResponse struct{…}
APIKeyInfos []APIModelAPIKeyInfooptional

Api key infos

CreatedAt Timeoptional

Creation date

formatdate-time
CreatedBy stringoptional

Created by

formatuint64
DeletedAt Timeoptional

Deleted date

formatdate-time
Name stringoptional

Name

SecretKey stringoptional
Uuid stringoptional

Uuid

Meta APIMetaoptional

Meta information about the data set

Page int64optional

The current page

formatint64
Pages int64optional

Total number of pages

formatint64
Total int64optional

Total amount of items over all pages

formatint64
List Model API Keys
package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/-go"
  "github.com/stainless-sdks/-go/option"
)

func main() {
  client := gradient.NewClient(
    option.WithAccessToken("My Access Token"),
  )
  apiKeys, err := client.Inference.APIKeys.List(context.TODO(), gradient.InferenceAPIKeyListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", apiKeys.APIKeyInfos)
}
{
  "api_key_infos": [
    {
      "created_at": "2023-01-01T00:00:00Z",
      "created_by": "12345",
      "deleted_at": "2023-01-01T00:00:00Z",
      "name": "example name",
      "secret_key": "example string",
      "uuid": "123e4567-e89b-12d3-a456-426614174000"
    }
  ],
  "links": {
    "pages": {
      "first": "example string",
      "last": "example string",
      "next": "example string",
      "previous": "example string"
    }
  },
  "meta": {
    "page": 123,
    "pages": 123,
    "total": 123
  }
}
Returns Examples
{
  "api_key_infos": [
    {
      "created_at": "2023-01-01T00:00:00Z",
      "created_by": "12345",
      "deleted_at": "2023-01-01T00:00:00Z",
      "name": "example name",
      "secret_key": "example string",
      "uuid": "123e4567-e89b-12d3-a456-426614174000"
    }
  ],
  "links": {
    "pages": {
      "first": "example string",
      "last": "example string",
      "next": "example string",
      "previous": "example string"
    }
  },
  "meta": {
    "page": 123,
    "pages": 123,
    "total": 123
  }
}