






@chainfuse/ai-tools
Vercel AI SDK plugin for multi-model and provider selection built for edge runtimes. Just replace model
property and continue using vercel ai sdk as normal.
Compatability
Usage
import { AiModels } from '@chainfuse/types';
import { generateText } from 'ai';
import { AiModel } from '@chainfuse/ai-tools';
generateText({
model: await new AiModel(
{
gateway: {
accountId: 'cf account id',
apiToken: 'cf ai gateway token with run permission',
},
geoRouting: {
userCoordinate: {
lat: 'latitude as a string to preserve 0 placement',
lon: 'longitude as a string to preserve 0 placement',
},
country: 'ISO 3166-1 Alpha 2 country code',
continent: 'two-letter code of continent',
},
environment: 'the gateway to use',
providers: {
},
},
).wrappedLanguageModel(args, 'AiModels.LanguageModels enum or service name', 'if no enum, then model name (includes autofill typescript types based on service name)'),
});