Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion apps/sim/app/_shell/providers/session-provider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,18 @@ function renderProvider(): Harness {
}
}

/** Flush pending microtasks inside an act() boundary. */
/**
* Flush pending work inside an act() boundary. Drains the microtask queue and
* then yields one macrotask tick, so React Query's notifyManager (which can
* schedule observer notifications on a timer) and any deferred renders settle
* deterministically — microtask-only flushing raced the query→render update.
*/
async function flush() {
await act(async () => {
await Promise.resolve()
await Promise.resolve()
await Promise.resolve()
await new Promise<void>((resolve) => setTimeout(resolve, 0))
})
}

Expand Down
10 changes: 10 additions & 0 deletions apps/sim/components/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3439,6 +3439,16 @@ export const DeepseekIcon = (props: SVGProps<SVGSVGElement>) => (
</svg>
)

export const SakanaIcon = (props: SVGProps<SVGSVGElement>) => (
<svg {...props} height='1em' viewBox='152 5 38 30' width='1em' xmlns='http://www.w3.org/2000/svg'>
<title>Sakana AI</title>
<path
d='m187.2 7.8-2.5-0.7c-6.3-1.8-12.7-1.2-18 1.5l-10.2 5.7c-1.2 0.7-0.2 2.5 1 1.8l7.6-4.4c0.8 1.7 1.5 4 1.1 7.7-1.4-0.3-6-1.4-10.9 1.5-0.6 0.3-0.8 1.1-0.3 1.7 0.5 0.5 1.2 0.3 1.3 0.2 2.2-1.3 5.6-2.4 9.6-1.4-0.7 2.5-2.5 5.6-6 7.8-1.5 0.7-0.4 2.3 0.7 1.8 1.8-1 5.3-3.4 6.9-9 2.1 0.9 4.2 2.4 5.9 4.6l-7.2 4.1c-1.2 0.6-0.3 2.4 1.1 1.7l9-5c4.6-2.7 8.3-7.5 10.1-13.1l1.3-5.3c0.4-0.4 0-1.1-0.5-1.2zm-11.5 17.5-0.6 0.4c-2-2.6-4.5-4.7-7.5-5.7 0.5-3.8-0.3-6.8-1.2-9.1l1.1-0.6c4.8-2 9.8-2.7 16.2-0.9l1.6 0.4-0.8 2.7c-1.5 4.9-4.5 9.6-8.8 12.8z'
fill='#E60000'
/>
</svg>
)

