Loading
Loading
Three steps: a key, credits, your first request. The API follows the OpenAI contract — in the official SDK, only base_url changes.
https://llmproxy.org/v1.Send the key in the Authorization: Bearer sk-max-… header. Keep it in an environment variable, not in your code or repository.
from openai import OpenAIimport os client = OpenAI( base_url="https://llmproxy.org/v1", api_key=os.environ["LLMPROXY_API_KEY"],)
Pass an id from the catalog or from GET https://llmproxy.org/v1/models in model. The example uses the cheapest chat model in the catalog.
from openai import OpenAIimport os client = OpenAI( base_url="https://llmproxy.org/v1", # the only difference from OpenAI api_key=os.environ["MAXAI_API_KEY"],) resp = client.chat.completions.create( model="mistralai/mistral-nemo", messages=[{"role": "user", "content": "Explain what an API gateway is in two sentences."}], stream=True,)for chunk in resp: print(chunk.choices[0].delta.content or "", end="")
user if you have end users of your own.