together-reference-architecture
Together AI reference architecture for inference, fine-tuning, and model deployment. Use when working with Together AI's OpenAI-compatible API. Trigger: "together reference architecture".
Best use case
together-reference-architecture is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Together AI reference architecture for inference, fine-tuning, and model deployment. Use when working with Together AI's OpenAI-compatible API. Trigger: "together reference architecture".
Teams using together-reference-architecture should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/together-reference-architecture/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How together-reference-architecture Compares
| Feature / Agent | together-reference-architecture | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Together AI reference architecture for inference, fine-tuning, and model deployment. Use when working with Together AI's OpenAI-compatible API. Trigger: "together reference architecture".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# Together AI Reference Architecture
## Overview
Production architecture for AI inference, fine-tuning, and batch processing with Together AI's OpenAI-compatible API. Designed for teams routing requests across 100+ open-source models (Llama, Mixtral, Qwen, FLUX) with intelligent model selection, response caching, fine-tune pipeline management, and cost optimization via batch inference at 50% discount. Key design drivers: model routing for cost/quality tradeoffs, inference caching for repeated queries, fine-tune lifecycle management, and graceful degradation across model providers.
## Architecture Diagram
```
Application ──→ Model Router ──→ Cache (Redis) ──→ Together API (v1)
↓ /chat/completions
Queue (Bull) ──→ Batch Worker /completions
↓ /images/generations
Fine-Tune Manager ──→ Together API /fine-tunes
↓ /models
Cost Tracker ──→ Analytics Dashboard
```
## Service Layer
```typescript
class InferenceService {
constructor(private together: TogetherClient, private cache: CacheLayer, private router: ModelRouter) {}
async complete(request: InferenceRequest): Promise<InferenceResponse> {
const model = this.router.selectModel(request.task, request.priority);
const cacheKey = `inference:${model}:${this.hashPrompt(request.prompt)}`;
const cached = await this.cache.get(cacheKey);
if (cached && request.allowCached) return cached;
const response = await this.together.chatCompletions({ model, messages: request.messages, temperature: request.temperature ?? 0.7 });
await this.cache.set(cacheKey, response, CACHE_CONFIG.inference.ttl);
await this.costTracker.record(model, response.usage);
return response;
}
async submitBatch(requests: InferenceRequest[]): Promise<string> {
const batchId = await this.together.createBatch(requests.map(r => ({
model: this.router.selectModel(r.task, 'batch'), messages: r.messages })));
return batchId; // 50% cost reduction for batch processing
}
}
```
## Caching Strategy
```typescript
const CACHE_CONFIG = {
inference: { ttl: 3600, prefix: 'infer' }, // 1 hr — deterministic prompts (temp=0) cache well
embeddings: { ttl: 86400, prefix: 'embed' }, // 24 hr — embeddings are stable for same input
modelList: { ttl: 3600, prefix: 'models' }, // 1 hr — available models change infrequently
fineTune: { ttl: 60, prefix: 'ft' }, // 1 min — training status needs near-real-time
batchStatus: { ttl: 30, prefix: 'batch' }, // 30s — batch completion polling
};
// Cache only temp=0 responses by default; stochastic responses bypass cache unless explicitly opted in
```
## Event Pipeline
```typescript
class InferencePipeline {
private queue = new Bull('together-events', { redis: process.env.REDIS_URL });
async onFineTuneComplete(event: FineTuneEvent): Promise<void> {
await this.queue.add('deploy-model', event, { attempts: 3, backoff: { type: 'exponential', delay: 5000 } });
}
async processFineTuneEvent(event: FineTuneEvent): Promise<void> {
if (event.status === 'completed') {
await this.router.registerModel(event.modelId, { task: event.task, cost: event.inferCostPerToken });
await this.runEvalSuite(event.modelId, event.evalDataset);
}
if (event.status === 'failed') await this.notifyTeam(event.error);
}
async processBatchComplete(batchId: string): Promise<void> {
const results = await this.together.getBatchResults(batchId);
await this.storeResults(results);
await this.costTracker.recordBatch(batchId, results.usage);
}
}
```
## Data Model
```typescript
interface InferenceRequest { task: 'chat' | 'code' | 'embedding' | 'image'; messages: Message[]; prompt?: string; temperature?: number; priority: 'realtime' | 'standard' | 'batch'; allowCached?: boolean; }
interface ModelRoute { modelId: string; task: string; costPerToken: number; latencyP50Ms: number; qualityScore: number; }
interface FineTuneJob { id: string; baseModel: string; trainingFile: string; status: 'pending' | 'running' | 'completed' | 'failed'; epochs: number; learningRate: number; }
interface CostRecord { model: string; promptTokens: number; completionTokens: number; costUsd: number; timestamp: string; }
```
## Scaling Considerations
- Route low-priority requests to cheaper models (Llama 8B) and high-priority to larger models (Llama 70B, Mixtral)
- Use batch API for non-interactive workloads — 50% cost savings with acceptable latency tradeoff
- Cache embeddings aggressively — identical text produces identical vectors, high cache hit rate
- Monitor per-model cost and latency; auto-shift traffic when a model degrades or pricing changes
- Fine-tune pipeline should use a separate API key with isolated rate limits from production inference
## Error Handling
| Component | Failure Mode | Recovery |
|-----------|-------------|----------|
| Inference request | Model overloaded (500) | Fallback to alternative model in same task category |
| Rate limiting | 429 Too Many Requests | Token bucket with exponential backoff, queue overflow to batch |
| Fine-tune job | Training divergence | Auto-stop on loss plateau, notify team with checkpoint artifacts |
| Batch processing | Partial batch failure | Retry failed items individually, report partial results |
| Model routing | Selected model deprecated | Auto-reroute to replacement model, alert team to update config |
## Resources
- [Together AI Docs](https://docs.together.ai/)
- [API Reference](https://docs.together.ai/reference/chat-completions-1)
- [Model List](https://docs.together.ai/docs/inference-models)
## Next Steps
See `together-deploy-integration`.Related Skills
workhuman-reference-architecture
Workhuman reference architecture for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman reference architecture".
wispr-reference-architecture
Wispr Flow reference architecture for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr reference architecture".
windsurf-reference-architecture
Implement Windsurf reference architecture with optimal project structure and AI configuration. Use when designing workspace configuration for Windsurf, setting up team standards, or establishing architecture patterns that maximize Cascade effectiveness. Trigger with phrases like "windsurf architecture", "windsurf project structure", "windsurf best practices", "windsurf team setup", "optimize for cascade".
windsurf-architecture-variants
Choose workspace architectures for different project scales in Windsurf. Use when deciding how to structure Windsurf workspaces for monorepos, multi-service setups, or polyglot codebases. Trigger with phrases like "windsurf workspace strategy", "windsurf monorepo", "windsurf project layout", "windsurf multi-service", "windsurf workspace size".
webflow-reference-architecture
Implement Webflow reference architecture — layered project structure, client wrapper, CMS sync service, webhook handlers, and caching layer for production integrations. Trigger with phrases like "webflow architecture", "webflow project structure", "how to organize webflow", "webflow integration design", "webflow best practices".
vercel-reference-architecture
Implement a Vercel reference architecture with layered project structure and best practices. Use when designing new Vercel projects, reviewing project structure, or establishing architecture standards for Vercel applications. Trigger with phrases like "vercel architecture", "vercel project structure", "vercel best practices layout", "how to organize vercel project".
vercel-architecture-variants
Choose and implement Vercel architecture blueprints for different scales and use cases. Use when designing new Vercel projects, choosing between static, serverless, and edge architectures, or planning how to structure a multi-project Vercel deployment. Trigger with phrases like "vercel architecture", "vercel blueprint", "how to structure vercel", "vercel monorepo", "vercel multi-project".
veeva-reference-architecture
Veeva Vault reference architecture for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva reference architecture".
vastai-reference-architecture
Implement Vast.ai reference architecture for GPU compute workflows. Use when designing ML training pipelines, structuring GPU orchestration, or establishing architecture patterns for Vast.ai applications. Trigger with phrases like "vastai architecture", "vastai design pattern", "vastai project structure", "vastai ml pipeline".
twinmind-reference-architecture
Production architecture for meeting AI systems using TwinMind: transcription pipeline, memory vault, action item workflow, and calendar integration. Use when implementing reference architecture, or managing TwinMind meeting AI operations. Trigger with phrases like "twinmind reference architecture", "twinmind reference architecture".
together-webhooks-events
Together AI webhooks events for inference, fine-tuning, and model deployment. Use when working with Together AI's OpenAI-compatible API. Trigger: "together webhooks events".
together-upgrade-migration
Together AI upgrade migration for inference, fine-tuning, and model deployment. Use when working with Together AI's OpenAI-compatible API. Trigger: "together upgrade migration".