Как получить headers или значение, когда сбросится requests per minute, если делаю completion с помощью Groq?
@shared_task(name="prompt_queue")
def prompt(text, action_type_id, file_id, language_code, kit_id=None):
    try:
        action_type = TranscriptionActionType.objects.get(id=action_type_id)
        total_tokens_used = 0

        model_name = "llama-3.1-70b-versatile"
        max_tokens_per_request = 20000  # as per your max_tokens parameter
        max_completion_tokens = 1000  # adjust based on your expected completion length
        reserved_tokens = max_completion_tokens
        system_content = action_type.system_content
        system_tokens = count_tokens(system_content, model_name)
        user_content = action_type.user_content
        user_tokens = count_tokens(user_content, model_name)
        max_chunk_tokens = max_tokens_per_request - reserved_tokens - system_tokens - user_tokens
        last_tokens = 0
        # split the transcription text into chunks
        chunks = split_text_into_chunks(text, max_chunk_tokens, model_name)
        messages = [
            {"role": "system", "content": action_type.system_content},
        ]
        assistant_responses = []

        for index, chunk in enumerate(chunks):
            user_message = {
                "role": "user",
                "content": action_type.user_content.format(
                    text=chunk, language=language_code
                )
            }

            messages.append(user_message)

            # estimate tokens for the prompt
            input_tokens = sum(count_tokens(m['content'], model_name) for m in messages)
            total_tokens = input_tokens + max_completion_tokens
            if total_tokens > max_tokens_per_request:
                while total_tokens > max_tokens_per_request and len(messages) > 2:
                    messages.pop(1)
                    input_tokens = sum(count_tokens(m['content'], model_name) for m in messages)
                    total_tokens = input_tokens + max_completion_tokens

            # wait for tokens to be available
            completion = client.chat.completions.create(
                model=model_name,
                messages=messages,
                temperature=0.1,
                max_tokens=max_completion_tokens,
                top_p=1,
                stream=False,
                stop=None,
            )

            # extract the content
            assistant_message = completion.choices[0].message
            content = assistant_message.content
            assistant_responses.append(content)
            messages.append({"role": "assistant", "content": content})

            print(f"{completion.usage}")
            # update the total tokens used
            if hasattr(completion, 'usage') and hasattr(completion.usage, 'total_tokens'):
                total_tokens_used += completion.usage.total_tokens
            else:
                total_tokens_used += total_tokens  # use estimated tokens
            print(f"total_tokens: {total_tokens}")
            print(total_tokens_used)
            last_tokens = completion.usage.completion_tokens
            print(f"last_tokens:{last_tokens}")
            completion_headers = completion.headers
            print(completion_headers)
            remaining_tokens_per_minute = completion_headers.get('x-ratelimit-remaining-tokens')
            print(remaining_tokens_per_minute)
            time_before_next_prompt = completion_headers.get('x-ratelimit-reset-requests')
            print(time_before_next_prompt)
            sleep(time_before_next_prompt)

        # combine the summaries
        final_summary = " ".join(assistant_responses)

        transcription_action = TranscriptionAction.objects.create(
            file_id=file_id, action_type_id=action_type_id, content=final_summary, kit_id=kit_id
        )
        return transcription_action.id
    except Exception as e:
        error_message = f"An error occurred in the prompt function: {e}"
        print(error_message)
        sentry_sdk.capture_exception(e)
        return None