Skip to content

MoonshotProvider

Namespace: Vercel.AI.Moonshot

public sealed class MoonshotProvider : OpenAICompatibleProvider

Moonshot provider. OpenAI Chat Completions compatible at https://api.moonshot.ai/v1.

Inheritance: object → ProviderBase → OpenAICompatibleProvider

View source

MoonshotProvider(HttpClient, OpenAICompatibleOptions?)

Section titled “MoonshotProvider(HttpClient, OpenAICompatibleOptions?)”
public MoonshotProvider(HttpClient httpClient, OpenAICompatibleOptions? options = null)

Creates a provider.

Parameters

Name Type Description
httpClient HttpClient
options OpenAICompatibleOptions

View source

public const string ApiKeyVariable = "MOONSHOT_API_KEY"

Environment variable for the API key.

Value: string

View source

public const string DefaultBaseUrl = "https://api.moonshot.ai/v1"

Default API origin.

Value: string

View source

public const string ProviderId = "moonshotai"

Provider id.

Value: string

View source

Create(OpenAICompatibleOptions?, HttpMessageHandler?)

Section titled “Create(OpenAICompatibleOptions?, HttpMessageHandler?)”
public static MoonshotProvider Create(OpenAICompatibleOptions? options = null, HttpMessageHandler? handler = null)

Creates a provider. Pass a handler from tests.

Parameters

Name Type Description
options OpenAICompatibleOptions
handler HttpMessageHandler

Returns: MoonshotProvider

View source

public override OpenAICompatibleLanguageModel CreateChatModel(string modelId)

Creates a chat model. Providers override this when support differs by model id.

Parameters

Name Type Description
modelId string

Returns: OpenAICompatibleLanguageModel

View source

public static bool SupportsStructuredOutputs(string modelId)

Whether <code class=“paramref”>modelId</code> accepts JSON schema responses. Every non-empty id does.

Parameters

Name Type Description
modelId string

Returns: bool

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product