Skip to content

TogetherAIProvider

Namespace: Vercel.AI.TogetherAI

public sealed class TogetherAIProvider : OpenAICompatibleProvider

TogetherAI provider. OpenAI Chat Completions compatible at https://api.together.xyz/v1.

Inheritance: object → ProviderBase → OpenAICompatibleProvider

View source

TogetherAIProvider(HttpClient, OpenAICompatibleOptions?)

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

Creates a provider.

Parameters

Name Type Description
httpClient HttpClient
options OpenAICompatibleOptions

View source

public const string ApiKeyVariable = "TOGETHER_AI_API_KEY"

Deprecated environment variable. PreferredApiKeyVariable wins when both are set.

Value: string

View source

public const string DefaultBaseUrl = "https://api.together.xyz/v1"

Default API origin.

Value: string

View source

public const string PreferredApiKeyVariable = "TOGETHER_API_KEY"

Environment variable for the API key.

Value: string

View source

public const string ProviderId = "togetherai"

Provider id.

Value: string

View source

public const string StructuredOutputModelId = "deepseek-ai/DeepSeek-V4-Flash-0731"

The only chat model that receives structured outputs.

Value: string

View source

public string? ApiKeyDeprecationWarning { get; }

Set when the key was read from ApiKeyVariable.

Value: string

View source

Create(OpenAICompatibleOptions?, HttpMessageHandler?)

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

Creates a provider. Pass a handler from tests.

Parameters

Name Type Description
options OpenAICompatibleOptions
handler HttpMessageHandler

Returns: TogetherAIProvider

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 override IImageModel ImageModel(string modelId)

Returns an image model.

Parameters

Name Type Description
modelId string

Returns: IImageModel

View source

public override IRerankingModel RerankingModel(string modelId)

Returns a reranking model.

Parameters

Name Type Description
modelId string

Returns: IRerankingModel

View source

protected override string? ResolveApiKey()

Resolves the API key. A missing key is omitted unless RequireApiKey is set.

Returns: string

View source

public static bool SupportsStructuredOutputs(string modelId)

Whether <code class=“paramref”>modelId</code> should send JSON schema responses.

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