Vercel AI SDK
How to use Aramm with the Vercel AI SDK in application code.
Aramm works with the Vercel AI SDK through the OpenAI provider. The low-effort setup is the same endpoint swap used in the OpenAI SDK.
What you need
- An Aramm API key
aiand@ai-sdk/openaiinstalled- A model id such as
openai/gpt-4o
Quick setup
import { generateText } from 'ai';
import { createOpenAI } from '@ai-sdk/openai';
const aramm = createOpenAI({
baseURL: 'https://router.aramm.ai/v1',
apiKey: process.env.ARAMM_API_KEY,
});
const result = await generateText({
model: aramm('openai/gpt-4o'),
prompt: 'Say hi in one sentence.',
});
console.log(result.text);Model naming
Use the same provider/model ids you would use in the OpenAI SDK.
Verify it works
Run one text generation call and confirm the response comes back through Aramm.
Troubleshooting
401usually means the API key is missing or invalid.model not foundusually means the model id is not available in Aramm.- If the provider fails to initialize, confirm the base URL includes
/v1.