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

# General inference

> Send requests to Morph models without provisioning an endpoint

Call public models immediately without reserving GPUs. Morph manages the pools and bills usage at each model's token rates.

## Send your first request

Create a [dashboard API key](https://www.morphllm.com/dashboard/api-keys). To bill an organization, select it before creating the key.

Set your terminal's key:

```bash theme={null}
export MORPH_API_KEY="YOUR_MORPH_API_KEY"
```

These examples use `morph-glm53-744b`. The [catalog](https://docs.morphllm.com/sdk/components/fast-models) lists public model IDs, context windows, and rates.

> [tab] cURL
>
> ```bash theme={null}
> curl --fail-with-body https://api.morphllm.com/v1/chat/completions \
>   -H "Authorization: Bearer $MORPH_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "model": "morph-glm53-744b",
>     "messages": [{"role": "user", "content": "Write a Python function that checks whether a string is a palindrome."}]
>   }'
> ```

> [tab] Python
>
> Run `pip install openai`, then:
>
> ```python theme={null}
> import os
> from openai import OpenAI
>
> client = OpenAI(
>     api_key=os.environ["MORPH_API_KEY"],
>     base_url="https://api.morphllm.com/v1",
> )
>
> response = client.chat.completions.create(
>     model="morph-glm53-744b",
>     messages=[{"role": "user", "content": "Write a Python function that checks whether a string is a palindrome."}],
> )
> print(response.choices[0].message.content)
> ```

> [tab] JavaScript
>
> Run `npm install openai`. Save as `request.mjs`; run `node request.mjs`:
>
> ```javascript theme={null}
> import OpenAI from "openai";
>
> const client = new OpenAI({
>   apiKey: process.env.MORPH_API_KEY,
>   baseURL: "https://api.morphllm.com/v1",
> });
>
> const response = await client.chat.completions.create({
>   model: "morph-glm53-744b",
>   messages: [{ role: "user", content: "Write a Python function that checks whether a string is a palindrome." }],
> });
> console.log(response.choices[0].message.content);
> ```

Keep keys on your server, never in browser code.

## Use your existing client

OpenAI clients need `https://api.morphllm.com/v1`, your Morph key, and a public model ID.

See [Anthropic formats](https://docs.morphllm.com/endpoints.md#api-formats) and [coding agent setup](https://docs.morphllm.com/guides/coding-agents.md) for other clients.

## Handle busy periods and errors

For `429`, honor `Retry-After` when present; retry with exponential backoff and jitter. Immediate retries add load, not capacity.

For `401`, check the key and authorization header. For model errors, check the catalog ID. Correct invalid credentials or IDs before retrying.

[Standby](https://docs.morphllm.com/sdk/components/standby.md) is a separate tier for work that tolerates capacity rejections.

## Monitor usage and choose capacity

The [dashboard](https://www.morphllm.com/dashboard) shows requests, usage, and billing for your key's account. See [prompt caching](https://docs.morphllm.com/sdk/components/caching.md) for repeated input.

For reserved capacity, review [dedicated plans and cancellation](https://docs.morphllm.com/dedicated-endpoints.md) before purchasing. Idle capacity remains billable.


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