Baseten provider

Related Documentation
Minimum Version
AI Gateway - 2.3
Tags
#ai

You can proxy requests to Baseten AI models through AI Gateway by creating AI Model Provider and AI Model entities. This reference documents all supported AI capabilities, configuration requirements, and provider-specific details needed for proper integration.

Upstream paths

AI Gateway automatically routes requests to the appropriate Baseten API endpoints. The following table shows the upstream paths used for each capability.

Capability

Path template

Description

Upstream path or API

Generate /chat/completions or /completions Text generation for chat completions /v1/chat/completions

Supported capabilities

The following tables show the AI capabilities supported by the Baseten provider when configuring AI Models.

By default, AI Gateway uses the path templates shown in the tables below (e.g., /chat/completions, /embeddings, etc.). To customize these paths, configure the config.paths field in your AI Model entity. Custom paths take the form {configured_path}/{template_path} — for example, if you set a custom path of /v2, requests to /embeddings would be routed to /v2/embeddings.

Text generation

Support for Baseten text generation capabilities:

Capability

Streaming

Model example

Path template

Min version

generate1 Supported deepseek-ai/DeepSeek-V4-Pro-0813 /chat/completions or /completions 2.3

1 Model APIs use the org-qualified model slug as the target name. For a dedicated deployment, set the target upstream_url to the deployment endpoint.

Baseten base URL

The base URL is https://inference.baseten.co/v1/{capability_path} or https://model-{model_id}.api.baseten.co/environments/{environment}/sync/v1/chat/completions. The {capability_path} is determined by the AI capability.

AI Gateway uses this URL automatically. You only need to configure a URL if you’re using a self-hosted or Baseten-compatible endpoint, in which case set the upstream_url option in your AI Model configuration.

Baseten limitations

Baseten has the following limitations in AI Gateway:

  • The Baseten provider proxies chat completions only. It doesn’t support Baseten’s Anthropic-compatible /v1/messages endpoint, embeddings, or the /predict and async inference APIs.

  • Baseten rejects some OpenAI request parameters. audio, modalities, prediction, web_search_options, and n greater than 1 return a 400 error, service_tier returns a 500 error, and the deprecated function_call and functions return a 501 error.

  • Baseten accepts but ignores logprobs, top_logprobs, user, store, metadata, verbosity, safety_identifier, and the explicit prompt cache controls. Baseten caches prompts automatically.

Configure a Baseten provider

To use Baseten with AI Gateway, configure a new AI Model Provider. You can then route AI Models to Baseten Model APIs or to your own dedicated Baseten deployments.

Create an AI Model Provider entity to store your Baseten API key. Baseten authenticates with an Authorization header:

The same API key authenticates to both Model APIs and dedicated deployments in your Baseten workspace. One AI Model Provider can serve both kinds of target.

Configure a Baseten model

Baseten supports the generate capability (chat completions), with and without streaming. Each target on the AI Model references the Baseten provider and sets config.type to baseten. How you set the target name and upstream_url depends on whether the model runs on Baseten Model APIs or on a dedicated deployment.

Use Model APIs for the shared, hosted models in the Baseten model library. Use a dedicated deployment when you need dedicated GPUs or control over hardware and scaling.

Model APIs

By default, AI Gateway sends requests to Baseten Model APIs at https://inference.baseten.co/v1. Set the target name to the model’s slug, which includes the organization prefix, from the Baseten model library. For example, use deepseek-ai/DeepSeek-V4-Pro-0813 or openai/gpt-oss-120b:

Dedicated deployments

To route to a model you deployed on Baseten, set the target upstream_url to the deployment’s full chat completions endpoint:

https://model-MODEL_ID.api.baseten.co/environments/ENVIRONMENT/sync/v1/chat/completions

Replace MODEL_ID with the model ID from your Baseten dashboard. Replace ENVIRONMENT with the deployment environment, for example production. Set the target name to the model name your deployment serves. For engines that take a --served-model-name flag, such as vLLM, use that value:

targets:
  - name: SERVED_MODEL_NAME
    provider: my-baseten-account
    config:
      type: baseten
      upstream_url: https://model-MODEL_ID.api.baseten.co/environments/production/sync/v1/chat/completions

If your deployment exposes an API that the generate capability doesn’t cover, use the passthrough format instead. Set formats[].type to passthrough on the AI Model.

Reasoning and usage

AI Gateway applies the following to Baseten requests and responses:

  • Reasoning output: Baseten models return reasoning text in either reasoning_content or thinking. AI Gateway normalizes both to reasoning, in non-streaming responses and in streaming deltas.
  • Reasoning effort: AI Gateway forwards reasoning_effort unchanged. Baseten validates the value against the accepted values of the target model.
  • Cached tokens: When Baseten reports usage.prompt_tokens_details.cached_tokens, AI Gateway includes it in the response, the streaming usage event, and the logs.

The model field in responses contains the target name, for example deepseek-ai/DeepSeek-V4-Pro-0813.

To call the AI Model, send its name in the model field of the request. For more information, see Request routing rules.

Looking for on-prem configuration? Convert the kongctl configuration to a decK yaml file and use deck file ai2kong. See Configure Kong AI Gateway on-prem for more information.

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!