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

# Model APIs quickstart

> Call DeepSeek V4 Flash through RunInfra's OpenAI-compatible hosted inference API.

Model APIs is RunInfra's OpenAI-compatible hosted inference API. You use an OpenAI client or curl. Hosted inference requires the Core plan or higher.

<Steps>
  <Step title="Get a key">
    Open [Model APIs](https://runinfra.ai/inference), create or reveal a workspace API key, and copy it.
  </Step>

  <Step title="Set the base URL">
    Use `https://api.runinfra.ai/v1` and store the key in `RUNINFRA_GATEWAY_KEY`.

    ```bash theme={"dark"}
    export RUNINFRA_GATEWAY_KEY="YOUR_RUNINFRA_GATEWAY_KEY"
    ```
  </Step>

  <Step title="Call DeepSeek V4 Flash">
    Use the model id `deepseek-v4-flash`.

    <CodeGroup>
      ```python Python theme={"dark"}
      import os
      from openai import OpenAI

      client = OpenAI(
          base_url="https://api.runinfra.ai/v1",
          api_key=os.environ["RUNINFRA_GATEWAY_KEY"],
      )
      response = client.chat.completions.create(
          model="deepseek-v4-flash",
          messages=[{"role": "user", "content": "Reply with one short greeting."}],
          max_tokens=64,
      )
      print(response.choices[0].message.content)
      ```

      ```typescript TypeScript theme={"dark"}
      import OpenAI from "openai";

      const client = new OpenAI({
        baseURL: "https://api.runinfra.ai/v1",
        apiKey: process.env.RUNINFRA_GATEWAY_KEY,
      });
      const response = await client.chat.completions.create({
        model: "deepseek-v4-flash",
        messages: [{ role: "user", content: "Reply with one short greeting." }],
        max_tokens: 64,
      });
      console.log(response.choices[0]?.message?.content);
      ```

      ```bash cURL theme={"dark"}
      curl https://api.runinfra.ai/v1/chat/completions \
        -H "Authorization: Bearer $RUNINFRA_GATEWAY_KEY" \
        -H "Content-Type: application/json" \
        -d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"Reply with one short greeting."}],"max_tokens":64}'
      ```
    </CodeGroup>
  </Step>
</Steps>

No client request id or idempotency key is required for this first call. Add retry protection when your application needs it.

## Next steps

<Columns cols={3}>
  <Card title="Chat completions" icon="messages-square" href="/docs/api-reference/chat-completions">
    Review the exact forwarded fields.
  </Card>

  <Card title="Streaming" icon="radio" href="/docs/api-reference/streaming">
    Stream deltas and request the usage chunk.
  </Card>

  <Card title="Idempotent retries" icon="refresh-cw" href="/docs/api-reference/idempotent-retries">
    Retry non-streaming calls with a stable key.
  </Card>
</Columns>
