From 29328eebd8b7bde921319b249a4a40fb445d7c0a Mon Sep 17 00:00:00 2001 From: Guilherme Soubihe Date: Mon, 2 Feb 2026 15:41:22 -0300 Subject: [PATCH] feat(providers): add Latitude AI as OpenAI-compatible provider Adds Latitude AI (https://latitude.sh) as a new inference provider. ## Changes - Add Latitude to openai_like/providers.json - Add model pricing for 7 models in model_prices_and_context_window.json - Add documentation in docs/providers/latitude.md ## Models Added - latitude/qwen-2.5-7b (131K context) - latitude/llama-3.1-8b (128K context) - latitude/qwen3-32b (131K context) - latitude/gemma-2-27b (8K context) - latitude/deepseek-r1-distill-14b (64K context) - latitude/qwen2.5-coder-32b (131K context) - latitude/qwen-2.5-vl-7b (32K context, vision) ## Features Supported - Streaming - Tool/function calling - JSON mode - Vision (qwen-2.5-vl-7b) ## API - Base URL: https://api.lsh.ai/v1 - Auth: Bearer token (LATITUDE_API_KEY) Co-Authored-By: Claude Opus 4.5 --- docs/my-website/docs/providers/latitude.md | 126 +++++++++++++++++++++ litellm/llms/openai_like/providers.json | 5 + model_prices_and_context_window.json | 78 +++++++++++++ 3 files changed, 209 insertions(+) create mode 100644 docs/my-website/docs/providers/latitude.md diff --git a/docs/my-website/docs/providers/latitude.md b/docs/my-website/docs/providers/latitude.md new file mode 100644 index 00000000000..1171489b25a --- /dev/null +++ b/docs/my-website/docs/providers/latitude.md @@ -0,0 +1,126 @@ +# Latitude AI + +[Latitude](https://latitude.sh) is a GPU cloud provider offering OpenAI-compatible inference APIs for open-source LLMs. + +## API Keys + +```python +import os +os.environ["LATITUDE_API_KEY"] = "lat_..." +``` + +Get your API key from [Latitude AI Dashboard](https://ai.latitude.sh). + +## Usage + +```python +from litellm import completion + +response = completion( + model="latitude/qwen-2.5-7b", + messages=[{"role": "user", "content": "Hello, how are you?"}] +) +print(response.choices[0].message.content) +``` + +## Streaming + +```python +from litellm import completion + +response = completion( + model="latitude/llama-3.1-8b", + messages=[{"role": "user", "content": "Write a poem about AI"}], + stream=True +) + +for chunk in response: + print(chunk.choices[0].delta.content or "", end="") +``` + +## Supported Models + +| Model | Context | Max Output | Features | +|-------|---------|------------|----------| +| `latitude/qwen-2.5-7b` | 131K | 8K | Tools, JSON mode | +| `latitude/llama-3.1-8b` | 128K | 8K | Tools, JSON mode | +| `latitude/qwen3-32b` | 131K | 8K | Tools, JSON mode | +| `latitude/gemma-2-27b` | 8K | 8K | Tools, JSON mode | +| `latitude/deepseek-r1-distill-14b` | 64K | 8K | Tools, JSON mode, Reasoning | +| `latitude/qwen2.5-coder-32b` | 131K | 8K | Tools, JSON mode | +| `latitude/qwen-2.5-vl-7b` | 32K | 8K | Tools, JSON mode, Vision | + +## Tool Calling + +```python +from litellm import completion + +tools = [ + { + "type": "function", + "function": { + "name": "get_weather", + "description": "Get the weather in a location", + "parameters": { + "type": "object", + "properties": { + "location": {"type": "string", "description": "City name"} + }, + "required": ["location"] + } + } + } +] + +response = completion( + model="latitude/qwen-2.5-7b", + messages=[{"role": "user", "content": "What's the weather in Tokyo?"}], + tools=tools +) +``` + +## JSON Mode + +```python +from litellm import completion + +response = completion( + model="latitude/qwen-2.5-7b", + messages=[{"role": "user", "content": "List 3 colors as JSON"}], + response_format={"type": "json_object"} +) +``` + +## Vision (qwen-2.5-vl-7b) + +```python +from litellm import completion + +response = completion( + model="latitude/qwen-2.5-vl-7b", + messages=[ + { + "role": "user", + "content": [ + {"type": "text", "text": "What's in this image?"}, + {"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}} + ] + } + ] +) +``` + +## Supported Parameters + +| Parameter | Supported | +|-----------|-----------| +| `temperature` | ✅ | +| `max_tokens` | ✅ | +| `top_p` | ✅ | +| `stop` | ✅ | +| `presence_penalty` | ✅ | +| `frequency_penalty` | ✅ | +| `seed` | ✅ | +| `tools` | ✅ | +| `response_format` | ✅ | +| `stream` | ✅ | diff --git a/litellm/llms/openai_like/providers.json b/litellm/llms/openai_like/providers.json index b4f9cbe42de..cc7b38f0064 100644 --- a/litellm/llms/openai_like/providers.json +++ b/litellm/llms/openai_like/providers.json @@ -15,6 +15,11 @@ "base_url": "https://ai-gateway.helicone.ai/", "api_key_env": "HELICONE_API_KEY" }, + "latitude": { + "base_url": "https://api.lsh.ai/v1", + "api_key_env": "LATITUDE_API_KEY", + "api_base_env": "LATITUDE_API_BASE" + }, "veniceai": { "base_url": "https://api.venice.ai/api/v1", "api_key_env": "VENICE_AI_API_KEY" diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index d958ea4503a..0df2a14c943 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -19633,6 +19633,84 @@ "supports_system_messages": true, "supports_tool_choice": true }, + "latitude/deepseek-r1-distill-14b": { + "input_cost_per_token": 1.44e-06, + "litellm_provider": "latitude", + "max_input_tokens": 64000, + "max_output_tokens": 8192, + "mode": "chat", + "output_cost_per_token": 1.44e-06, + "supports_function_calling": true, + "supports_system_messages": true, + "supports_tool_choice": true + }, + "latitude/gemma-2-27b": { + "input_cost_per_token": 4.5e-07, + "litellm_provider": "latitude", + "max_input_tokens": 8192, + "max_output_tokens": 8192, + "mode": "chat", + "output_cost_per_token": 4.5e-07, + "supports_function_calling": true, + "supports_system_messages": true, + "supports_tool_choice": true + }, + "latitude/llama-3.1-8b": { + "input_cost_per_token": 1.6e-07, + "litellm_provider": "latitude", + "max_input_tokens": 128000, + "max_output_tokens": 8192, + "mode": "chat", + "output_cost_per_token": 1.6e-07, + "supports_function_calling": true, + "supports_system_messages": true, + "supports_tool_choice": true + }, + "latitude/qwen-2.5-7b": { + "input_cost_per_token": 2.7e-07, + "litellm_provider": "latitude", + "max_input_tokens": 131072, + "max_output_tokens": 8192, + "mode": "chat", + "output_cost_per_token": 2.7e-07, + "supports_function_calling": true, + "supports_system_messages": true, + "supports_tool_choice": true + }, + "latitude/qwen-2.5-vl-7b": { + "input_cost_per_token": 3.6e-07, + "litellm_provider": "latitude", + "max_input_tokens": 32768, + "max_output_tokens": 8192, + "mode": "chat", + "output_cost_per_token": 3.6e-07, + "supports_function_calling": true, + "supports_system_messages": true, + "supports_tool_choice": true, + "supports_vision": true + }, + "latitude/qwen2.5-coder-32b": { + "input_cost_per_token": 7.2e-07, + "litellm_provider": "latitude", + "max_input_tokens": 131072, + "max_output_tokens": 8192, + "mode": "chat", + "output_cost_per_token": 7.2e-07, + "supports_function_calling": true, + "supports_system_messages": true, + "supports_tool_choice": true + }, + "latitude/qwen3-32b": { + "input_cost_per_token": 4.5e-07, + "litellm_provider": "latitude", + "max_input_tokens": 131072, + "max_output_tokens": 8192, + "mode": "chat", + "output_cost_per_token": 9e-07, + "supports_function_calling": true, + "supports_system_messages": true, + "supports_tool_choice": true + }, "j2-light": { "input_cost_per_token": 3e-06, "litellm_provider": "ai21",