Package com.tnsai.llm.providers
Class TogetherAIClient
java.lang.Object
com.tnsai.llm.providers.AbstractLLMClient
com.tnsai.llm.providers.AbstractOpenAICompatibleClient
com.tnsai.llm.providers.TogetherAIClient
- All Implemented Interfaces:
com.tnsai.llm.LLMClient
Together.ai LLM client.
Together hosts open models (Llama 3.x, Mixtral, Qwen, DeepSeek,
Nemotron, and many more) behind an OpenAI-compatible API at
https://api.together.xyz/v1. The wire format matches every
other OpenAI-shape provider in this module (GroqClient,
OpenRouterClient, NvidiaNIMClient,
XAIGrokClient, CerebrasClient), so this client is a
thin same-shape addition.
Supported models (at time of writing — the serverless catalogue evolves quickly, check the live list at docs.together.ai/docs/serverless-models):
- meta-llama/Llama-3.3-70B-Instruct-Turbo — Llama 3.3 70B (recommended general-purpose)
- meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo — Llama 3.1 405B (frontier)
- meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo — Llama 3.1 70B
- meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo — Llama 3.1 8B (fast / cheap)
- mistralai/Mixtral-8x7B-Instruct-v0.1 — Mixtral 8x7B
- mistralai/Mistral-7B-Instruct-v0.3 — Mistral 7B
- Qwen/Qwen2.5-72B-Instruct-Turbo — Qwen 2.5 72B
- deepseek-ai/DeepSeek-V3 — DeepSeek V3
- nvidia/Llama-3.1-Nemotron-70B-Instruct-HF — Nemotron-tuned Llama
Function calling is supported on most chat models — verify per model against the live docs if a tool-call payload comes back empty.
Configuration via environment variables:
TOGETHER_API_KEY— Required.TOGETHER_BASE_URL— Optional override, defaults tohttps://api.together.xyz/v1.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTogetherAIClient(String model) TogetherAIClient(String model, float temperature) TogetherAIClient(String model, float temperature, Float topP, Integer maxTokens) TogetherAIClient(String model, float temperature, Integer maxTokens) TogetherAIClient(String baseUrl, String model, float temperature, Float topP, Integer maxTokens, String apiKey) TogetherAIClient(String baseUrl, String model, float temperature, Integer maxTokens, String apiKey) -
Method Summary
Methods inherited from class com.tnsai.llm.providers.AbstractOpenAICompatibleClient
chat, streamChatMethods inherited from class com.tnsai.llm.providers.AbstractLLMClient
getBaseUrl, getCallTimeoutMs, getMaxTokens, getModel, getTemperature, getTopPMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.tnsai.llm.LLMClient
chat, chat, chat, chat, chat, getCapabilities, getProviderName, listModels, streamChat, streamChat, streamChatWithHandler, streamChatWithHandler, streamChatWithSpec, streamChatWithSpec
-
Constructor Details
-
TogetherAIClient
-
TogetherAIClient
-
TogetherAIClient
-
TogetherAIClient
-
TogetherAIClient
-
TogetherAIClient
-