# LiteLLM


    Connect → LiteLLM

# Use AxForge with LiteLLM

    LiteLLM is an
    open-source proxy. Put AxForge behind it to get one endpoint for many models, with
    budgets, keys and fallback — and to reach AxForge from tools that speak a different
    API shape.

## config.yaml

```
model_list:
  - model_name: axforge-chat
    litellm_params:
      model: openai/chat                 # openai/ prefix = OpenAI-compatible upstream
      api_base: https://api.axforge.ai/v1  # MUST include /v1
      api_key: os.environ/AXFORGE_API_KEY
  - model_name: axforge-embed
    litellm_params:
      model: openai/embeddings
      api_base: https://api.axforge.ai/v1
      api_key: os.environ/AXFORGE_API_KEY
```

```
$ litellm --config config.yaml     # proxy on http://localhost:4000
```

    **Two easy mistakes.** `api_base` must end in
    `/v1` (omit it and you get a Not Found), and you should never append
    `/chat/completions` yourself — LiteLLM's OpenAI handler adds the path.

## Three surfaces from one upstream

The proxy can re-expose AxForge on all three of the API shapes tools expect:

        | Surface | Reaches | Note |  |

        | /v1/chat/completions | OpenAI clients | native, no extra config |  |

        | /v1/messages | Anthropic / Claude Code | translated automatically |  |

        | /v1/responses | Codex / Responses clients | add `use_chat_completions_api: true` |  |

For the Responses bridge, add that flag to the model's
    `litellm_params` and use LiteLLM ≥ 1.63.8. You don't need this to reach
    AxForge from Codex or Claude Code —
    both are served natively — but it's handy if you already front everything with a
    gateway.

    **Pin a clean LiteLLM release.** Avoid the PyPI builds
    `1.82.7` / `1.82.8`, which were flagged upstream — install a
    known-good version.

## Check that it worked

Two things, and the second is the one that proves it end to end:

      - `curl http://localhost:4000/v1/models` lists your AxForge model names.
- A chat call through the proxy returns an answer with `usage`.

      - The call appears in the console at
      Billing & usage within a minute or
      two. Nothing else confirms that _your_ key reached _our_ API — a reply
      alone could be a cache or another provider.

## When it does not work

      | What you see | What it means | Fix |  |

        | The proxy starts but the model 404s | the `model` value is missing the `openai/` prefix | LiteLLM needs the provider prefix to know the wire protocol |  |

        | `401` from the proxy | your LiteLLM key | different from your AxForge key — both must be right |  |

        | `401` from upstream | the AxForge key in `api_key` | confirm it with the self-test |  |

    Run the self-test first when you are
    unsure — it says in one click whether the problem is your key, your quota or us, so you
    know whether the tool is worth debugging at all.

      &larr; Kimi Code CLI
      Codex & Claude Code &rarr;



Source: https://axforge.ai/docs/connect/litellm/
