LiteLLM Integration
LiteLLM can expose multiple model services in an OpenAI-style interface. For RouteAPI, configure the custom base URL and API Key.
Environment Variable
Section titled “Environment Variable”export ROUTEAPI_KEY="your-routeapi-token"Python Example
Section titled “Python Example”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)- 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.