export function GeminiIcon(props: SVGProps<SVGSVGElement>) {
const id = useId()
const gradientId = `gemini_gradient_${id}`
Expand Down
5 changes: 5 additions & 0 deletions apps/sim/lib/tokenization/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export const TOKENIZATION_CONFIG = {
confidence: 'medium',
supportedMethods: ['heuristic', 'fallback'],
},
sakana: {
avgCharsPerToken: 4,
confidence: 'medium',
supportedMethods: ['heuristic', 'fallback'],
},
ollama: {
avgCharsPerToken: 4,
confidence: 'low',
Expand Down
6 changes: 5 additions & 1 deletion apps/sim/providers/attachments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export type AttachmentProvider =
| 'xai'
| 'deepseek'
| 'cerebras'
| 'sakana'

export interface PreparedProviderAttachment {
file: UserFile
Expand Down Expand Up @@ -118,7 +119,7 @@ const BEDROCK_DOCUMENT_FORMATS = new Set([
const BEDROCK_IMAGE_FORMATS = new Set(['png', 'jpeg', 'jpg', 'gif', 'webp'])
const BEDROCK_VIDEO_FORMATS = new Set(['mp4', 'mov', 'mkv', 'webm'])

const UNSUPPORTED_FILE_PROVIDERS = new Set<AttachmentProvider>(['deepseek', 'cerebras'])
const UNSUPPORTED_FILE_PROVIDERS = new Set<AttachmentProvider>(['deepseek', 'cerebras', 'sakana'])

const PROVIDER_SUPPORTED_LABELS: Record<AttachmentProvider, string> = {
openai: 'images and documents through the Responses API input_image/input_file parts',
Expand All @@ -137,6 +138,7 @@ const PROVIDER_SUPPORTED_LABELS: Record<AttachmentProvider, string> = {
xai: 'images through image_url message parts on Grok vision models',
deepseek: 'no file attachments in the current API adapter',
cerebras: 'no file attachments in the current API adapter',
sakana: 'no file attachments in the current API adapter',
}

export function getAttachmentProvider(providerId: ProviderId | string): AttachmentProvider | null {
Expand All @@ -156,6 +158,7 @@ export function getAttachmentProvider(providerId: ProviderId | string): Attachme
if (providerId === 'xai') return 'xai'
if (providerId === 'deepseek') return 'deepseek'
if (providerId === 'cerebras') return 'cerebras'
if (providerId === 'sakana') return 'sakana'
return null
}

Expand Down Expand Up @@ -303,6 +306,7 @@ function isMimeTypeSupportedByProvider(
return isImageMimeType(mimeType)
case 'deepseek':
case 'cerebras':
case 'sakana':
return false
default: {
const _exhaustive: never = provider
Expand Down
32 changes: 32 additions & 0 deletions apps/sim/providers/models.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,35 @@ describe('orderModelIdsByReleaseDate', () => {
expect([...ordered].sort()).toEqual([...input].sort())
})
})

describe('sakana provider definition', () => {
const sakana = PROVIDER_DEFINITIONS.sakana

it('is registered with fugu as the default model', () => {
expect(sakana).toBeDefined()
expect(sakana.id).toBe('sakana')
expect(sakana.defaultModel).toBe('fugu')
expect(sakana.modelPatterns).toEqual([/^fugu/])
})

it('exposes fugu and fugu-ultra with a 1M context window', () => {
expect(sakana.models.map((m) => m.id)).toEqual(['fugu', 'fugu-ultra'])
for (const model of sakana.models) {
expect(model.contextWindow).toBe(1000000)
}
})

it('prices both models at the documented fugu-ultra ceiling', () => {
for (const model of sakana.models) {
expect(model.pricing.input).toBe(5)
expect(model.pricing.output).toBe(30)
expect(model.pricing.cachedInput).toBe(0.5)
}
})

it('routes bare fugu model IDs to the sakana provider', () => {
const baseModels = getBaseModelProviders()
expect(baseModels.fugu).toBe('sakana')
expect(baseModels['fugu-ultra']).toBe('sakana')
})
})
42 changes: 42 additions & 0 deletions apps/sim/providers/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
OllamaIcon,
OpenAIIcon,
OpenRouterIcon,
SakanaIcon,
TogetherIcon,
VertexIcon,
VllmIcon,
Expand Down Expand Up @@ -2197,6 +2198,47 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
},
],
},
sakana: {
id: 'sakana',
name: 'Sakana AI',
description: "Sakana AI's Fugu multi-agent models via an OpenAI-compatible API",
defaultModel: 'fugu',
modelPatterns: [/^fugu/],
icon: SakanaIcon,
color: '#E60000',
capabilities: {
temperature: { min: 0, max: 2 },
toolUsageControl: true,
},
models: [
{
id: 'fugu',
pricing: {
input: 5,
cachedInput: 0.5,
output: 30,
updatedAt: '2026-06-22',
},
capabilities: {},
contextWindow: 1000000,
releaseDate: '2026-06-15',
speedOptimized: true,
},
{
id: 'fugu-ultra',
pricing: {
input: 5,
cachedInput: 0.5,
output: 30,
updatedAt: '2026-06-22',
},
capabilities: {},
contextWindow: 1000000,
releaseDate: '2026-06-15',
recommended: true,
},
],
},
mistral: {
id: 'mistral',
name: 'Mistral AI',
Comment thread
waleedlatif1 marked this conversation as resolved.
Expand Down
2 changes: 2 additions & 0 deletions apps/sim/providers/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { ollamaProvider } from '@/providers/ollama'
import { ollamaCloudProvider } from '@/providers/ollama-cloud'
import { openaiProvider } from '@/providers/openai'
import { openRouterProvider } from '@/providers/openrouter'
import { sakanaProvider } from '@/providers/sakana'
import { togetherProvider } from '@/providers/together'
import type { ProviderConfig, ProviderId } from '@/providers/types'
import { vertexProvider } from '@/providers/vertex'
Expand All @@ -34,6 +35,7 @@ const providerRegistry: Record<ProviderId, ProviderConfig> = {
xai: xAIProvider,
cerebras: cerebrasProvider,
groq: groqProvider,
sakana: sakanaProvider,
vllm: vllmProvider,
litellm: litellmProvider,
mistral: mistralProvider,
Expand Down
Loading
Loading