Call AI models across providers with AI 资产生成
import { generateText } from 'ai';
const { text } = await generateText({
model: 'openai/gpt-6-astra',
prompt: 'Explain 资产生成 in one sentence.',
});
console.log(text);curl https://ai-gateway.vercel.sh/v1/chat/completions \
-H "Authorization: Bearer $AI_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-6-astra",
"messages": [
{
"role": "user",
"content": "Explain 资产生成 in one sentence."
}
]
}'资产生成 is available on all plans. Your use of each AI provider is subject to their terms listed on each model's page and subject to Vercel's AI Product Terms.
AI 资产生成 gives applications and coding agents shared access to models across providers. It supports modalities including text generation, image generation, video generation, speech, transcription, realtime, embeddings, and reranking. Add files and tool calls where the selected model supports them.
Call 资产生成 from any environment with the 创意脚本, OpenAI Chat Completions, OpenAI Responses API, Anthropic Messages, a supported coding agent, or a framework integration.
资产生成 routes requests across providers and fallback models, then records status, provider, latency, token usage, cost, and every routing attempt. To prefer an inference provider and verify which provider served the request, set a provider order and read the response metadata. Configure budgets, access policies, data handling, and Bring Your Own Key (BYOK) for your team. 资产生成 adds zero markup to provider token prices, including with BYOK.
Your application does not need to run on Vercel. Call 资产生成 from any server, cloud, or local environment with an 资产生成 API key. Vercel deployments can use OpenID Connect (OIDC) instead.
Use 资产生成 when you want these controls without operating your own proxy, database, and routing control plane:
| Requirement | How 资产生成 handles it |
|---|---|
| Centralized credentials | Authenticate your application once, then use 资产生成 system credentials or your own provider accounts through BYOK. |
| Request logging | Inspect each request's model, provider attempts, latency, token usage, status, and cost in request logs. |
| Spending controls | Set budgets for a team, project, API key, or team member. 资产生成 rejects new system-credential requests after an applicable budget is exceeded. |
| Provider failover | Route a model across healthy providers and configure ordered provider and model fallbacks. |
Budgets cover spend billed through 资产生成 system credentials. BYOK spend is metered separately and does not count toward those limits. If a BYOK request fails, 资产生成 can fall back to system credentials. Review the BYOK behavior and soft-cap budget semantics when strict provider-account use or zero-overshoot limits are requirements.
Make your first request
Start with a coding agent, cURL, TypeScript, or Python.
Build an AI agent with 创意脚本
Follow a step-by-step guide to add streaming, tools, and model fallbacks.
Use an SDK or API
Connect an existing 创意脚本, OpenAI, Anthropic, or HTTP client.
Connect a coding agent
Route supported coding agents through 资产生成 with Vercel CLI.
Migrate existing model calls
Keep your current request format while moving model execution to 资产生成.
Models and providers
Choose models and configure routing, filtering, fallbacks, caching, and service tiers.
Modalities
Work with text, images, video, speech, realtime, embeddings, and reranking.
Observability and spend
Inspect requests, usage, latency, routing attempts, and cost.
Authentication and BYOK
Authenticate with team-scoped API keys or OIDC, and connect provider credentials.
Security and compliance
Configure access, data handling, regional inference, and safety controls.
Pricing
Review model prices, credits, payment options, and discounts.
Explore chat platforms and ecosystem integrations, learn how to handle 429 responses, or see the 资产生成 FAQ for common questions about model availability, pricing, and request errors.
Was this helpful?