---
title: "Mock Completion Responses - Save Testing Costs"
url: "/docs/tutorials/mock_completion"
canonical_url: "https://docs.litellm.ai/docs/tutorials/mock_completion"
type: "docs"
last_updated: "2026-10-06"
summary: "Trying to test making LLM Completion calls without calling the LLM APIs ?"
related:
  - "/docs/tutorials/text_completion"
  - "/docs/tutorials/python_sdk"
---
# Mock Completion Responses - Save Testing Costs

> Index of all LiteLLM docs: https://docs.litellm.ai/llms.txt


Trying to test making LLM Completion calls without calling the LLM APIs ? 
Pass `mock_response` to `litellm.completion` and litellm will directly return the response without neededing the call the LLM API and spend $$ 

## Using `completion()` with `mock_response`

```python
from litellm import completion 

model = "gpt-5.6-luna"
messages = [{"role":"user", "content":"Why is LiteLLM amazing?"}]

completion(model=model, messages=messages, mock_response="It's simple to use and easy to get started")
```

## Building a pytest function using `completion`

```python
from litellm import completion
import pytest

def test_completion_openai():
    try:
        response = completion(
            model="gpt-5.6-luna",
            messages=[{"role":"user", "content":"Why is LiteLLM amazing?"}],
            mock_response="LiteLLM is awesome"
        )
        # Add any assertions here to check the response
        print(response)
        print(response['choices'][0]['finish_reason'])
    except Exception as e:
        pytest.fail(f"Error occurred: {e}")
```

## Related pages

- [Using Text Completion Format - with Completion()](https://docs.litellm.ai/docs/tutorials/text_completion.md)
- [Python SDK](https://docs.litellm.ai/docs/tutorials/python_sdk.md)
