Подключение LiteLLM
LiteLLM can expose multiple model services in an OpenAI-style interface. For RouteAPI, configure the custom base URL and API Key.
Переменная окружения
Section titled “Переменная окружения”export ROUTEAPI_KEY="your-routeapi-token"Пример Python
Section titled “Пример Python”import litellmimport os
response = litellm.completion( model="openai/gpt-4o", api_base="https://www.routeapi.ai/v1", api_key=os.environ["ROUTEAPI_KEY"], messages=[{"role": "user", "content": "Hello RouteAPI"}],)
print(response.choices[0].message.content)Примечания
Section titled “Примечания”- LiteLLM model names may include a provider prefix; whether it is required depends on your LiteLLM configuration.
- RouteAPI still processes requests according to the model IDs and capabilities available in the console.