> ## Documentation Index
> Fetch the complete documentation index at: https://docs.together.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Send requests

> After deploying a model, send requests using the shared inference API.

After [deploying a model](https://docs.together.ai/docs/dedicated-endpoints/manage.md#create-a-deployment) and [routing traffic](https://docs.together.ai/docs/dedicated-endpoints/route-traffic.md) to it, you can send requests to the endpoint using the same [inference APIs](https://docs.together.ai/docs/inference/overview.md) as serverless models.

Features available on the underlying model work the same way on DMI, including:

* [Function calling](https://docs.together.ai/docs/inference/function-calling/overview.md) for tool use.
* [Structured outputs](https://docs.together.ai/docs/inference/chat/structured-outputs.md) for JSON-shaped responses.
* [Streaming](https://docs.together.ai/docs/inference/chat/overview.md) responses.

Dedicated model inference is served at `https://api-inference.together.ai`. There's no CLI for inference, so send requests with curl or the SDK, pointing the SDK's base URL at `https://api-inference.together.ai`. OpenAI-compatible clients use `https://api-inference.together.ai/v1`.

Pass the endpoint string as the `model` parameter, and use the same request shape you'd use against a serverless model. The endpoint string has the form `your-project-slug/endpoint-name`:

```python Python theme={null}
from together import Together

client = Together(base_url="https://api-inference.together.ai")

response = client.chat.completions.create(
    model="your-project-slug/endpoint-name",
    messages=[{"role": "user", "content": "What is 2+2?"}],
    max_tokens=512,
)

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

```typescript TypeScript theme={null}
import Together from 'together-ai';

const client = new Together({
  baseURL: 'https://api-inference.together.ai',
});

const response = await client.chat.completions.create({
  model: 'your-project-slug/endpoint-name',
  messages: [{ role: 'user', content: 'What is 2+2?' }],
  max_tokens: 512,
});

console.log(response.choices[0].message.content);
```

```bash cURL theme={null}
curl -s -X POST https://api-inference.together.ai/v1/chat/completions \
  -H "Authorization: Bearer $TOGETHER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "your-project-slug/endpoint-name",
    "messages": [{"role": "user", "content": "What is 2+2?"}],
    "max_tokens": 512
  }' | jq .
```

To [call a low-rank adapter (LoRA)](https://docs.together.ai/docs/post-training/multi-lora-deployment.md#send-requests-to-an-adapter) attached to the deployment, append a colon and the adapter's model ID to the endpoint string, for example `your-project-slug/endpoint-name:ml_abc123`.

## Prompt caching

Prompt caching stores the result of previously processed prompt prefixes so the model can reuse them instead of recomputing. It reduces redundant compute for repeated prefixes, such as a system prompt that's shared across many requests.

Prompt caching is enabled by default for dedicated model inference. No configuration is required.

See [Prompt caching](https://docs.together.ai/docs/inference/chat/prompt-caching.md) for detailed information on how prefix matching works, how to structure prompts for cache hits, and how to group related requests with `prompt_cache_key`.

## Decoding optimizations

Decoding optimizations such as speculative decoding are set by the [config](https://docs.together.ai/docs/dedicated-endpoints/configs.md#decoding-optimizations) your deployment runs on. To change them, deploy a different config.

## Next steps

> [card] [Create a deployment](https://docs.together.ai/docs/dedicated-endpoints/manage.md#create-a-deployment)
>
> Set the traffic split that drives routing.

> [card] [Route traffic](https://docs.together.ai/docs/dedicated-endpoints/route-traffic.md)
>
> See how the endpoint resolves each request to a deployment.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.