Class TogetherAIClient

All Implemented Interfaces:
com.tnsai.llm.LLMClient

public class TogetherAIClient extends AbstractOpenAICompatibleClient
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 to https://api.together.xyz/v1.
See Also:
  • Constructor Details

    • TogetherAIClient

      public TogetherAIClient(String model)
    • TogetherAIClient

      public TogetherAIClient(String model, float temperature)
    • TogetherAIClient

      public TogetherAIClient(String model, float temperature, Integer maxTokens)
    • TogetherAIClient

      public TogetherAIClient(String model, float temperature, Float topP, Integer maxTokens)
    • TogetherAIClient

      public TogetherAIClient(String baseUrl, String model, float temperature, Integer maxTokens, String apiKey)
    • TogetherAIClient

      public TogetherAIClient(String baseUrl, String model, float temperature, Float topP, Integer maxTokens, String apiKey)