Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Metorial + TogetherAI

Uses TogetherAI-hosted models with Metorial MCP tools. TogetherAI provides an OpenAI-compatible API, so the code uses the openai package.

Environment variables

Run

bun install
bun start

How it works

import { metorialTogetherAi } from '@metorial/togetherai';
import { Metorial } from 'metorial';
import OpenAI from 'openai';

// Initialize the TogetherAI client as an OpenAI client with Together's base URL.
let metorial = new Metorial({ apiKey: process.env.METORIAL_API_KEY! });

let togetherai = new OpenAI({
  apiKey: process.env.TOGETHERAI_API_KEY || process.env.TOGETHER_API_KEY!,
  baseURL: 'https://api.together.xyz/v1'
});

// The session and tool call loop follow the same pattern as OpenAI. The `metorialTogetherAi`
// adapter formats tools for Together's API. This example uses `Qwen/Qwen3.5-397B-A17B`,
// but you can swap in any Together-hosted model that supports function calling.
let response = await togetherai.chat.completions.create({
  model: 'Qwen/Qwen3.5-397B-A17B',
  messages,
  tools: session.tools()
});

Adding OAuth providers

Uncomment the OAuth section in src/index.ts to add providers like GitHub or Slack. See the main README for details.