Skip to main content

Quick start

Get started with Latitude AI in under 2 minutes:
from portkey_ai import Portkey

# 1. Install: pip install portkey-ai
# 2. Add @latitude provider in model catalog
# 3. Use it:

portkey = Portkey(api_key="PORTKEY_API_KEY")

response = portkey.chat.completions.create(
    model="@latitude/qwen-2.5-7b",
    messages=[{"role": "user", "content": "Hello!"}]
)

print(response.choices[0].message.content)

Add provider in model catalog

Before making requests, add Latitude AI to your Model Catalog:
  1. Go to Model Catalog → Add Provider
  2. Select Latitude
  3. Enter your Latitude AI API key
  4. Name your provider (e.g., latitude)

Complete Setup Guide

See all setup options and detailed configuration instructions

Latitude AI capabilities

Tool calling

Use Latitude AI’s tool calling feature to trigger external functions:
from portkey_ai import Portkey

portkey = Portkey(api_key="PORTKEY_API_KEY")

tools = [{
    "type": "function",
    "function": {
        "name": "getWeather",
        "description": "Get the current weather",
        "parameters": {
            "type": "object",
            "properties": {
                "location": {"type": "string", "description": "City and state"},
                "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
            },
            "required": ["location"]
        }
    }
}]

response = portkey.chat.completions.create(
    model="@latitude/qwen-2.5-7b",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What's the weather like in Delhi?"}
    ],
    tools=tools,
    tool_choice="auto"
)

print(response.choices[0].finish_reason)

JSON output

Force structured JSON responses from Latitude AI models:
from portkey_ai import Portkey

portkey = Portkey(api_key="PORTKEY_API_KEY")

response = portkey.chat.completions.create(
    model="@latitude/qwen-2.5-7b",
    messages=[
        {"role": "system", "content": "Respond in JSON format with keys: answer, confidence"},
        {"role": "user", "content": "What is the capital of France?"}
    ],
    response_format={"type": "json_object"}
)

print(response.choices[0].message.content)

Supported models

ModelContextFeatures
qwen-2.5-7b131KTools, JSON mode
llama-3.1-8b128KTools, JSON mode
qwen3-32b131KTools, JSON mode
gemma-2-27b8KTools, JSON mode
deepseek-r1-distill-14b64KTools, JSON mode, Reasoning
qwen2.5-coder-32b131KTools, JSON mode
qwen-2.5-vl-7b32KTools, JSON mode, Vision

Latitude AI Models

View the complete list of models available on Latitude AI

Next steps

Gateway Configs

Add fallbacks, load balancing, and more

Observability

Monitor and trace your Latitude AI requests

Prompt Library

Manage and version your prompts

Metadata

Add custom metadata to requests
For complete SDK documentation:

SDK Reference

Complete Portkey SDK documentation
Last modified on March 25, 2026