The open-source agent harness - the runtime layer that turns an LLM into a working agent.
Add Together AI as a provider, with 20 verified models (#55)
pranjaltrvd24fd5be30b73
diff --git a/fern/openapi/openapi.json b/fern/openapi/openapi.jsonindex c9d5ff617..2368f52e9 100644--- a/fern/openapi/openapi.json+++ b/fern/openapi/openapi.json@@ -385,6 +385,7 @@"fireworks","zai","moonshot",+ "together","alibaba"],"type": "string"@@ -3174,7 +3175,8 @@"google-gemini","fireworks","zai",- "moonshot"+ "moonshot",+ "together"],"type": "string"}diff --git a/packages/harness/src/core/llm/VercelAILLM.ts b/packages/harness/src/core/llm/VercelAILLM.tsindex a171c403b..f390662c6 100644--- a/packages/harness/src/core/llm/VercelAILLM.ts+++ b/packages/harness/src/core/llm/VercelAILLM.ts@@ -3,7 +3,9 @@ import { createAnthropic } from '@ai-sdk/anthropic';import { createGoogle } from '@ai-sdk/google';import type { MoonshotAIProviderOptions } from '@ai-sdk/moonshotai';import { createMoonshotAI } from '@ai-sdk/moonshotai';+import type { OpenAIResponsesProviderOptions } from '@ai-sdk/openai';import { createOpenAI } from '@ai-sdk/openai';+import type { OpenAICompatibleProviderOptions } from '@ai-sdk/openai-compatible';import { createOpenAICompatible } from '@ai-sdk/openai-compatible';import type { JSONObject } from '@ai-sdk/provider';import type { ProviderOptions, ReasoningPart } from '@ai-sdk/provider-utils';@@ -71,6 +73,7 @@ export const VERCEL_AI_PROVIDER_NAMES = ['zai','moonshot','alibaba',+ 'together','custom',] as const;@@ -99,11 +102,10 @@ export interface VercelAILLMConfig {}/**- * Every OpenAI-compatible provider shares this adapter and differs only by endpoint, which the- * caller resolves. The provider name doubles as the `providerOptions` key, which is why- * {@link buildProviderOptions} can key on it directly. Fireworks and Z AI stay here on purpose:- * `@ai-sdk/fireworks` downgrades `json_schema` to a schema-less `json_object`, and the only Z AI- * package is a community one that drops replayed reasoning.+ * Shared by every OpenAI-compatible provider, which differ only by endpoint. The provider name+ * doubles as the `providerOptions` key. Fireworks, Together and Z AI stay here rather than on their+ * own packages: those drop `json_schema`, and Fireworks also clamps efforts its models do accept.+ * TODO: move Z AI to @ai-sdk/zai once https://github.com/vercel/ai/pull/17340 ships.*/function compatibleModel(config: VercelAIProviderConfig): LanguageModel {const { provider, modelId, apiKey, headers, baseUrl } = config;@@ -174,6 +176,7 @@ export function buildLanguageModel(config: VercelAIProviderConfig): LanguageMode}case 'fireworks':case 'zai':+ case 'together':case 'custom': {return compatibleModel(config);}@@ -231,24 +234,18 @@ function isReasoningLevel(v: string): v is ReasoningLevel {}/**- * Efforts models advertise that the SDK's cross-provider union cannot express. `xhigh` is its- * ceiling, so `max` rides in as `xhigh`. Anthropic's adapter raises that back to `max` for models- * without an `xhigh` level; everyone else receives `xhigh` as sent, which for models offering both- * levels — the gpt-5.6 family — is one step below what was asked for.+ * Efforts the SDK's union cannot express. `xhigh` is its ceiling, so `max` rides in as `xhigh`;+ * Anthropic's adapter raises that back, and {@link maxEffortOption} covers the rest.*/const EFFORT_ALIASES: Readonly<Record<string, ReasoningLevel>> = { max: 'xhigh' };-/**- * What a model may advertise in `reasoning_efforts`. Anything else reaches `toReasoningLevel`,- * resolves to `undefined`, and runs at the provider default without a word of complaint.- */+/** What a model may advertise in `reasoning_efforts`; anything else resolves to the provider default. */export const SUPPORTED_REASONING_EFFORTS: readonly string[] = [...REASONING_LEVELS, ...Object.keys(EFFORT_ALIASES)];/**- * Every provider takes the effort through the top-level `reasoning` setting, leaving the adapters- * to translate it: an effort string for OpenAI-shaped APIs, a per-model thinking shape for- * Anthropic, `thinkingLevel` or `thinkingBudget` for Gemini. Reasoning-related `providerOptions`- * would override this rather than merge with it, so nothing here sets them.+ * The effort travels on the top-level `reasoning` setting, which each adapter translates per model:+ * an effort string for OpenAI-shaped APIs, a thinking shape for Anthropic, a level or budget for+ * Gemini. A reasoning `providerOptions` entry replaces that path rather than merging with it.*/export function toReasoningLevel(reasoningEffort: string | undefined): ReasoningLevel | undefined {if (reasoningEffort === undefined) {@@ -261,6 +258,18 @@ export function toReasoningLevel(reasoningEffort: string | undefined): Reasoningreturn isReasoningLevel(reasoningEffort) ? reasoningEffort : undefined;}+/**+ * `max` needs each adapter's own option, which wins over the top-level setting; the callers below+ * say why. The intersection resolves to `'max'`, so a package dropping it breaks the build.+ */+type MaxEffortOption = Pick<OpenAIResponsesProviderOptions, 'reasoningEffort'> &+ Pick<OpenAICompatibleProviderOptions, 'reasoningEffort'> &+ Pick<MoonshotAIProviderOptions, 'reasoningEffort'>;++function maxEffortOption(reasoningEffort: string | undefined): MaxEffortOption {+ return reasoningEffort === 'max' ? { reasoningEffort: 'max' } : {};+}+/*** Providers surface stream errors as plain objects as often as Errors; `String()` on those* yields "[object Object]" and loses the only description of what went wrong.@@ -310,9 +319,11 @@ function readBodyField({ rawBody, key }: { rawBody: unknown; key: string }): JSOfunction openaiProviderOptions({rawBody,strictJsonSchema,+ reasoningEffort,}: {rawBody: unknown;strictJsonSchema: boolean | undefined;+ reasoningEffort: string | undefined;}): JSONObject {const serviceTier = readBodyField({ rawBody, key: 'service_tier' });const user = readBodyField({ rawBody, key: 'user' });@@ -322,6 +333,8 @@ function openaiProviderOptions({return {store: false,include: ['reasoning.encrypted_content'],+ // gpt-5.6 serves both xhigh and max, so the aliased top-level level asks for one rung less.+ ...maxEffortOption(reasoningEffort),...(strictJsonSchema !== undefined ? { strictJsonSchema } : {}),...(serviceTier !== undefined ? { serviceTier } : {}),...(user !== undefined ? { user } : {}),@@ -390,9 +403,8 @@ function googleGeminiProviderOptions({}/**- * Moonshot is the only adapter that accepts `max` directly, so it escapes the `xhigh` alias every- * other provider settles for. `thinking` and `reasoning_history` are forwarded but never pinned:- * they are the caller's route to turning thinking off, or to replaying it verbatim.+ * `thinking` and `reasoning_history` are forwarded but never pinned: they are the caller's route to+ * turning thinking off, or to replaying it verbatim.*/function moonshotProviderOptions({rawBody,@@ -401,13 +413,11 @@ function moonshotProviderOptions({rawBody: unknown;reasoningEffort: string | undefined;}): JSONObject | undefined {- // Typed against the package so a change to the literal it accepts breaks the build, not the call.- const effort: Pick<MoonshotAIProviderOptions, 'reasoningEffort'> =- reasoningEffort === 'max' ? { reasoningEffort: 'max' } : {};const thinking = readBodyField({ rawBody, key: 'thinking' });const reasoningHistory = readBodyField({ rawBody, key: 'reasoning_history' });const opts: JSONObject = {- ...effort,+ // Moonshot's own ceiling is `max`; the aliased `xhigh` is not one of its levels.+ ...maxEffortOption(reasoningEffort),...(thinking !== undefined ? { thinking } : {}),...(reasoningHistory !== undefined ? { reasoningHistory } : {}),};@@ -428,15 +438,42 @@ function alibabaProviderOptions(rawBody: unknown): JSONObject | undefined {}/**- * `parallel_tool_calls` is deliberately not forwarded: `OpenAICompatibleProviderOptions` has no- * field for it, so it never reached the wire.+ * The adapter copies options outside its own schema into the body under the same key, so these are+ * wire names, not camelCase. Unvalidated: a field the endpoint rejects fails loudly.*/+const COMPATIBLE_BODY_FIELDS = [+ 'service_tier',+ 'user',+ 'prompt_cache_key',+ 'parallel_tool_calls',+ 'thinking',+ 'thinking_budget',+ 'enable_thinking',+ 'reasoning_history',+] as const;+function compatibleProviderOptions({strictJsonSchema,+ reasoningEffort,+ rawBody,}: {strictJsonSchema: boolean | undefined;+ reasoningEffort: string | undefined;+ rawBody: unknown;}): JSONObject | undefined {- return strictJsonSchema !== undefined ? { strictJsonSchema } : undefined;+ const forwarded: JSONObject = Object.fromEntries(+ COMPATIBLE_BODY_FIELDS.flatMap(key => {+ const value = readBodyField({ rawBody, key });+ return value === undefined ? [] : [[key, value] as const];+ }),+ );+ const opts: JSONObject = {+ // These endpoints discard an effort they do not recognise, and `xhigh` is one of those.+ ...maxEffortOption(reasoningEffort),+ ...forwarded,+ ...(strictJsonSchema !== undefined ? { strictJsonSchema } : {}),+ };+ return Object.keys(opts).length > 0 ? opts : undefined;}/**@@ -457,7 +494,7 @@ export function buildProviderOptions({}): ProviderOptions {const strictJsonSchema = structuredOutputSpec.mode === 'json_schema' ? structuredOutputSpec.strict : undefined;if (config.provider === 'openai') {- return { openai: openaiProviderOptions({ rawBody, strictJsonSchema }) };+ return { openai: openaiProviderOptions({ rawBody, strictJsonSchema, reasoningEffort }) };} else if (config.provider === 'anthropic') {const anthropic = anthropicProviderOptions(rawBody);return anthropic !== undefined ? { anthropic } : {};@@ -474,7 +511,7 @@ export function buildProviderOptions({} else {// The remaining providers all share the compatible adapter, which reads its options from a key// matching the `name` it was built with — the provider name itself.- const compatible = compatibleProviderOptions({ strictJsonSchema });+ const compatible = compatibleProviderOptions({ strictJsonSchema, reasoningEffort, rawBody });return compatible !== undefined ? { [config.provider]: compatible } : {};}}@@ -549,9 +586,6 @@ export function toUserContent(content: string | ChatCompletionContentPart[]): Us* - `'anthropic'` → `anthropic.signature`* - `'google-gemini'` → per-tool-call `google.thoughtSignature`, no standalone reasoning block* - `'custom'` → OpenAI-compatible ignores providerOptions, so the token has nowhere to go- *- * Alibaba gets no reasoning at all: its adapter appends replayed thinking to the visible answer,- * and Qwen issues no signature, so there is nothing to lose by leaving it out.*/export function toAssistantModelMessage({msg,@@ -564,6 +598,7 @@ export function toAssistantModelMessage({// `thinking_blocks` is attached at runtime by AgentThread and absent from the OpenAI SDK type.const rawThinking: unknown = Reflect.get(msg, 'thinking_blocks');+ // Alibaba appends replayed thinking to the visible answer, and Qwen signs nothing to preserve.if (Array.isArray(rawThinking) && provider !== 'alibaba') {// Widen any[] → unknown[] so the in-guards below narrow safely.const blocks: unknown[] = rawThinking;diff --git a/packages/harness/tests/core/llm/VercelAILLM.output.test.ts b/packages/harness/tests/core/llm/VercelAILLM.output.test.tsindex 5144f0fb4..a055e6937 100644--- a/packages/harness/tests/core/llm/VercelAILLM.output.test.ts+++ b/packages/harness/tests/core/llm/VercelAILLM.output.test.ts@@ -138,6 +138,17 @@ describe('buildProviderOptions', () => {expect(opts['openai']).toMatchObject({ store: false, include: ['reasoning.encrypted_content'] });});+ // The gpt-5.6 family offers both xhigh and max, so the aliased xhigh reasons a step short.+ it('sends `max` as an effort of its own, since the top-level setting caps at xhigh', () => {+ const opts = buildProviderOptions({+ config,+ reasoningEffort: 'max',+ structuredOutputSpec: textSpec,+ rawBody: {},+ });+ expect(opts['openai']).toMatchObject({ reasoningEffort: 'max' });+ });+it('includes strictJsonSchema:true when spec is json_schema with strict:true', () => {const opts = buildProviderOptions({config: config,@@ -261,6 +272,48 @@ describe('buildProviderOptions', () => {expect(opts).toEqual({ [provider]: { strictJsonSchema: true } });});+ it.each(['custom', 'fireworks', 'zai', 'together'] as const)(+ '%s: sends `max` verbatim, which these endpoints ignore when it arrives as xhigh',+ provider => {+ const opts = buildProviderOptions({+ config: makeConfig({ provider, baseUrl: 'http://localhost/v1' }),+ reasoningEffort: 'max',+ structuredOutputSpec: textSpec,+ rawBody: {},+ });+ expect(opts).toEqual({ [provider]: { reasoningEffort: 'max' } });+ },+ );++ // camelCase here sent a key no OpenAI-shaped endpoint reads, which is how it went unnoticed.+ it('forwards body fields under their wire names', () => {+ const opts = buildProviderOptions({+ config,+ reasoningEffort: undefined,+ structuredOutputSpec: textSpec,+ rawBody: {+ service_tier: 'auto',+ user: 'u-1',+ prompt_cache_key: 'k',+ parallel_tool_calls: false,+ thinking: { type: 'enabled' },+ thinking_budget: 512,+ enable_thinking: true,+ reasoning_history: 'off',+ },+ });+ expect(opts['custom']).toEqual({+ service_tier: 'auto',+ user: 'u-1',+ prompt_cache_key: 'k',+ parallel_tool_calls: false,+ thinking: { type: 'enabled' },+ thinking_budget: 512,+ enable_thinking: true,+ reasoning_history: 'off',+ });+ });+it('omits the custom key when the resulting object would be empty', () => {const opts = buildProviderOptions({config: config,@@ -399,8 +452,8 @@ describe('buildProviderOptions', () => {];// Reasoning travels only on the top-level setting. A providerOptions copy would take precedence- // over it, so any provider growing one here would silently shadow the requested effort. Moonshot- // is the deliberate exception, and only for `max`, which the top-level setting cannot express.+ // over it, so any provider growing one here would silently shadow the requested effort. The one+ // exception is `max`, which the top-level setting cannot express.it.each(providers)('%s: no providerOptions entry carries the effort', provider => {const config = makeConfig({provider,@@ -418,5 +471,26 @@ describe('buildProviderOptions', () => {expect(entry === undefined || !('reasoningEffort' in entry)).toBe(true);}});++ // `max` arrives as `xhigh`, which OpenAI-shaped APIs read as a weaker level or an unknown+ // string they drop without complaint. Adapters taking an effort of their own get the real one;+ // Anthropic and Gemini rely on their adapters, which resolve `xhigh` correctly.+ it.each([+ ['openai', true],+ ['together', true],+ ['moonshot', true],+ ['anthropic', false],+ ['google-gemini', false],+ ['alibaba', false],+ ] as const)('%s: carries max as its own effort = %s', (provider, carries) => {+ const opts = buildProviderOptions({+ config: makeConfig({ provider, baseUrl: 'http://localhost/v1' }),+ reasoningEffort: 'max',+ structuredOutputSpec: textSpec,+ rawBody: {},+ });+ const sent = Object.values(opts).some(entry => entry?.['reasoningEffort'] === 'max');+ expect(sent).toBe(carries);+ });});});diff --git a/packages/sdk/src/api/types/CatalogProviderType.ts b/packages/sdk/src/api/types/CatalogProviderType.tsindex 2405ddffc..eb12330ed 100644--- a/packages/sdk/src/api/types/CatalogProviderType.ts+++ b/packages/sdk/src/api/types/CatalogProviderType.ts@@ -7,6 +7,7 @@ export const CatalogProviderType = {Fireworks: "fireworks",Zai: "zai",Moonshot: "moonshot",+ Together: "together",Alibaba: "alibaba",} as const;export type CatalogProviderType = (typeof CatalogProviderType)[keyof typeof CatalogProviderType];diff --git a/packages/sdk/src/api/types/WellKnownModelProviderType.ts b/packages/sdk/src/api/types/WellKnownModelProviderType.tsindex 8a262c9c4..52a950bf0 100644--- a/packages/sdk/src/api/types/WellKnownModelProviderType.ts+++ b/packages/sdk/src/api/types/WellKnownModelProviderType.ts@@ -7,5 +7,6 @@ export const WellKnownModelProviderType = {Fireworks: "fireworks",Zai: "zai",Moonshot: "moonshot",+ Together: "together",} as const;export type WellKnownModelProviderType = (typeof WellKnownModelProviderType)[keyof typeof WellKnownModelProviderType];diff --git a/packages/sdk/src/serialization/types/CatalogProviderType.ts b/packages/sdk/src/serialization/types/CatalogProviderType.tsindex faf405395..0eb39fc4c 100644--- a/packages/sdk/src/serialization/types/CatalogProviderType.ts+++ b/packages/sdk/src/serialization/types/CatalogProviderType.ts@@ -7,8 +7,25 @@ import type * as serializers from "../index.js";export const CatalogProviderType: core.serialization.Schema<serializers.CatalogProviderType.Raw,TrueHarness.CatalogProviderType-> = core.serialization.enum_(["openai", "anthropic", "google-gemini", "fireworks", "zai", "moonshot", "alibaba"]);+> = core.serialization.enum_([+ "openai",+ "anthropic",+ "google-gemini",+ "fireworks",+ "zai",+ "moonshot",+ "together",+ "alibaba",+]);export declare namespace CatalogProviderType {- export type Raw = "openai" | "anthropic" | "google-gemini" | "fireworks" | "zai" | "moonshot" | "alibaba";+ export type Raw =+ | "openai"+ | "anthropic"+ | "google-gemini"+ | "fireworks"+ | "zai"+ | "moonshot"+ | "together"+ | "alibaba";}diff --git a/packages/sdk/src/serialization/types/WellKnownModelProviderType.ts b/packages/sdk/src/serialization/types/WellKnownModelProviderType.tsindex dd9a01f2f..4a690e9e4 100644--- a/packages/sdk/src/serialization/types/WellKnownModelProviderType.ts+++ b/packages/sdk/src/serialization/types/WellKnownModelProviderType.ts@@ -7,8 +7,8 @@ import type * as serializers from "../index.js";export const WellKnownModelProviderType: core.serialization.Schema<serializers.WellKnownModelProviderType.Raw,TrueHarness.WellKnownModelProviderType-> = core.serialization.enum_(["openai", "anthropic", "google-gemini", "fireworks", "zai", "moonshot"]);+> = core.serialization.enum_(["openai", "anthropic", "google-gemini", "fireworks", "zai", "moonshot", "together"]);export declare namespace WellKnownModelProviderType {- export type Raw = "openai" | "anthropic" | "google-gemini" | "fireworks" | "zai" | "moonshot";+ export type Raw = "openai" | "anthropic" | "google-gemini" | "fireworks" | "zai" | "moonshot" | "together";}diff --git a/packages/server/src/catalog/model-catalog.yaml b/packages/server/src/catalog/model-catalog.yamlindex ddf3cc7e1..c2943fe6d 100644--- a/packages/server/src/catalog/model-catalog.yaml+++ b/packages/server/src/catalog/model-catalog.yaml@@ -815,3 +815,102 @@ providers:- model_id: qwen3.8-maxname: qwen3-8-maxproperties: {}+ - type: together+ name: together+ models:+ - model_id: deepseek-ai/DeepSeek-V4-Flash-0731+ name: deepseek-ai-deepseek-v4-flash-0731+ properties:+ context_length: 1048576+ - model_id: deepseek-ai/DeepSeek-V4-Pro+ name: deepseek-ai-deepseek-v4-pro+ properties:+ context_length: 512000+ reasoning_efforts:+ - high+ - max+ - model_id: google/gemma-4-31B-it+ name: google-gemma-4-31b-it+ properties:+ context_length: 262144+ - model_id: LiquidAI/LFM2.5-8B-A1B+ name: liquidai-lfm2-5-8b-a1b+ properties:+ context_length: 32768+ - model_id: meta-llama/Llama-3.3-70B-Instruct-Turbo+ name: meta-llama-llama-3-3-70b-instruct-turbo+ properties:+ context_length: 131072+ - model_id: MiniMaxAI/MiniMax-M3+ name: minimaxai-minimax-m3+ properties:+ context_length: 1000000+ - model_id: moonshotai/Kimi-K2.6+ name: moonshotai-kimi-k2-6+ properties:+ context_length: 262144+ - model_id: moonshotai/Kimi-K2.7-Code+ name: moonshotai-kimi-k2-7-code+ properties:+ context_length: 262144+ - model_id: moonshotai/Kimi-K3+ name: moonshotai-kimi-k3+ properties:+ context_length: 1000000+ - model_id: nvidia/nemotron-3-ultra-550b-a55b+ name: nvidia-nemotron-3-ultra-550b-a55b+ properties:+ context_length: 512300+ - model_id: openai/gpt-oss-120b+ name: openai-gpt-oss-120b+ properties:+ context_length: 128000+ reasoning_efforts:+ - low+ - medium+ - high+ - model_id: openai/gpt-oss-20b+ name: openai-gpt-oss-20b+ properties:+ context_length: 128000+ reasoning_efforts:+ - low+ - medium+ - high+ - model_id: pearl-ai/gemma-4-31b-it+ name: pearl-ai-gemma-4-31b-it+ properties:+ context_length: 32000+ - model_id: Qwen/Qwen2.5-7B-Instruct-Turbo+ name: qwen-qwen2-5-7b-instruct-turbo+ properties:+ context_length: 32768+ - model_id: Qwen/Qwen3.5-9B+ name: qwen-qwen3-5-9b+ properties:+ context_length: 262144+ - model_id: Qwen/Qwen3.6-Plus+ name: qwen-qwen3-6-plus+ properties:+ context_length: 1000000+ - model_id: Qwen/Qwen3.7-Max+ name: qwen-qwen3-7-max+ properties:+ context_length: 1000000+ - model_id: Qwen/Qwen3.7-Plus+ name: qwen-qwen3-7-plus+ properties:+ context_length: 1000000+ max_output_tokens: 65536+ - model_id: thinkingmachines/Inkling+ name: thinkingmachines-inkling+ properties:+ context_length: 524288+ - model_id: zai-org/GLM-5.2+ name: zai-org-glm-5-2+ properties:+ context_length: 262144+ max_output_tokens: 131072+ reasoning_efforts:+ - high+ - maxdiff --git a/packages/server/src/schemas/modelProvider.ts b/packages/server/src/schemas/modelProvider.tsindex 72bb8f53c..4d02ee020 100644--- a/packages/server/src/schemas/modelProvider.ts+++ b/packages/server/src/schemas/modelProvider.ts@@ -24,6 +24,7 @@ const WELL_KNOWN_BASE_URL_TYPES = ['fireworks','zai','moonshot',+ 'together',] as const satisfies readonly VercelAIProviderName[];/** `alibaba` scopes its endpoint to the caller's workspace, `custom` is arbitrary by definition. */@@ -43,6 +44,7 @@ export const PROVIDER_DEFAULT_BASE_URLS: Partial<Record<ProviderType, string>> =fireworks: 'https://api.fireworks.ai/inference/v1',zai: 'https://api.z.ai/api/paas/v4',moonshot: 'https://api.moonshot.ai/v1',+ together: 'https://api.together.xyz/v1',};export const ModelPropertiesSchema = z