Your first response

Create a global API key, add USD credit, send your first request, and read the result.

You need a terminal with curl, a BeefAPI account, an API key, and enough USD credit for the request.

1. Create an API key

Register or sign in, then open API keys. Create an API key and copy its full sk-... value. Use a key created on global.beefapi.com; keys and credit from the Chinese site cannot be used here.

Add credit on Billing and wait for the balance to update. An unlimited key still spends your account balance.

2. Set the key

In macOS or Linux:

export BEEFAPI_KEY="sk-REPLACE_WITH_YOUR_KEY"

In Windows PowerShell:

$env:BEEFAPI_KEY = "sk-REPLACE_WITH_YOUR_KEY"

The curl examples below use Bash syntax. On Windows, run them in WSL or Git Bash, or use the Python example in Client setup.

Keep the key on your server. Do not put it in browser code, screenshots, or a public repository.

3. Send a request

curl https://global.beefapi.com/v1/chat/completions \
  --fail-with-body \
  -H "Authorization: Bearer $BEEFAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-sol",
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }' -o response.json

Base URL: https://global.beefapi.com/v1. Use an exact model ID from Models if your key does not have access to this example model.

4. Read the response

A successful response includes a choices array, with generated text under choices[0].message.content. Other fields include the response ID, model, and usage when reported. Read the text with Python 3:

python3 -c 'import json; print(json.load(open("response.json"))["choices"][0]["message"]["content"])'

If curl reports an HTTP error, inspect response.json for the error body instead. Do not run the extraction command against an error response.

Open Usage to find the request and its USD cost. Keep its request ID when asking support for help.

Next request

  • API reference: Responses, Anthropic Messages, streaming, and account access.
  • Images: Generate or edit an image.
  • Videos: Create a task and download a video.
  • Client setup: Python, JavaScript, Codex CLI, and Claude Code.
  • Errors: Invalid keys, insufficient credit, timeouts, and retry decisions.

On this page