Llama provider

Related Documentation
Minimum Version
AI Gateway - 2.0
Incompatible with
on-prem
Tags
#ai
Previous Versions of this page

You can proxy requests to Llama2 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 Llama2 API endpoints. The following table shows the upstream paths used for each capability.

Capability

Path template

Description

Upstream path or API

Generate /chat/completions, /completions, or /responses Text generation for chat completions and responses User-defined
Embeddings /embeddings Vector embeddings from text input User-defined

Supported capabilities

The following tables show the AI capabilities supported by the Llama2 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 Llama2 text generation capabilities:

Capability

Streaming

Model example

Path template

Min version

generate Supported User-defined /chat/completions, /completions, or /responses 2.0

Embeddings

Support for Llama2 embeddings generation:

Capability

Model example

Path template

Min version

embeddings User-defined /embeddings 2.0

Llama2 base URL

The base URL is $UPSTREAM_URL.

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

Configure Llama2

To use Llama2 with AI Gateway, configure a new AI Model Provider. You can then access supported AI Models from Llama2.

Here’s a minimal configuration for chat completions:

Configure a model target for Llama2

A target is an entry in the targets array on the AI Model entity, not the AI Model Provider. Beyond the common target options (name, provider, weight), a target routing to Llama2 requires:

  • upstream_url: The URL of your self-hosted Llama model endpoint.
  • format: The request format your endpoint expects. One of ollama, openai, or raw.
targets:
  - name: llama-3-70b
    provider: my-llama2-account
    config:
      type: llama2
      upstream_url: https://my-llama-endpoint.internal:8000
      format: openai

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!