---
title: "Test Model Connection"
method: POST
path: "/health/test_connection"
tags: ["health"]
---

# Test Model Connection

`POST /health/test_connection`

Test a direct connection to a specific model.

This endpoint allows you to verify if your proxy can successfully connect to a specific model.
It's useful for troubleshooting model connectivity issues without going through the full proxy routing.

Example:
```bash
# If model is configured in proxy_config.yaml, you only need to specify the model name:
curl -X POST 'http://localhost:4000/health/test_connection' \
  -H 'Authorization: Bearer sk-1234' \
  -H 'Content-Type: application/json' \
  -d '{
    "litellm_params": {
        "model": "gpt-4o"
    },
    "mode": "chat"
  }'

# The endpoint will automatically use api_key, api_base, etc. from proxy_config.yaml

# You can also override specific params or test with custom credentials:
curl -X POST 'http://localhost:4000/health/test_connection' \
  -H 'Authorization: Bearer sk-1234' \
  -H 'Content-Type: application/json' \
  -d '{
    "litellm_params": {
        "model": "azure/gpt-4o",
        "api_key": "os.environ/AZURE_OPENAI_API_KEY",
        "api_base": "os.environ/AZURE_OPENAI_ENDPOINT",
        "api_version": "2024-10-21"
    },
    "mode": "chat"
  }'
```

Note: 
- If the model is configured in proxy_config.yaml, credentials (api_key, api_base, etc.) 
  will be automatically loaded from the config (with resolved environment variables).
- You can override specific params by including them in the request.
- You can use `os.environ/VARIABLE_NAME` syntax to reference environment variables,
  which will be resolved automatically (same as in proxy_config.yaml).

Returns:
    dict: A dictionary containing the health check result with either success information or error details.

## Request body

- BodyTestModelConnectionHealthTestConnectionPost
  - `mode` 'chat' | 'completion' | 'embedding' | 'audio_speech' | 'audio_transcription' | 'image_generation' | 'video_generation' | 'batch' | 'rerank' | 'realtime' | 'responses' | 'ocr', nullable — The mode to test the model with
  - `litellm_params` object — Parameters for litellm.completion, litellm.embedding for the health check
  - `model_info` object — Model info for the health check

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/flock/apis/litellm-api.md) · [All operations](https://skmtc.net/flock/apis/litellm-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/flock/litellm-api/revisions/8fbaab4fc7c5/schema)
