@tsdiapi/together v0.1.0
together Plugin for TSDIAPI
A TSDIAPI plugin to extend API functionality with Together AI.
š About
This is a TSDIAPI plugin designed to integrate Together AI models into your API. It provides an easy way to interact with Together AI for text generation, image analysis, and more.
š TSDIAPI CLI: @tsdiapi/cli
š¦ Installation
Install the plugin using the TSDIAPI CLI:
tsdiapi plugins add together
You can install this plugin using npm:
npm install --save @tsdiapi/together
Then, register the plugin in your TSDIAPI project:
import { createApp } from "@tsdiapi/server";
import createPlugin from "@tsdiapi/together";
createApp({
plugins: [createPlugin()],
});
š Features
- š Seamless integration with Together AI inside TSDIAPI.
- šØ Supports text and image-based AI models.
- ā Highly configurable with environment variables and plugin options.
- š Tracks token usage for cost management.
š§ Configuration Options
This plugin supports both direct options and environment variables for flexible configuration.
Plugin Options
createPlugin({
apiKey: "your-api-key",
model: "meta-llama/Llama-Vision-Free",
maxTokens: 200,
temperature: 0.3,
topP: 0.7,
topK: 50,
repetitionPenalty: 1.2,
});
Option | Type | Default | ENV Variable | Description |
---|---|---|---|---|
apiKey | string | "" | TOGETHER_API_KEY | Together AI API key (Required) |
model | string | "meta-llama/Llama-Vision-Free" | TOGETHER_DEFAULT_MODEL | Default Together AI model to use |
maxTokens | number | 200 | TOGETHER_MAX_TOKENS | Maximum number of tokens per response |
temperature | number | 0.3 | TOGETHER_TEMPERATURE | Sampling temperature for response randomness |
topP | number | 0.7 | TOGETHER_TOP_P | Top-p (nucleus sampling) value |
topK | number | 50 | TOGETHER_TOP_K | Top-k sampling value |
repetitionPenalty | number | 1.2 | TOGETHER_REPETITION_PENALTY | Repetition penalty for controlling repeated responses |
Using Environment Variables
Instead of defining options in the code, you can set them as environment variables:
TOGETHER_API_KEY=your-api-key
TOGETHER_DEFAULT_MODEL=meta-llama/Llama-Vision-Free
TOGETHER_MAX_TOKENS=200
TOGETHER_TEMPERATURE=0.3
TOGETHER_TOP_P=0.7
TOGETHER_TOP_K=50
TOGETHER_REPETITION_PENALTY=1.2
š How to Use
After installation, you can use the Together AI provider to generate text and analyze images.
Get Together Provider
import { getTogetherProvider } from "@tsdiapi/together";
const together = getTogetherProvider();
Basic Chat Completion
const response = await together.chat("Tell me a joke!");
console.log(response.result);
Analyze an Image
const response = await together.analyzeImage(
"https://example.com/image.jpg",
"Describe this image."
);
console.log(response.result);
š Related Plugins
You can find more TSDIAPI plugins here:
š Available Plugins
šØāš» Contributing
Contributions are always welcome! Feel free to submit issues or pull requests to improve this plugin.
š§ Contact: unbywyd@gmail.com
š Happy coding with TSDIAPI & Together AI! š