0.0.17 • Published 7 months ago
@302ai/ai-sdk v0.0.17
AI SDK - 302AI Provider
The 302AI provider for the AI SDK contains image model support for the 302AI platform.
Setup
The 302AI provider is available in the @302ai/ai-sdk module. You can install it with
npm i @302ai/ai-sdkProvider Instance
You can import the default provider instance ai302 from @302ai/ai-sdk:
import { ai302 } from '@302ai/ai-sdk';Language Model Example
import { ai302 } from '@302ai/ai-sdk';
import { generateText } from 'ai';
const { text } = await generateText({
model: ai302('gpt-4o'),
prompt: 'Write a JavaScript function that sorts a list:',
});Language Models
Check out the 302AI API docs for more information.
gpt-3.5-turbogpt-3.5-turbo-1106gpt-3.5-turbo-16kgpt-4gpt-4-0125-previewgpt-4-0613gpt-4-1106-previewgpt-4-32kgpt-4-32k-0613gpt-4-turbo-previewgpt-3.5-turbo-0125gpt-3.5-turbo-instructclaude-3-opus-20240229claude-3-sonnet-20240229claude-3-haiku-20240307qwen-turboqwen-plusqwen-maxqwen-max-latestglm-4-0520glm-4vBaichuan2-53BBaichuan2-TurboBaichuan2-Turbo-192kmoonshot-v1-128kmoonshot-v1-32kmoonshot-v1-8kernie-4.0-8kgpt-4-turbogemini-1.5-procommand-r-plusdeepseek-chatgpt-4oqwen-longglm-4-airglm-4-flashqwen2-72b-instructqwen2-7b-instructDoubao-pro-32kDoubao-pro-128kqwen-vl-maxqwen-vl-plusclaude-3-5-sonnet-20240620step-1v-32kstep-1v-8kyi-largeyi-large-ragyi-visionyi-medium-200kgeneralv3.54.0Ultrageneralernie-4.0-turbo-8kBaichuan3-TurboBaichuan3-Turbo-128kBaichuan4XuanYuan-70B-Chat-4bitgemma2-9b-itSenseChat-5SenseChat-Turbogemini-1.5-pro-001gemini-1.5-flash-001codegeex-4google/gemma-2-27b-itgpt-4o-mini-2024-07-18llama3.1-405bllama3.1-70bllama3.1-8bmistral-large-2deepseek-ai/DeepSeek-V2.5step-2-16kcommand-rgpt-4-plusgemini-1.5-pro-exp-0827abab6.5s-chatgpt-4o-2024-08-06chatgpt-4o-latestglm-4-longgemini-1.5-pro-latesthunyuan-litehunyuan-standardhunyuan-standard-256Khunyuan-prohunyuan-codehunyuan-rolehunyuan-functioncallhunyuan-visionQwen/Qwen2-7B-Instructglm-4-plusglm-4v-pluspplx-70b-onlinepplx-8b-onlinepplx-405b-onlineo1-previewo1-preview-2024-09-12o1-minio1-mini-2024-09-12qwen-math-plusqwen2.5-72b-instructqwen2.5-32b-instructqwen2.5-14b-instructqwen2.5-3b-instructqwen2.5-math-72b-instructqwen2.5-coder-7b-instructgemini-1.5-pro-002gemini-1.5-flash-002llama3.2-90bllama3.2-11bgpt-4o-2024-05-13yi-lightningclaude-3-5-sonnet-20241022claude-3-5-sonnet-lateststep-1.5v-turboclaude-3-5-haiku-20241022grok-betagpt-4-turbo-2024-04-09gemini-exp-1114qwen-turbo-latestqwen-turbo-2024-11-01pixtral-large-2411mistral-large-2411gpt-4o-2024-11-20gpt-4o-plusernie-4.0-turbo-128kgemini-exp-1121grok-vision-betaQwen/QwQ-32B-PreviewDoubao-vision-pro-32kAIDC-AI/Marco-o1abab7-chat-previewcoder-claude-3-5-sonnet-20240620coder-claude-3-5-sonnet-20241022nova-pronova-litenova-microgemini-exp-1206qwq-32b-previewllama3.3-70bqwen-vl-ocrmeta-llama/Llama-3.3-70B-Instructo1-plusgemma-2-27bgemini-2.0-flash-expgemini-1.5-flash-8bDoubao-Vision-Lite-32kqwen2.5-coder-32b-instructo1grok-2-1212grok-2-vision-1212deepseek-ai/deepseek-vl2deepseek-vl2marco-o1gemini-2.0-flash-thinking-exp-1219qwen2.5-7b-instructo1-2024-12-17Qwen/QVQ-72B-PreviewQVQ-72B-PreviewPro/google/gemma-2-9b-itQwen/Qwen2.5-Coder-32B-InstructQwen/Qwen2-VL-72B-InstructOpenGVLab/InternVL2-26BTeleAI/TeleMMQwen/Qwen2.5-72B-Instruct-128KQwen/Qwen2.5-32B-InstructQwen/Qwen2.5-14B-InstructQwen/Qwen2.5-7B-InstructQwen/Qwen2.5-Coder-7B-InstructTeleAI/TeleChat2internlm/internlm2_5-20b-chatinternlm/internlm2_5-7b-chatmeta-llama/Meta-Llama-3.1-405B-Instructmeta-llama/Meta-Llama-3.1-8B-Instructmeta-llama/Meta-Llama-3.1-70B-InstructQwen/Qwen2-1.5B-InstructTHUDM/glm-4-9b-chatTHUDM/chatglm3-6b01-ai/Yi-1.5-9B-Chat-16K01-ai/Yi-1.5-6B-Chat01-ai/Yi-1.5-34B-Chat-16Kgoogle/gemma-2-9b-itVendor-A/Qwen/Qwen2.5-72B-InstructPro/Qwen/Qwen2.5-Coder-7B-InstructPro/Qwen/Qwen2-VL-7B-InstructPro/OpenGVLab/InternVL2-8BPro/Qwen/Qwen2.5-7B-InstructPro/meta-llama/Meta-Llama-3.1-8B-InstructPro/Qwen/Qwen2-7B-InstructPro/Qwen/Qwen2-1.5B-InstructPro/THUDM/glm-4-9b-chatMiniMax-Text-01moonshot-v1-8k-vision-previewmoonshot-v1-32k-vision-previewmoonshot-v1-128k-vision-previewclaude-3-5-haiku-latestclaude-3-5-haiku
Embedding Model Example
import { ai302 } from '@302ai/ai-sdk';
import { embed } from 'ai';
const { embedding, usage } = await embed({
model: ai302.textEmbeddingModel('BAAI/bge-large-en-v1.5'),
value: 'sunny day at the beach',
});Embedding Models
Check out the 302AI API docs for more information.
text-embedding-3-smalltext-embedding-3-largetext-embedding-ada-002zhipu-embedding-2BAAI/bge-large-en-v1.5BAAI/bge-large-zh-v1.5BAAI/bge-m3Baichuan-Text-Embeddingbce-embedding-base_v1
Image Model Examples
import { ai302 } from '@302ai/ai-sdk';
import { experimental_generateImage as generateImage } from 'ai';
import fs from 'fs';
const { image } = await generateImage({
model: ai302.image('midjourney/6.1'),
prompt: 'A serene mountain landscape at sunset',
});
const filename = `image-${Date.now()}.png`;
fs.writeFileSync(filename, image.uint8Array);
console.log(`Image saved to ${filename}`);Image Models
Check out the 302AI API docs for more information.
flux-v1.1-ultraflux-pro-v1.1flux-proflux-devflux-schnellideogram/V_1ideogram/V_1_TURBOideogram/V_2ideogram/V_2_TURBOideogram/V_2Aideogram/V_2A_TURBOdall-e-3recraftv3recraftv2sdxl-lightning-v2kolorsaura-flowphoton-1photon-flash-1sdxlsd3-ultrasd3v2sd3.5-largesd3.5-large-turbosd3.5-mediummidjourney/6.1midjourney/6.0midjourney/7.0nijijourney/6.0google-imagen-3google-imagen-3-fastgoogle-imagen-4-previewdoubao-general-v2.1-ldoubao-general-v2.0-ldoubao-general-v2.0lumina-image-v2omnigen-v1playground-v25minimaxi-image-01cogview-4cogview-4-250304irag-1.0hidream-i1-fullhidream-i1-devhidream-i1-fastideogram/V_3_DEFAULTideogram/V_3_QUALITYideogram/V_3_TURBO
Documentation
Please check out the Vercel AI SDK for more information.
0.0.17
7 months ago
0.0.16
8 months ago
0.0.15
8 months ago
0.0.14
8 months ago
0.0.13
8 months ago
0.0.12
8 months ago
0.0.11
8 months ago
0.0.10
9 months ago
0.0.9
10 months ago
0.0.8
10 months ago
0.0.7
11 months ago
0.0.6
11 months ago
0.0.5
11 months ago
0.0.4
11 months ago
0.0.3
11 months ago
0.0.2
11 months ago
1.0.0
11 months ago
0.0.0
11 months ago