进阶 www.newapi.ai 2026-11-23 02:52:54 · 0 阅读
第2章 New API Open-Source AI Gateway: Model Routing, Keys and Usage
How New API worksA product guide to the New API open-source AI gateway: how requests flow, what you can configure, and where to find the setup instructions.AGPLv3 · Self-hosted · OpenAI / Claude / GeminiDeployment docsOn this pageHow a request flows through New APIWhen several apps need access to different models, an AI gateway gives you a place to manage connections, access and usage. New API brings these settings into a web console you can host yourself.The path of a model requestApps and AI agentsChat apps, development tools and your own services.New APIAccess tokensChannel routingUsage recordsYour model providersOpenAI, Anthropic, Gemini and compatible model services.New API checks the access token and selects a channel before sending the request to your configured model provider. The response returns through the gateway to your app.When do you need an AI gateway?Share model access with your teamCreate tokens for people or applications, with model permissions, quotas, expiry dates and IP restrictions. Manage upstream channels in the gateway.Connect apps to multiple modelsPoint clients at your gateway to use configured models. Check the API documentation for protocol, parameter and model support before integrating with your app.Understand requests and costsReview requests, token usage and charges in one place. Investigate failed calls and adjust channel priorities, weights and billing settings for your workload.Capabilities and configurationChoose the settings your applications need. Each capability links to documentation with setup steps and supported behavior.Models and protocolsConnect multiple providers through OpenAI, Claude, Gemini and other interfaces, with protocol conversion. Endpoint, parameter and conversion support depends on the model and channel type.Explore the API referenceRouting and failoverConfigure several channels for a model and distribute requests using priorities and weights. Use retry and channel status settings to handle upstream failures.Configure channelsTokens and access limitsIssue separate application tokens with quotas, expiry dates, model permissions and IP allowlists. Manage access in the console.Manage access tokensUsage and cost accountingInspect model prices and multipliers, and record costs using configured billing rules. Settings cover usage, per-call charges and cached tokens.Understand pricingRequest recordsReview models, token counts, latency and charges for your calls. Filter usage logs to investigate requests and changes in consumption.Explore usage logsGeneration task pluginsConnect image, video and music generation services through task plugins. Review each plugin's models, configuration and API documentation.Read the plugin docsFeatures and protocol support change between releases. Check the documentation for your version and test your models, clients and request parameters.Deployment and integrationStart the gateway, connect a model provider, then issue a token for your application.1Start a New API instanceChoose Docker, Docker Compose or another documented deployment method. Configure the database and persistent storage.Choose a deployment method2Add a model channelEnter an authorized upstream endpoint and credentials, configure available models, then test the connection.Add and test a channel3Create an application tokenSet model permissions and a quota. Enter your gateway address and token in the client, then send a test request.Create an API tokenFrequently asked questionsDoes New API include models or API credits?New API provides gateway software and a management console. Connect your own model providers or compatible endpoints with the required credentials. Hosting and upstream model usage have their own costs.Where does request data go when I self-host?The gateway runs on your infrastructure and sends request content to the model provider you configure. Third-party providers still process those requests. For local inference, connect your own compatible model endpoint and check the complete data flow.How does cached-token billing differ from response caching?Cached-token billing uses cache usage reported by the provider and your configured multipliers to calculate charges. Gateway response caching stores and reuses complete responses. Check the current documentation and provider behavior when evaluating either capability.How can I use the open-source version?New API is distributed under AGPLv3 and the additional terms in the project's LICENSE. Read LICENSE and NOTICE in the repository before deploying, modifying or distributing it. The project documentation includes commercial cooperation and licensing contacts.Back to homeExplore task plugins
上一篇
第1章 New API - Self-Hosted AI Gateway for Secure AI Access
下一篇
第3章 New API Plugins - Model Adapters and Generation Tasks